选择File->New,新建一个工程,选择Win32 Application,将工程gp保存为tutorial目录下,如图3所示。 图3 在图4中,保持默认设置,点击Finish。 图4 为了使用SDL,我们需要进行相关的设置,选择Project->Settings...,选择C/C++属性页,在Category中选择Code Generation,在Use run-time library中选择Debug Multithreaded DLL,如...
class CApp : public CEvent {private:bool Running;SDL_Surface* Surf_Display;private:SDL_Surface* Surf_Grid;SDL_Surface* Surf_X;SDL_Surface* Surf_O;public:CApp();int OnExecute();public:bool OnInit();void OnEvent(SDL_Event* Event);void OnExit();void OnLoop();void OnRender();void On...
SDL_Error: %s\n",SDL_GetError());}else{// 创建窗口window=SDL_CreateWindow("SDL Tutorial",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,SCREEN_WIDTH,SCREEN_HEIGHT,SDL_
printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); }else{//Create windowwindow = SDL_CreateWindow("SDL Tutorial",0,0, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);if(window ==NULL) { printf("Window could not be created! SDL_Error: %s\n", SDL_GetError()); ...
boolinit(){//初始化标志bool success=true;//初始化SDLif(SDL_Init(SDL_INIT_VIDEO)<0){printf("SDL could not initialize! SDL_Error: %s\n",SDL_GetError());success=false;}else{//创建窗口gWindow=SDL_CreateWindow("SDL Tutorial",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,SCREEN_WIDTH,SCREE...
在这个简单的程序中,我们使用SDL库创建了一个窗口,并在窗口中显示了一个标题为“SDL Tutorial”的窗口。然后程序会延迟3秒后关闭窗口并退出。 编译这个程序可以使用以下命令: ```bash gcc sdl_tutorial.c -o sdl_tutorial -lSDL2 ``` 执行编译后生成的可执行文件,我们就可以看到一个简单的SDL窗口弹出并显示“...
下面我们正式开始编程,将E:"tutorial"SDL-1.2.8"lib"SDL.dll拷贝到gp文件夹下,然后给gp工程增加一个C++文件main.cpp。如图9所示。 图9 将以下代码拷贝到main.cpp并保存。 #include <stdlib.h> #if defined(_MSC_VER) #include "SDL.h" #else
C语言高级技术 模块化编程 进击的指针,C语言王牌 数组 字符串 预处理 创建你自己的变量类型 文件读写 动态分配 实战:“悬挂小人”游戏 练习题 习作:用自己的语言解释指针 用基于C语言的SDL库开发2D游戏 安装SDL 创建窗口和画布 显示图像 事件处理 实战:“超级玛丽推箱子”游戏 ...
Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Cancel Create saved search Sign in Sign up Reseting focus {{ message }} adolfans / sdltutorialcn Public Notifications You must be signed in to change notification settings Fork 1 Star ...
目录:http://adolfans.github.com/sdltutorialcn/blog/2013/01/25/sdl-2-dot-0-tutorial-index/(内附原文地》址,原文需要梯子)其中除了最后一篇定时器还没有翻译之外,其他都大概翻译了。除了一开始翻译的几篇,之后的几篇的翻译都带着原文,希望有网友能帮我查错……(其实我就是来找人帮我看看的)这些原文大概...