mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
Migrating from SFML to SDL2 && switching Boost to a submodule
This commit is contained in:
parent
4395013118
commit
cdac2526a7
3321 changed files with 38 additions and 725135 deletions
|
@ -2,13 +2,12 @@
|
|||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "cpu.hpp"
|
||||
#include "memory.hpp"
|
||||
#include "opengl.hpp"
|
||||
#include "PICA/gpu.hpp"
|
||||
#include "SFML/Window.hpp"
|
||||
#include "SFML/Graphics.hpp"
|
||||
|
||||
enum class ROMType {
|
||||
None, ELF, Cart
|
||||
|
@ -20,19 +19,29 @@ class Emulator {
|
|||
Memory memory;
|
||||
Kernel kernel;
|
||||
|
||||
sf::RenderWindow window;
|
||||
SDL_Window* window;
|
||||
SDL_GLContext glContext;
|
||||
|
||||
static constexpr u32 width = 400;
|
||||
static constexpr u32 height = 240 * 2; // * 2 because 2 screens
|
||||
ROMType romType = ROMType::None;
|
||||
bool running = true;
|
||||
|
||||
// Keep the handle for the ROM here to reload when necessary and to prevent deleting it
|
||||
std::ifstream loadedROM;
|
||||
|
||||
public:
|
||||
Emulator() : window(sf::VideoMode(width, height), "Alber", sf::Style::Default, sf::ContextSettings(0, 0, 0, 4, 3)),
|
||||
kernel(cpu, memory, gpu), cpu(memory, kernel), gpu(memory), memory(cpu.getTicksRef()) {
|
||||
Emulator() : kernel(cpu, memory, gpu), cpu(memory, kernel), gpu(memory), memory(cpu.getTicksRef()) {
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
Helpers::panic("Failed to initialize SDL2");
|
||||
}
|
||||
|
||||
// Request OpenGL 4.1 (Max available on MacOS)
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
||||
window = SDL_CreateWindow("Alber", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL);
|
||||
glContext = SDL_GL_CreateContext(window);
|
||||
reset();
|
||||
window.setActive(true);
|
||||
}
|
||||
|
||||
void step();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue