-
Notifications
You must be signed in to change notification settings - Fork 1
/
sdl.c
53 lines (35 loc) · 1.23 KB
/
sdl.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "SDL2/SDL.h" //I think this is sdl right here
//~ #include "src/include/npth.h" //these are for the threading stuff right here
int main()
{
//~ pth_init(); //this is to initialize the npth threads
//Constants for the screen height and width
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
//The window we'll be rendering to
SDL_Window* window = NULL; //The surface contained by the window
SDL_Surface* screenSurface = NULL; //Initialize SDL
if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{ printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() ); }
else
{
//Create window
window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
if( window == NULL ) { printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() ); }
}
while(1)
{
sleep(3); // make sure to give more stuff to the cpux
};
//Destroy window
SDL_DestroyWindow( window );
//just an infinite loop
//Quit SDL subsystems
SDL_Quit();
//~ pth_kill(); //stop ntph threads
return 0; //this is good
}