diff --git a/chip-8-sdl/app.cpp b/chip-8-sdl/app.cpp index e04e1b9..6d83aba 100644 --- a/chip-8-sdl/app.cpp +++ b/chip-8-sdl/app.cpp @@ -5,6 +5,8 @@ #include "app.h" #include "icons/folder.h" +#include "icons/play.h" +#include "icons/warning.h" #include "widget/button.h" #include "widget/chip8_screen.h" #include "widget/label.h" @@ -12,12 +14,12 @@ static constexpr int font_point_size = 12; -static constexpr int scale_factor = 10; -static constexpr int panel_width = chip8::screen_width * scale_factor; -static constexpr int panel_height = (chip8::screen_height / 8) * scale_factor; -static constexpr int renderer_width = chip8::screen_width * scale_factor; -static constexpr int renderer_height = chip8::screen_height * scale_factor + panel_height; -static constexpr int chip8screen_y = panel_height; +static constexpr int SCALE_FACTOR = 10; +static constexpr int PANEL_WIDTH = chip8::SCREEN_WIDTH * SCALE_FACTOR; +static constexpr int PANEL_HEIGHT = (chip8::SCREEN_HEIGHT / 8) * SCALE_FACTOR; +static constexpr int RENDERER_WIDTH = chip8::SCREEN_WIDTH * SCALE_FACTOR; +static constexpr int RENDERER_HEIGHT = chip8::SCREEN_HEIGHT * SCALE_FACTOR + PANEL_HEIGHT; +static constexpr int CHIP8SCREEN_Y = PANEL_HEIGHT; app::app(config& conf, std::string const& rom_path, std::vector const& program) : m_emulator(program), @@ -28,8 +30,8 @@ app::app(config& conf, std::string const& rom_path, std::vector const& conf.window_width, conf.window_height, 0) , SDLCleaner())), m_quit(false), m_audio_enabled(false), - m_audio_device(0), - m_wav_buffer(nullptr) + m_wav_buffer(nullptr), + m_audio_device(0) { sdl_checksuccess(SDL_Init(init_flags), "Failed to initialize the SDL: %s\n"); sdl_checksuccess(TTF_Init(), "Failed to initialize SDL_ttf: %s\n"); @@ -39,8 +41,8 @@ app::app(config& conf, std::string const& rom_path, std::vector const& sdl_nullcheck(m_renderer.get(), "Failed to create the renderer: %s\n"); set_renderer_color(m_renderer, m_conf.bg_color); sdl_checksuccess(SDL_RenderClear(m_renderer.get()), "Failed to clear the renderer: %s\n"); - sdl_checksuccess(SDL_RenderSetLogicalSize(m_renderer.get(), renderer_width, renderer_height), - "Failed to set the renderer's logical scale: %s"); + // sdl_checksuccess(SDL_RenderSetLogicalSize(m_renderer.get(), RENDERER_WIDTH, RENDERER_HEIGHT), + // "Failed to set the renderer's logical scale: %s"); sdl_checksuccess(SDL_RenderSetIntegerScale(m_renderer.get(), SDL_TRUE), "Failed to set integer scaling on the renderer: %s"); if (conf.sound_file) @@ -69,14 +71,14 @@ app::app(config& conf, std::string const& rom_path, std::vector const& sdl_nullcheck(m_font.get(), fmt::format("Failed to open font file: {}", font_strpath).c_str()); } - panel_ptr p1 = std::make_shared(m_renderer, 0, 0, panel_width, panel_height, m_conf.fg_color, m_conf.bg_color); - button_ptr b1 = std::make_shared