SDL_CreateWindow函数
发布日期:2021-07-01 05:03:25
浏览次数:2
分类:技术文章
本文共 1866 字,大约阅读时间需要 6 分钟。
SDL_CreateWindow函数:
用此函数在指定的位置,指定窗口大小,以及相应标志来创建窗口。
定义:
SDL_Window* SDL_CreateWindow(const char* title, int x, int y, int w, int h, Uint32 flags)函数参数:
title | the title of the window, in UTF-8 encoding |
x | the x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED |
y | the y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED |
w | the width of the window, in screen coordinates |
h | the height of the window, in screen coordinates |
flags | 0, or one or more OR'd together; see for details |
例子:
#include "SDL.h"#include蔡军生int main(int argc, char* argv[]) { SDL_Window *window; // Declare a pointer SDL_Init(SDL_INIT_VIDEO); // Initialize SDL2 // Create an application window with the following settings: window = SDL_CreateWindow( "An SDL2 window", // window title SDL_WINDOWPOS_UNDEFINED, // initial x position SDL_WINDOWPOS_UNDEFINED, // initial y position 640, // width, in pixels 480, // height, in pixels SDL_WINDOW_OPENGL // flags - see below ); // Check that the window was successfully created if (window == NULL) { // In the case that the window could not be made... printf("Could not create window: %s\n", SDL_GetError()); return 1; } // The window is open: could enter program loop here (see SDL_PollEvent()) SDL_Delay(3000); // Pause execution for 3000 milliseconds, for example // Close and destroy the window SDL_DestroyWindow(window); // Clean up SDL_Quit(); return 0;}
跟老菜鸟学C++
转载地址:https://mysoft.blog.csdn.net/article/details/53642314 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
做的很好,不错不错
[***.243.131.199]2024年04月18日 16时42分08秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
浅谈Q的基本实现
2019-05-03
阿里云短信服务(JAVA)
2019-05-03
GCD使用 串行并行队列 与 同步异步执行的各种组合 及要点分析
2019-05-03
深入研究 Runloop 与线程保活
2019-05-03
iOS 版本更新(强制更新)检测问题
2019-05-03
Struts2(1)简介
2019-05-03
XSS漏洞解析(一)
2019-05-03
Springboot使用详解
2019-05-03
leetcode算法 111. 二叉树的最小深度
2019-05-03
李洪强iOS开发之-cocopods安装
2019-05-03
实现string toHex(int)把一个十进制转换成十六进制。(完全用算法实现)
2019-05-04
覃仙球- 时装品牌Chilly Chin创始人 | 到「在行」来约见我
2019-05-04
struts2.5.10.1
2019-05-04
活动反作弊服务_防羊毛党_防作弊评论_防刷单_防作弊投票_网易易盾
2019-05-04
浅谈web指纹识别技术 - FreeBuf.COM | 关注黑客与极客
2019-05-04
技术漫谈 | 使用docker-compose进行python开发 - 推酷
2019-05-04
我眼中的领域驱动设计 - richiezhang - 博客园
2019-05-04
新风系统可取代空调吗? - 知乎
2019-05-04