mirror of
https://github.com/yawut/SDL.git
synced 2026-06-16 13:39:35 -05:00
SDL2 for the Nintendo Wii U (build with "cmake [SDL source path] -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake -DCMAKE_INSTALL_PREFIX=$DEVKITPRO/portlibs/wiiu")
From Sythical:
Hello, I've created a simple SDL2 application which draws a texture on the screen. The problem I'm having is that if I launch another program which loads the UAC popup or if I lock my PC and then login again, the application stops drawing the texture. I tried adding SDL_Delay(10000) after SDL_RenderPresent(renderer). This made the texture stay on the screen for a little bit but the texture wasn't drawn again after the delay. Here's my code:
#include "SDL.h"
int main(int argc, char *argv[])
{
SDL_Renderer *renderer;
SDL_Window *window;
SDL_Surface *surface;
SDL_Texture *rect_texture;
SDL_Event main_event;
SDL_Rect rect_data;
int enable_vsync = 1;
if(SDL_Init(SDL_INIT_VIDEO) < 0) return 1;
window = SDL_CreateWindow("SDL2 Application", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 600, 600, SDL_WINDOW_RESIZABLE);
renderer = SDL_CreateRenderer(window, -1, enable_vsync ? SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC : SDL_RENDERER_ACCELERATED);
SDL_SetRenderDrawColor(renderer, 20, 20, 30, 255);
surface = SDL_LoadBMP("icon.bmp");
rect_texture = SDL_CreateTextureFromSurface(renderer, surface);
rect_data.w = 32; rect_data.h = 32;
rect_data.x = 300; rect_data.y = 300;
while(main_event.type != SDL_QUIT)
{
SDL_PollEvent(&main_event);
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, rect_texture, NULL, &rect_data);
SDL_RenderPresent(renderer);
}
SDL_DestroyTexture(rect_texture);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
|
||
|---|---|---|
| acinclude | ||
| android-project | ||
| build-scripts | ||
| cmake | ||
| debian | ||
| include | ||
| src | ||
| test | ||
| VisualC | ||
| Xcode | ||
| Xcode-iOS | ||
| .hgignore | ||
| .hgtags | ||
| Android.mk | ||
| autogen.sh | ||
| BUGS.txt | ||
| CMakeLists.txt | ||
| configure | ||
| configure.in | ||
| COPYING.txt | ||
| CREDITS.txt | ||
| INSTALL.txt | ||
| Makefile.in | ||
| Makefile.minimal | ||
| Makefile.pandora | ||
| Makefile.psp | ||
| Makefile.wiz | ||
| README-android.txt | ||
| README-cmake.txt | ||
| README-directfb.txt | ||
| README-gesture.txt | ||
| README-hg.txt | ||
| README-ios.txt | ||
| README-macosx.txt | ||
| README-pandora.txt | ||
| README-platforms.txt | ||
| README-porting.txt | ||
| README-psp.txt | ||
| README-SDL.txt | ||
| README-touch.txt | ||
| README-wince.txt | ||
| README.txt | ||
| sdl2-config.in | ||
| sdl2.m4 | ||
| sdl2.pc.in | ||
| SDL2.spec.in | ||
| TODO.txt | ||
| VisualC.html | ||
| WhatsNew.txt | ||
Simple DirectMedia Layer
(SDL)
Version 2.0
---
http://www.libsdl.org/
Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and DirectX. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games.
The current version supports Windows, Mac OS X, Linux, iOS, and Android.
The code contains support for other operating systems but those are not
officially supported.
SDL is written in C, but works with C++ natively, and has bindings to
several other languages, including C#, Python and more in progress.
This library is distributed under the zlib license, which can be found
in the file "COPYING.txt".
The best way to learn how to use SDL is to check out the header files in
the "include" subdirectory and the programs in the "test" subdirectory.
The header files and test programs are well commented and always up to date.
More documentation and FAQs are available online at:
http://wiki.libsdl.org/
If you need help with the library, or just want to discuss SDL related
issues, you can join the developers mailing list:
http://www.libsdl.org/mailing-list.php
Enjoy!
Sam Lantinga (slouken@libsdl.org)