SDL_Init函数
来源:互联网 发布:gossip协议《算法》 编辑:程序博客网 时间:2024/06/04 00:26
SDL_Init函数:
用来初始化SDL库,必须在使用SDL其它函数之前调用此函数。
int SDL_Init(Uint32 flags)
其中,flags可以取下列值:
SDL_INIT_TIMER:定时器
SDL_INIT_AUDIO:音频
SDL_INIT_VIDEO:视频
SDL_INIT_JOYSTICK:摇杆
SDL_INIT_HAPTIC:触摸屏
SDL_INIT_GAMECONTROLLER:游戏控制器
SDL_INIT_EVENTS:事件
SDL_INIT_NOPARACHUTE:不捕获关键信号(这个不理解)
SDL_INIT_EVERYTHING:包含上述所有选项
http://blog.csdn.net/leixiaohua1020/article/details/40680907
#include <exception>#include <string>#include "SDL.h"class InitError: public std::exception { public: InitError(); InitError(const std::string&); virtual ~InitError() throw(); virtual const char* what() const throw(); private: std::string msg;};InitError::InitError(): exception(), msg(SDL_GetError()) {}InitError::InitError(const std::string& m): exception(), msg(m) {}InitError::~InitError() throw() {}const char* InitError::what() const throw() { return msg.c_str();}class SDL { public: SDL(Uint32 flags = 0) throw(InitError); virtual ~SDL();};SDL::SDL(Uint32 flags) throw(InitError) { if (SDL_Init(flags) != 0) throw InitError();}SDL::~SDL() { SDL_Quit();}/* ... */#include <iostream>int main(int argc, char **argv) { try { SDL sdl(SDL_INIT_VIDEO|SDL_INIT_TIMER); /* ... */ return 0; } catch (const InitError& err) { std::cerr << "Error while initializing SDL: " << err.what() << std::endl; } return 1;}
蔡军生
0 0
- SDL_Init函数
- SDL_Init()代码阅读
- SDL2源代码分析1:初始化(SDL_Init())
- SDL2源代码分析1:初始化(SDL_Init())
- SDL2源代码分析1:初始化(SDL_Init())
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 常见的验证码与验证码识别工具详细实例解说
- 在Linux下使用TCP封装器来加强网络服务安全
- 如何 在 Mac OS X 里通过命令行获取 CPU 信息
- JDBC(2)JAVA连接数据库之 分页操作、事务操作、代理模式
- unity文件存储和读取
- SDL_Init函数
- 文章标题
- android IntentService分析
- 1209日常小结
- 按键70秒,Root轻松得:Linux惊现高危漏洞
- socket编程之bind()函数
- java 文件、文件夹 递归复制、移动
- 4-2-Two Stacks In One Array
- R语言-数据预处理的一些实用(万能)办法:缺失值、数据重复、共线性等等的处理