diff --git a/Runtime/CMain.cpp b/Runtime/CMain.cpp index d4e7fa344..af2fca73b 100644 --- a/Runtime/CMain.cpp +++ b/Runtime/CMain.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include using namespace std::literals; @@ -222,15 +222,15 @@ public: void onSdlEvent(const SDL_Event& event) noexcept { switch (event.type) { - case SDL_KEYDOWN: - m_lAltHeld = event.key.keysym.sym == SDLK_LALT; + case SDL_EVENT_KEY_DOWN: + m_lAltHeld = event.key.key == SDLK_LALT; // Toggle fullscreen on ALT+ENTER - if (event.key.keysym.sym == SDLK_RETURN && (event.key.keysym.mod & KMOD_ALT) != 0u && event.key.repeat == 0u) { + if (event.key.key == SDLK_RETURN && (event.key.mod & SDL_KMOD_ALT) != 0u && event.key.repeat == 0u) { m_cvarCommons.m_fullscreen->fromBoolean(!m_cvarCommons.m_fullscreen->toBoolean()); } break; - case SDL_KEYUP: - if (m_lAltHeld && event.key.keysym.sym == SDLK_LALT) { + case SDL_EVENT_KEY_UP: + if (m_lAltHeld && event.key.key == SDLK_LALT) { m_imGuiConsole.ToggleVisible(); m_lAltHeld = false; } @@ -583,6 +583,9 @@ int main(int argc, char** argv) { case AURORA_UNPAUSED: g_paused = false; break; + case AURORA_DISPLAY_SCALE_CHANGED: + g_app->onAppDisplayScaleChanged(event->windowSize.scale); + break; default: break; } @@ -597,8 +600,8 @@ int main(int argc, char** argv) { if (g_paused) { continue; } - g_app->onAppIdle(1.f / 60.f /* TODO */); aurora_begin_frame(); + g_app->onAppIdle(1.f / 60.f /* TODO */); g_app->onAppDraw(); aurora_end_frame(); g_app->onAppPostDraw(); diff --git a/Runtime/CMemoryCardSysNix.cpp b/Runtime/CMemoryCardSysNix.cpp index bebc5db5f..517c79101 100644 --- a/Runtime/CMemoryCardSysNix.cpp +++ b/Runtime/CMemoryCardSysNix.cpp @@ -2,7 +2,7 @@ #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/IMain.hpp" #include -#include +#include namespace metaforce { diff --git a/Runtime/ConsoleVariables/FileStoreManager.cpp b/Runtime/ConsoleVariables/FileStoreManager.cpp index 722f0d0a5..d97acce98 100644 --- a/Runtime/ConsoleVariables/FileStoreManager.cpp +++ b/Runtime/ConsoleVariables/FileStoreManager.cpp @@ -2,7 +2,7 @@ #include "Runtime/CBasics.hpp" -#include +#include #include #if _WIN32 #include diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index f8515a468..690b2f623 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -42,6 +42,9 @@ endif () #if (CMAKE_SYSTEM_NAME STREQUAL Darwin) # set(DAWN_ENABLE_VULKAN ON CACHE BOOL "Enable compilation of the Vulkan backend" FORCE) #endif() +if (CMAKE_SYSTEM_NAME STREQUAL Linux) + set(DAWN_USE_WAYLAND ON CACHE BOOL "Enable support for Wayland surface" FORCE) +endif () set(AURORA_NATIVE_MATRIX ON CACHE BOOL "Assume OpenGL-layout matrices, disables transposing" FORCE) add_subdirectory(aurora) diff --git a/extern/aurora b/extern/aurora index 6f6861215..ca3e4f527 160000 --- a/extern/aurora +++ b/extern/aurora @@ -1 +1 @@ -Subproject commit 6f6861215150abc4fa00197de43754525cac07a6 +Subproject commit ca3e4f5273d6af50634298fe73c2f4bcf1b75ac9 diff --git a/imgui/ImGuiShader.shader b/imgui/ImGuiShader.shader deleted file mode 100644 index 480d081cb..000000000 --- a/imgui/ImGuiShader.shader +++ /dev/null @@ -1,134 +0,0 @@ -#shader ImGuiShader -#attribute position2 -#attribute uv2 -#attribute colorunorm -#srcfac srcalpha -#dstfac invsrcalpha -#primitive triangles -#depthtest none -#depthwrite false -#culling none - - -#vertex glsl -layout (location = 0) in vec2 pos; -layout (location = 1) in vec2 uv; -layout (location = 2) in vec4 color; -UBINDING0 uniform ImGuiShaderUniform -{ - mat4 xf; -}; -struct VertToFrag -{ - vec2 uv; - vec4 color; -}; - -SBINDING(0) out VertToFrag vtf; -void main() -{ - vtf.uv = uv; - vtf.color = color; - gl_Position = xf * vec4(pos.xy,0,1); -} - -#fragment glsl -struct VertToFrag -{ - vec2 uv; - vec4 color; -}; - -SBINDING(0) in VertToFrag vtf; -layout (location = 0) out vec4 colorOut; -TBINDING0 uniform sampler2D tex; -void main() -{ - colorOut = vtf.color * texture(tex, vtf.uv.st); -} - - -#vertex hlsl -cbuffer ImGuiShaderUniform : register(b0) -{ - float4x4 xf; -}; - -struct VertData -{ - float2 pos : POSITION; - float2 uv : TEXCOORD0; - float4 col : COLOR0; -}; - -struct VertToFrag -{ - float4 pos : SV_POSITION; - float2 uv : TEXCOORD0; - float4 col : COLOR0; -}; - -VertToFrag main(in VertData v) -{ - VertToFrag vtf; - vtf.pos = mul(xf, float4(v.pos.xy, 0.f, 1.f)); - vtf.col = v.col; - vtf.uv = v.uv; - return vtf; -} - -#fragment hlsl -struct VertToFrag -{ - float4 pos : SV_POSITION; - float2 uv : TEXCOORD0; - float4 col : COLOR0; -}; -SamplerState samp : register(s0); -Texture2D tex0 : register(t0); - -float4 main(in VertToFrag vtf) : SV_Target0 -{ - return vtf.col * tex0.Sample(samp, vtf.uv); -} - - -#vertex metal -struct ImGuiShaderUniform { - float4x4 xf; -}; - -struct VertexIn { - float2 position [[attribute(0)]]; - float2 texCoords [[attribute(1)]]; - uchar4 color [[attribute(2)]]; -}; - -struct VertToFrag { - float4 position [[position]]; - float2 texCoords; - float4 color; -}; - -vertex VertToFrag vmain(VertexIn v [[stage_in]], - constant ImGuiShaderUniform& u [[buffer(2)]]) { - VertToFrag vtf; - vtf.position = u.xf * float4(v.position, 0, 1); - vtf.texCoords = v.texCoords; - vtf.color = float4(v.color) / float4(255.0); - return vtf; -} - -#fragment metal -struct VertToFrag { - float4 position [[position]]; - float2 texCoords; - float4 color; -}; - -fragment half4 fmain(VertToFrag vtf [[stage_in]], - texture2d tex [[texture(0)]]) { - constexpr sampler linearSampler(coord::normalized, min_filter::linear, mag_filter::linear, mip_filter::linear); - half4 texColor = tex.sample(linearSampler, vtf.texCoords); - return half4(vtf.color) * texColor; -}