Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,2 @@ | ||
# Xcode | ||
a.out | ||
.DS_Store | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
*.xcworkspace | ||
!default.xcworkspace | ||
xcuserdata | ||
profile | ||
*.moved-aside | ||
DerivedData | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
g++ -framework SDL2 src/test.cpp | ||
./a.out | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include <SDL2/SDL.h> | ||
#include <iostream> | ||
|
||
const int WINDOW_WIDTH = 640; | ||
const int WINDOW_HEIGHT = 480; | ||
|
||
int main( int argc, char* args[] ) | ||
{ | ||
|
||
std::cout << "Testing SDL2..." << std::endl; | ||
|
||
SDL_Window * window = NULL; | ||
SDL_Surface * screenSurface = NULL; | ||
|
||
if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { | ||
std::cerr << "SDL init fail. SDL_Error : " << SDL_GetError() << std::endl; | ||
SDL_Quit(); | ||
return 1; | ||
} | ||
|
||
window = SDL_CreateWindow( "INCREMENTALIST step 1", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN ); | ||
|
||
if( window == NULL ) { | ||
std::cerr << "SDL CreateWindow fail. SDL_Error : " << SDL_GetError() << std::endl; | ||
SDL_Quit(); | ||
return 1; | ||
} | ||
|
||
screenSurface = SDL_GetWindowSurface( window ); | ||
|
||
//Fill the surface with color | ||
SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0xFF, 0xFF ) ); | ||
SDL_UpdateWindowSurface( window ); | ||
|
||
SDL_Delay( 2000 ); | ||
|
||
SDL_DestroyWindow( window ); | ||
SDL_Quit(); | ||
|
||
std::cout << "...Done testing SDL2." << std::endl; | ||
|
||
return 0; | ||
} |