选择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库创建了一个窗口,并在窗口中显示了一个标题为“SDL Tutorial”的窗口。然后程序会延迟3秒后关闭窗口并退出。 编译这个程序可以使用以下命令: ```bash gcc sdl_tutorial.c -o sdl_tutorial -lSDL2 ``` 执行编译后生成的可执行文件,我们就可以看到一个简单的SDL窗口弹出并显示“...
we've setup a special class to handle events, and we've also setup a class to handle a few surface functions. In this tutorial we'll take all those things, combine them, and create a tic-tac-toe game. Don't worry, things should...
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 2 ...
将SDLTutorial.cpp中的代码换成如下代码: Cpp代码 #include "SDL/SDL.h" intmain(intargc,char* args[] ) { SDL_Init( SDL_INIT_EVERYTHING );//初始化SDL环境 SDL_Quit();//退出SDL环境 return0; } 如果编译运行没有错误,则表示开发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
}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()); }else{//Get window surfacescreenSurface =SDL_GetWindowSurface(window); ...
#include <SDL.h> #include <stdio.h> int main(int argc, char* argv[]) { if (SDL_Init(SDL_INIT_VIDEO) < 0) { printf("SDL could not initialize! SDL Error: %s\n", SDL_GetError()); return 1; } SDL_Window *window = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFI...
目录:http://adolfans.github.com/sdltutorialcn/blog/2013/01/25/sdl-2-dot-0-tutorial-index/(内附原文地》址,原文需要梯子)其中除了最后一篇定时器还没有翻译之外,其他都大概翻译了。除了一开始翻译的几篇,之后的几篇的翻译都带着原文,希望有网友能帮我查错……(其实我就是来找人帮我看看的)这些原文大概...