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
1 parent
6f2993b
commit 8c2078b
Showing
3 changed files
with
26 additions
and
1 deletion.
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,3 +1,3 @@ | ||
To build and run any of the samples: | ||
|
||
kitc -s samples SAMPLE_NAME --run | ||
kitc --run path/to/sample |
File renamed without changes.
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,25 @@ | ||
include "SDL2/SDL.h" => "SDL2"; | ||
include "stdio.h"; | ||
|
||
function main() { | ||
var window: Ptr[SDL_Window] = null; | ||
var screenSurface: Ptr[SDL_Surface] = null; | ||
if SDL_Init(SDL_INIT_VIDEO) < 0 { | ||
panic("could not initialize sdl2: %s\n", SDL_GetError()); | ||
} | ||
window = SDL_CreateWindow( | ||
"Hello from Kit and SDL2", | ||
${SDL_WINDOWPOS_UNDEFINED: Int}, ${SDL_WINDOWPOS_UNDEFINED: Int}, | ||
640, 480, | ||
SDL_WINDOW_SHOWN as Uint | ||
); | ||
if window == null { | ||
panic("could not create window: %s\n", SDL_GetError()); | ||
} | ||
screenSurface = SDL_GetWindowSurface(window); | ||
SDL_FillRect(screenSurface, null, SDL_MapRGB(screenSurface.format, 0x80, 0xff, 0xe6)); | ||
SDL_UpdateWindowSurface(window); | ||
SDL_Delay(2000); | ||
SDL_DestroyWindow(window); | ||
SDL_Quit(); | ||
} |