Working on apu

This commit is contained in:
2025-02-17 21:22:13 -07:00
parent 4823aeae93
commit 020feb2a6f
7 changed files with 100 additions and 31 deletions

View File

@ -4,6 +4,7 @@
#include <gamepad.h>
#include <bus.h>
#include <audio.h>
#include <string.h>
#include <SDL.h>
#include <SDL_ttf.h>
@ -131,7 +132,11 @@ void ui_update() {
SDL_UpdateTexture(sdlTexture, NULL, screen->pixels, screen->pitch);
SDL_RenderClear(sdlRenderer);
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL);
TTF_Font* sans = TTF_OpenFont("Sans.ttf", 24);
char buffer[1024];
strcpy(buffer, emu_get_context()->app_path);
*strrchr(buffer, '\\') = 0;
strcat(buffer,"/Sans.ttf");
TTF_Font* sans = TTF_OpenFont(buffer, 24);
if ( !sans ) {
printf("Failed to load font: %s\n", TTF_GetError());
}
@ -289,6 +294,19 @@ void ui_on_key(bool down, u32 key_code) {
}
printf("target frame time: %d\n", ppu_get_context()->target_frame_time);
}
if(ppu_get_context()->paused) {
if(key_code == SDLK_PERIOD && down == true){
ppu_get_context()->frame = true;
}
}
if(key_code == SDLK_p && down == true) {
ppu_get_context()->paused = !ppu_get_context()->paused;
if(ppu_get_context()->paused) {
printf("Paused Emulation\n");
} else {
printf("Resumed Emulation\n");
}
}
switch(key_code){
case SDLK_z: gamepad_get_state()->b = down; break;
case SDLK_x: gamepad_get_state()->a = down; break;