Ready. Set. Go!

This commit is contained in:
hippoz 2022-05-01 20:11:44 +03:00
commit 2e513649e0
Signed by: hippoz
GPG key ID: 7C52899193467641
3 changed files with 60 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
builddir/
buildclang/
.cache/
compile_commands.json

9
meson.build Normal file
View file

@ -0,0 +1,9 @@
project('rotcpu', 'cpp')
sdl2_dep = dependency('sdl2')
executable(
'rotcpuemu',
'./src/main.cpp',
dependencies : [sdl2_dep]
)

47
src/main.cpp Normal file
View file

@ -0,0 +1,47 @@
#include "SDL.h"
void scc(int code)
{
if (code < 0) {
fprintf(stderr, "SDL ERROR: %s\n", SDL_GetError());
exit(1);
}
}
void *scp(void *ptr)
{
if (ptr == NULL) {
fprintf(stderr, "SDL ERROR: %s\n", SDL_GetError());
exit(1);
}
return ptr;
}
int main(int argc, char *argv[])
{
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Surface *surface;
SDL_Event event;
scc(SDL_Init(SDL_INIT_VIDEO));
scc(SDL_CreateWindowAndRenderer(320, 240, SDL_WINDOW_RESIZABLE, &window, &renderer));
while (1) {
SDL_PollEvent(&event);
if (event.type == SDL_QUIT) {
break;
}
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);
}
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}