SDL_ttf不会渲染
我遇到了 SDL_ttf 问题,无论我对 TTF_RenderText_Solid 函数做什么,它都拒绝渲染任何文本。我的源代码对于这个问题来说有点大(大概有 150 行之类的),所以我把它们的链接放在 Pastie 上。我想指出的是,即使我把这个东西放出来,它并不赋予你破坏和窃取我的代码的特权。可能不多,但我会把它视为个人侮辱。请不要这样做。无论如何,我的代码有什么问题吗? (如果你要编译它,只需用你自己的随机垃圾替换我的文件)
另外我想指出,我对正确编码有点陌生(不要笑:3),所以我的代码可能看起来有点,呃,组织得很糟糕。
谢谢。
编辑:哦糟糕,我忘了我撕掉了 SDL_ttf 方法。我很抱歉!请尝试在没有它们的情况下进行诊断或自行添加它们。
http://pastie.org/1348438 Main.cpp http://pastie.org/1348440 Main.h
I've got a problem with SDL_ttf, no matter what I do with the TTF_RenderText_Solid function, it refuses to render any text what so ever. My source code is a little bit hefty to put in this question (It's like 150 lines or something) so I'm putting the links to them on Pastie. I want to note, that even though I am putting this thing up it does not entitle you the privilege to screw with and steal my code. It may not be much, but I'll take it as a personal insult. Please just don't do it. Anyway, what's wrong with my code? (If you're going to compile it, just substitute my files with your own random crap)
Also I'd like to note that I'm somewhat new to coding this properly (don't laugh :3) and so my code may look a little, uh, badly organized.
Thanks.
Edit: Oh crap, I forgot that I ripped out my SDL_ttf methods. I'm so sorry! Please try to diagnose without them or add them yourself.
http://pastie.org/1348438 Main.cpp
http://pastie.org/1348440 Main.h
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,由于您没有提供任何进行
TTF_RenderText_Solid
调用的代码,所以我只能在黑暗中拍摄。TTF_Init
吗?TTF_RenderText_Solid
有何作用? “拒绝渲染”告诉我没有任何价值。它返回NULL
吗?它返回非NULL
吗?如果它返回一些东西,那么该图像是什么样的?您检查过 SDL 错误字符串吗? (我相信 SDL_ttf 会设置它。)Well, since you've not provided any code that makes
TTF_RenderText_Solid
calls, I can only take shots in the dark.TTF_Init
?TTF_RenderText_Solid
do? "Refuses to render" tells me nothing of value. Does it returnNULL
? Does it return non-NULL
? If it is returning something, what does that image look like? Have you checked the SDL error string? (I believe SDL_ttf will set it.)