SDL2 FillRect with SDL_Window issues
SDL2 FillRect with SDL_Window issues
我尝试使用SDL_FillRect与SDL 2.0
下面是我的代码:
bool running = true;
//Initialise SDL
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Window *screen = SDL_CreateWindow("Test Game",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640, 480,
SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_OPENGL);
while (running){
SDL_FillRect(screen, NULL, 0);
}
//Quit SDL
SDL_Quit();
return 0;
得到的错误是:
1>c:usersethandesktopc++ projectsanother test with sdlanother测试与sdlmain.cpp(16):错误C2664: 'int SDL_FillRect(SDL_Surface . int)*,const SDL_Rect *,Uint32)':无法将参数1从'SDL_Window *'转换为'SDL_Surface *'
1比;指向的类型有不相关的;转换需要reinterpret_cast、c风格强制转换或function-style铸
在SDL2中,您应该创建SDL_Renderer
并使用SDL_RenderClear
。
如果你真的想使用SDL_FillRect
,那么你可以在单独的SDL_Surface
上调用它,然后在2步中将该表面渲染到你的窗口上。SDL2迁移指南谈到了这些东西:https://wiki.libsdl.org/MigrationGuide
SDL_RenderPresent
是需要的,以便您的纹理呈现在您的渲染
相关文章:
- Issues with Win32 ReadProcessMemory API
- Zooming Issues with glutMouseWheelFunc
- WebKit2GTK+ "window-object-cleared"未清除
- MFC GetDC() 断言失败 - "Not a window"
- OpenCV : 为什么"Gray window"总是生成?
- QMediaPlayer 無法在 Window 上播放歌曲
- window.display() 单独在显示的最后一个缓冲区和当前缓冲区之间切换
- opencv cv::addText exception if no window
- Cygwin pkg-config/protobuf filepath issues
- 我如何使用 GTK3 在 C 中调用另一个"window"
- Winapi Window窗口异常破坏多个作品
- SFML std::length_error on window.setTitle
- 请参阅Watch-Window中的原始类型定义
- 如果使用WM_PAINT样式创建 Window,则永远不会传递WS_POPUP消息
- Qt在单击按钮时调用Child-Window
- 在Visual Studio中使用Window Media Player
- Visual Studio 2015 Community - Immediate Window
- Window.h c ++如何从开关内的数组中获取按钮的索引
- 在没有 UWP 的情况下从 C++/WinRT 使用 FileOpenPicker 时出现视觉"Invalid window handle"错误
- 这是从VS window c ++项目迁移到linux项目的最有效方法