SDL_SetVideoMode函数:

设置显示卡的显示模式:宽度、高度和像素的位数。

定义:

#include "SDL.h"
SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags);

例子:

#include "SDL.h"const int WINDOW_WIDTH = 640;const int WINDOW_HEIGHT = 480;const char* WINDOW_TITLE = "SDL Start";int main(int argc, char **argv){SDL_Init( SDL_INIT_VIDEO );SDL_Surface* screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT, 0,SDL_HWSURFACE | SDL_DOUBLEBUF );SDL_WM_SetCaption( WINDOW_TITLE, 0 );SDL_Quit();return 0;}

Set up a video mode with the specified width, height and bits-per-pixel.

If bpp is 0, it is treated as the current display bits per pixel.

The flags parameter is the same as the flags field of the SDL_Surface structure. OR'd combinations of the following values are valid.

SDL_SWSURFACE Create the video surface in system memory
SDL_HWSURFACE Create the video surface in video memory
SDL_ASYNCBLIT Enables the use of asynchronous updates of the display surface. This will usually slow down blitting on single CPU machines, but may provide a speed increase on SMP systems.
SDL_ANYFORMAT Normally, if a video surface of the requested bits-per-pixel (bpp) is not available, SDL will emulate one with a shadow surface. Passing SDL_ANYFORMAT prevents this and causes SDL to use the video surface, regardless of its pixel depth.
SDL_HWPALETTE Give SDL exclusive palette access. Without this flag you may not always get the the colors you request with SDL_SetColors or SDL_SetPalette.
SDL_DOUBLEBUF Enable hardware double buffering; only valid with SDL_HWSURFACE. Calling SDL_Flip will flip the buffers and update the screen. All drawing will take place on the surface that is not displayed at the moment. If double buffering could not be enabled then SDL_Flip will just perform a SDL_UpdateRect on the entire screen.
SDL_FULLSCREEN SDL will attempt to use a fullscreen mode. If a hardware resolution change is not possible (for whatever reason), the next higher resolution will be used and the display window centered on a black background.
SDL_OPENGL Create an OpenGL rendering context. You should have previously set OpenGL video attributes with SDL_GL_SetAttribute.
SDL_OPENGLBLIT Create an OpenGL rendering context, like above, but allow normal blitting operations. The screen (2D) surface may have an alpha channel, and SDL_UpdateRects must be used for updating changes to the screen surface. NOTE: This option is kept for compatibility only, and is not recommended for new code.
SDL_RESIZABLE Create a resizable window. When the window is resized by the user a SDL_VIDEORESIZE event is generated and SDL_SetVideoMode can be called again with the new size.
SDL_NOFRAME If possible, SDL_NOFRAME causes SDL to create a window with no title bar or frame decoration. Fullscreen modes automatically have this flag set.

Note: Whatever flags SDL_SetVideoMode could satisfy are set in the flags member of the returned surface.

Note: The bpp parameter is the number of bits per pixel, so a bpp of 24 uses the packed representation of 3 bytes/pixel. For the more common 4 bytes/pixel mode, use a bpp of 32. Somewhat oddly, both 15 and 16 will request a 2 bytes/pixel mode, but different pixel formats.

老蔡学堂

蔡军生

SDL_SetVideoMode函数相关推荐

  1. 2.SDL游戏开发:把代码写长一点(一)

    2019独角兽企业重金招聘Python工程师标准>>> 接着上一篇讲,里面有几个值得研究的函数,尽管理API里已经说得很清楚了,调用SDL_Init()动态的加载和初始化SDL库. ...

  2. 用SDL创建一个窗口

     原文来自:http://www.aaroncox.net/tutorials/2dtutorials/sdlwindow.html 注意:这里我们想当然你已经知道怎么在你的IDE集成开发环境里配 ...

  3. ffplay.c函数结构简单分析(画图)

    最近重温了一下FFplay的源代码.FFplay是FFmpeg项目提供的播放器示例.尽管FFplay只是一个简单的播放器示例,它的源代码的量也是不少的.之前看代码,主要是集中于某一个"点&q ...

  4. 数据库中自定义排序规则,Mysql中自定义字段排序规则,Oracle中自定义字段排序规则,decode函数的用法,field函数的用法

    数据库中自定义排序 场景:有一张banner表,表中有一个status字段,有0, 1, 2三个状态位,我想要 1,0,2的自定义排序(这里是重点),然后再进行之上对sequence字段进行二次排序( ...

  5. Mysql函数group_concat、find_in_set 多值分隔字符字段进行数据库字段值翻译

    Mysql函数group_concat.find_in_set进行数据库字段值翻译 场景 配方表:记录包含的原料 sources表示原料,字段值之间用逗号分隔 原料表:对应原料id和原料名称 现需要查 ...

  6. C++ 笔记(34)— C++ exit 函数

    当遇到 main 函数中的 return 语句时,C++ 程序将停止执行.但其他函数结束时,程序并不会停止.程序的控制将返回到函数调用之后的位置.然而,有时候会出现一些非常少见的情况,使得程序有必要在 ...

  7. C++ 笔记(30)— 友元函数与友元类

    我们知道类的私有成员只能在类的成员函数内部访问,如果想在别处访问对象的私有成员,只能通过类提供的接口(成员函数)间接地进行.这固然能够带来数据隐藏的好处,利于将来程序的扩充,但也会增加程序书写的麻烦. ...

  8. 浅显易懂 Makefile 入门 (07)— 其它函数(foreach 、if、call、origin )

    1. foreach 函数 foreach 函数定义如下: $(foreach <var>,<list>,<text>) 函数的功能是:把参数 <list&g ...

  9. 浅显易懂 Makefile 入门 (06)— 文件名操作函数(dir、notdir、suffix、basename、addsuffix、addperfix、join、wildcard)

    编写 Makefile 的时候,很多情况下需要对文件名进行操作.例如获取文件的路径,去除文件的路径,取出文件前缀或后缀等等. 注意:下面的每个函数的参数字符串都会被当作或是一个系列的文件名来看待. 1 ...

最新文章

  1. 作为一个程序员。数学重要吗,下面python大牛告诉你
  2. 哈夫曼树--顺序结构(建立、编码、解码)
  3. PCB差分走线的阻抗控制技术(一)
  4. Go语言线程与协程之间的关系之GMP模型
  5. 【SpringBoot】编写一个自己的Starter
  6. Winform中使用FastReport的PictureObject时通过代码设置图片源并使Image图片旋转90度
  7. matlab 写excel 慢_我在12w+的Python库中,发现了让Excel快到起飞的秘密......
  8. java语言中的类可以_java 语言中的类
  9. Java里a和b哪个大_Java中 a+=b和a=a+b有什么区别?
  10. 智伴机器人广西团队_畅想科技 智绘未来——2020年全区乡村学校少年宫科技体验日活动在广西科技馆举办...
  11. mysql5.7 gtid问题_MySQL 5.7.5: 新语法WAIT_FOR_EXECUTED_GTID_SET 及存在的问题-阿里云开发者社区...
  12. java 反译md5加密_Java MD5加密与反编译
  13. 蛋白质组学数据分析在生物医学领域的应用
  14. 根2是无理数的几种证明方法
  15. 【python学习】python的面向对象编程
  16. http://www.2cto.com/ 红黑联盟
  17. 07过去进行时,过去将来时,陈述句 变宾语从句(that 引导)
  18. 俄勒冈州立大学计算机科学专业,俄勒冈州立大学电气工程与计算机科学专业介绍在这里哦!...
  19. 木兰当事人回应!承认部分基于 Python 二次开发
  20. centos7部署rap2

热门文章

  1. Temporal线上部署
  2. DFA算法的简单说明与案例实现以及优化思路
  3. 虚拟机快照,设置永久和非永久磁盘
  4. C++ TIM或者QQ 自动发送消息
  5. 魔百盒CM311-3_YS_晨星MSO9385芯片_安卓9.0_当贝桌面_卡刷固件包
  6. ios 探探编辑页图片拖动_nuxt+vue仿微信/探探界面|nuxt聊天实例
  7. mysql中如何授权所有用户_mysql用户以及用户授权
  8. 【敲级实用】:某小伙写了一个的办公脚本后~变精神了~
  9. am335 启动流程
  10. j2ee中常用的五种远程调用协议