|
| |||||||||
| Tags: executable file, sdl |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| SDL window does not open
I am trying to learn the use of SDL in C++ : Code: # include <stdlib.h>
# include <stdio.h>
# include <SDL/SDL.h>
void pause ();
int main (int argc, char * argv [])
(
SDL_Init (SDL_INIT_VIDEO) / / Initialize SDL
SDL_SetVideoMode (640, 480, 32, SDL_HWSURFACE) / / open the window
pause () / / Pause program
SDL_Quit () / / stop the SDL
return EXIT_SUCCESS; / / Closing Program
)
void pause ()
(
int continue = 1;
SDL_Event event;
while (continue)
(
SDL_WaitEvent (& event);
switch (event. type)
(
SDL_QUIT box:
continue = 0;
)
)
) |
|
#2
| ||||
| ||||
| Re: SDL window does not open
Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.To use SDL You need to add the include file SDL/SDL.h to the top of your program like this:#include <SDL/SDL.h>. Code: SDL_INIT_TIMER SDL_INIT_AUDIO SDL_INIT_VIDEO SDL_INIT_CDROM SDL_INIT_JOYSTICK SDL_INIT_NOPARACHUTE SDL_INIT_EVENTTHREAD SDL_INIT_EVERYTHING |
|
#3
| |||
| |||
| Re: SDL window does not open
First declare an area: Code: SDL_Surface * screen = NULL; Then replace your line: Code: SDL_SetVideoMode (640, 480, 32, SDL_HWSURFACE); Code: Wallpapers SDL_SetVideoMode = (640, 480, 32, SDL_HWSURFACE); |
|
#4
| |||
| |||
| Re: SDL window does not open
setting up SDL for keyboard input : Code: SDL_Surface *screen;
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}
atexit(SDL_Quit);
screen = SDL_SetVideoMode(320, 240, 0, SDL_ANYFORMAT);
if (screen == NULL) {
printf("Unable to set video mode: %s\n", SDL_GetError());
return 1;
} |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "SDL window does not open" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can't open new window or tab in IE8 32 bit? | GaryG | Windows x64 Edition | 12 | 19-07-2011 08:59 AM |
| To open a link from Google, I have to open in a new tab or window | Bindaas-ER | Technology & Internet | 3 | 07-03-2011 04:02 AM |
| Folders open in new window despite selecting the option of open in same window | Hahtalekin | Operating Systems | 4 | 24-01-2011 11:05 AM |
| How to set IE 7.0 to always open in new window | SmirnOFF | Tips & Tweaks | 2 | 06-06-2009 05:19 PM |
| Vista how to Open in new window? | christheart | Operating Systems | 3 | 02-06-2009 02:02 PM |