mirror of
https://github.com/pound-emu/pound.git
synced 2025-12-12 10:37:00 +00:00
commit
bc80f289a8
7 changed files with 3945 additions and 8 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -424,3 +424,6 @@ third_party/cmake_install.cmake
|
||||||
CMakeFiles
|
CMakeFiles
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
|
.ninja_log
|
||||||
|
.ninja_deps
|
||||||
|
3rd_Party/rem
|
||||||
|
|
|
||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -10,3 +10,6 @@
|
||||||
[submodule "3rd_Party/SDL3"]
|
[submodule "3rd_Party/SDL3"]
|
||||||
path = 3rd_Party/SDL3
|
path = 3rd_Party/SDL3
|
||||||
url = https://github.com/libsdl-org/SDL.git
|
url = https://github.com/libsdl-org/SDL.git
|
||||||
|
[submodule "3rd_Party/imgui"]
|
||||||
|
path = 3rd_Party/imgui
|
||||||
|
url = https://github.com/ocornut/imgui.git
|
||||||
|
|
|
||||||
1
3rd_Party/imgui
vendored
Submodule
1
3rd_Party/imgui
vendored
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 0dc2885f3e0890585a0fa61a1ea041df9609b0ab
|
||||||
|
|
@ -6,6 +6,7 @@ set(CMAKE_C_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED TRUE)
|
set(CMAKE_C_STANDARD_REQUIRED TRUE)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||||
|
set(IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rd_Party/imgui)
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE)
|
if (NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE Release)
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
|
@ -47,3 +48,26 @@ if (WIN32)
|
||||||
|
|
||||||
target_sources(Pound PRIVATE core/Pound.rc)
|
target_sources(Pound PRIVATE core/Pound.rc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# ImGui
|
||||||
|
set(IMGUI_SRC
|
||||||
|
${IMGUI_DIR}/imgui.cpp
|
||||||
|
${IMGUI_DIR}/imgui_demo.cpp
|
||||||
|
${IMGUI_DIR}/imgui_draw.cpp
|
||||||
|
${IMGUI_DIR}/imgui_tables.cpp
|
||||||
|
${IMGUI_DIR}/imgui_widgets.cpp
|
||||||
|
${IMGUI_DIR}/backends/imgui_impl_sdl3.cpp
|
||||||
|
${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_sources(Pound PRIVATE ${IMGUI_SRC})
|
||||||
|
|
||||||
|
target_include_directories(Pound PRIVATE
|
||||||
|
${IMGUI_DIR}
|
||||||
|
${IMGUI_DIR}/backends
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
target_link_libraries(Pound PRIVATE OpenGL::GL)
|
||||||
|
|
||||||
|
|
|
||||||
BIN
Pound
Executable file
BIN
Pound
Executable file
Binary file not shown.
3858
build.ninja
Normal file
3858
build.ninja
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,16 +1,20 @@
|
||||||
// Copyright 2025 Pound Emulator Project. All rights reserved.
|
// Copyright 2025 Pound Emulator Project. All rights reserved.
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <imgui.h>
|
||||||
|
#include <imgui_impl_sdl3.h>
|
||||||
|
#include <imgui_impl_opengl3.h>
|
||||||
|
|
||||||
#include "Base/Logging/Backend.h"
|
#include "Base/Logging/Backend.h"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
#include <SDL3/SDL_opengl.h>
|
||||||
|
|
||||||
#include "ARM/cpu.h"
|
#include "ARM/cpu.h"
|
||||||
#include "Base/Config.h"
|
#include "Base/Config.h"
|
||||||
#include "JIT/jit.h"
|
#include "JIT/jit.h"
|
||||||
|
|
||||||
SDL_Window *Window{};
|
SDL_Window* Window{};
|
||||||
|
SDL_GLContext gl_context{};
|
||||||
SDL_Event windowEvent;
|
SDL_Event windowEvent;
|
||||||
|
|
||||||
void initSDL3() {
|
void initSDL3() {
|
||||||
|
|
@ -33,6 +37,29 @@ void initSDL3() {
|
||||||
SDL_DestroyProperties(props);
|
SDL_DestroyProperties(props);
|
||||||
|
|
||||||
SDL_SetWindowMinimumSize(Window, 640, 480);
|
SDL_SetWindowMinimumSize(Window, 640, 480);
|
||||||
|
|
||||||
|
gl_context = SDL_GL_CreateContext(Window);
|
||||||
|
if (!gl_context) {
|
||||||
|
LOG_ERROR(Render, "Failed to create OpenGL context: {}", SDL_GetError());
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_GL_MakeCurrent(Window, gl_context);
|
||||||
|
SDL_GL_SetSwapInterval(1);
|
||||||
|
|
||||||
|
ImGui::CreateContext();
|
||||||
|
ImGui::StyleColorsDark();
|
||||||
|
ImGui_ImplSDL3_InitForOpenGL(Window, gl_context);
|
||||||
|
ImGui_ImplOpenGL3_Init("#version 330");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void deinitializeSDL3() {
|
||||||
|
ImGui_ImplOpenGL3_Shutdown();
|
||||||
|
ImGui_ImplSDL3_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
|
||||||
|
SDL_DestroyWindow(Window);
|
||||||
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
@ -66,20 +93,41 @@ int main() {
|
||||||
bool rendering = true;
|
bool rendering = true;
|
||||||
|
|
||||||
while (rendering) {
|
while (rendering) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
|
||||||
// Process events.
|
// Process events.
|
||||||
while (SDL_PollEvent(&windowEvent)) {
|
while (SDL_PollEvent(&windowEvent)) {
|
||||||
|
ImGui_ImplSDL3_ProcessEvent(&windowEvent);
|
||||||
|
|
||||||
switch (windowEvent.type) {
|
switch (windowEvent.type) {
|
||||||
case SDL_EVENT_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
SDL_DestroyWindow(Window);
|
|
||||||
SDL_Quit();
|
|
||||||
rendering = false;
|
rendering = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
|
ImGui_ImplSDL3_NewFrame();
|
||||||
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
ImGui::Begin("Demo");
|
||||||
|
ImGui::Text("Hello, Pound Emulator!");
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
ImGui::Render();
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
|
||||||
|
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
|
SDL_GL_SwapWindow(Window);
|
||||||
|
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deinitializeSDL3();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue