Finished CPU instructions and created ui window.
This commit is contained in:
32
lib/ui.c
Normal file
32
lib/ui.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include <ui.h>
|
||||
#include <emu.h>
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_ttf.h>
|
||||
|
||||
SDL_Window *sdlWindow;
|
||||
SDL_Renderer *sdlRenderer;
|
||||
SDL_Texture *sdlTexture;
|
||||
SDL_Surface *screen;
|
||||
|
||||
void ui_init(){
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
printf("SDL INIT\n");
|
||||
TTF_Init();
|
||||
printf("TTF INIT\n");
|
||||
|
||||
SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, 0, &sdlWindow, &sdlRenderer);
|
||||
}
|
||||
|
||||
void ui_handle_events(){
|
||||
SDL_Event e;
|
||||
while(SDL_PollEvent(&e) > 0) {
|
||||
if(e.type == SDL_WINDOWEVENT && e.window.event == SDL_WINDOWEVENT_CLOSE) {
|
||||
emu_get_context()->die = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void delay(u32 ms) {
|
||||
SDL_Delay(ms);
|
||||
}
|
Reference in New Issue
Block a user