简体   繁体   English

SDL2_gfx安装和使用-Mac OS X

[英]SDL2_gfx install and USE - Mac OS X

I've been trying for about 6 hours... to make use of the SDL2_gfx library in my project on Xcode 8.0 . 我已经尝试了大约6个小时...在Xcode 8.0的项目中使用SDL2_gfx库。

I'll tell you right now, I'm a complete newbie to all of this, terminal commands, including libraries and stuff. 我现在告诉您,我是所有这些终端命令(包括库和内容)的完全新手

I've managed to use SDL2 fine, for there is a .framework, but the SDL2_gfx only comes as a folder with a .a, .dylib, .h and a mysterious .json. 我已经设法使用SDL2了,因为有一个.framework,但是SDL2_gfx仅作为一个带有.a,.dylib,.h和一个神秘的.json的文件夹来提供。

I've installed it through homebrew whithout problems, but now, how do I make a project using it ?? 我已经通过自制软件解决了所有问题,但是现在, 我如何使用它来制作项目?

In the Build Phases and Build Settings : I've tried linking .a and .dylib via "Link Binary With Libraries", I've added the headers paths in "Headers Search Paths" in "Search Paths", I've tried adding the .h to my project directly, and I have absolutely no idea of what to put in "Other Linker Flags" as it what suggested in many answers. 在构建阶段和构建设置中:我尝试通过“使用库链接二进制文件”链接.a和.dylib,在“搜索路径”的“标题搜索路径”中添加了标题路径,并尝试添加.h直接添加到我的项目中,我完全不知道要在“其他链接程序标志”中添加什么,因为它在许多答案中都建议使用。

I keep getting the very simple error "no matching function for call ..." whenever I try using a function. 每当我尝试使用一个函数时,都会收到非常简单的错误“没有匹配的函数...”。 But I'm doing it the same way as in some examples on the internet, and I checked in the .h, the functions do exist... 但是我这样做的方式与互联网上某些示例中的方式相同,并且我检查了.h,这些功能确实存在...

Please help T_T 请帮忙T_T

EDIT : I've managed to find functions that are apparently recognized : 编辑:我设法找到显然可以识别的功能:

Sint16 circleR = 100;
Sint16 circleX = 300;
Sint16 circleY = 300;

int result = filledCircleColor(gRenderer, circleX, circleY, circleR, 0xFF0000FF);
        std::cout << "draw circle result " << result << std::endl;

int a = pixelRGBA(gRenderer, circleR, circleR, 0xFF, 0x00, 0x00, 0xFF);
        std::cout << "draw pixel result " << a << std::end;

But come out with result -1, which means it didn't work. 但是结果为-1,这意味着它没有用。 Still can't figure it out... I suppose I'm not using them correctly, but I can't find any different example on the internet. 仍然无法弄清楚...我想我没有正确使用它们,但是在互联网上找不到任何其他示例

i think i see your problem : you are calling with as 1st parameter a RENDERER. 我认为我看到了您的问题:您正在使用第一个参数调用RENDERER。 The function header expects a SURFACE : 函数头需要一个SURFACE:

http://www.ferzkopp.net/Software/SDL_gfx-2.0/Docs/html/_s_d_l__gfx_primitives_8h.html#a4f7b717b958ef39bfc8c958476dd0de1 http://www.ferzkopp.net/Software/SDL_gfx-2.0/Docs/html/_s_d_l__gfx_primitives_8h.html#a4f7b717b958ef39bfc8c958476dd0de1

clearly defines the function as : 明确定义该功能为:

SDL_GFXPRIMITIVES_SCOPE int filledCircleColor   (   SDL_Surface *   dst,
Sint16  x,
Sint16  y,
Sint16  rad,
Uint32  color 
)   

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM