mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-05-13 11:11:22 +00:00
Update to latest aurora, SDL3
This commit is contained in:
parent
f53fd86d3e
commit
aa26577400
@ -32,7 +32,7 @@
|
|||||||
#include <aurora/event.h>
|
#include <aurora/event.h>
|
||||||
#include <aurora/main.h>
|
#include <aurora/main.h>
|
||||||
#include <dolphin/vi.h>
|
#include <dolphin/vi.h>
|
||||||
#include <SDL_messagebox.h>
|
#include <SDL3/SDL_messagebox.h>
|
||||||
|
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
|
|
||||||
@ -222,15 +222,15 @@ public:
|
|||||||
|
|
||||||
void onSdlEvent(const SDL_Event& event) noexcept {
|
void onSdlEvent(const SDL_Event& event) noexcept {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_KEYDOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
m_lAltHeld = event.key.keysym.sym == SDLK_LALT;
|
m_lAltHeld = event.key.key == SDLK_LALT;
|
||||||
// Toggle fullscreen on ALT+ENTER
|
// 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());
|
m_cvarCommons.m_fullscreen->fromBoolean(!m_cvarCommons.m_fullscreen->toBoolean());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_KEYUP:
|
case SDL_EVENT_KEY_UP:
|
||||||
if (m_lAltHeld && event.key.keysym.sym == SDLK_LALT) {
|
if (m_lAltHeld && event.key.key == SDLK_LALT) {
|
||||||
m_imGuiConsole.ToggleVisible();
|
m_imGuiConsole.ToggleVisible();
|
||||||
m_lAltHeld = false;
|
m_lAltHeld = false;
|
||||||
}
|
}
|
||||||
@ -583,6 +583,9 @@ int main(int argc, char** argv) {
|
|||||||
case AURORA_UNPAUSED:
|
case AURORA_UNPAUSED:
|
||||||
g_paused = false;
|
g_paused = false;
|
||||||
break;
|
break;
|
||||||
|
case AURORA_DISPLAY_SCALE_CHANGED:
|
||||||
|
g_app->onAppDisplayScaleChanged(event->windowSize.scale);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -597,8 +600,8 @@ int main(int argc, char** argv) {
|
|||||||
if (g_paused) {
|
if (g_paused) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
g_app->onAppIdle(1.f / 60.f /* TODO */);
|
|
||||||
aurora_begin_frame();
|
aurora_begin_frame();
|
||||||
|
g_app->onAppIdle(1.f / 60.f /* TODO */);
|
||||||
g_app->onAppDraw();
|
g_app->onAppDraw();
|
||||||
aurora_end_frame();
|
aurora_end_frame();
|
||||||
g_app->onAppPostDraw();
|
g_app->onAppPostDraw();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
#include "Runtime/IMain.hpp"
|
#include "Runtime/IMain.hpp"
|
||||||
#include <Runtime/CBasics.hpp>
|
#include <Runtime/CBasics.hpp>
|
||||||
#include <SDL_filesystem.h>
|
#include <SDL3/SDL_filesystem.h>
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "Runtime/CBasics.hpp"
|
#include "Runtime/CBasics.hpp"
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <logvisor/logvisor.hpp>
|
#include <logvisor/logvisor.hpp>
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
#include <nowide/convert.hpp>
|
#include <nowide/convert.hpp>
|
||||||
|
3
extern/CMakeLists.txt
vendored
3
extern/CMakeLists.txt
vendored
@ -42,6 +42,9 @@ endif ()
|
|||||||
#if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
#if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
# set(DAWN_ENABLE_VULKAN ON CACHE BOOL "Enable compilation of the Vulkan backend" FORCE)
|
# set(DAWN_ENABLE_VULKAN ON CACHE BOOL "Enable compilation of the Vulkan backend" FORCE)
|
||||||
#endif()
|
#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)
|
set(AURORA_NATIVE_MATRIX ON CACHE BOOL "Assume OpenGL-layout matrices, disables transposing" FORCE)
|
||||||
add_subdirectory(aurora)
|
add_subdirectory(aurora)
|
||||||
|
|
||||||
|
2
extern/aurora
vendored
2
extern/aurora
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 6f6861215150abc4fa00197de43754525cac07a6
|
Subproject commit ca3e4f5273d6af50634298fe73c2f4bcf1b75ac9
|
@ -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<half, access::sample> 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;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user