Merge commit 'a4a00c99d05441f5db491e06186039f817cb5c81'
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
@ -34,7 +34,7 @@ void setClipboardText(Context &ctx, ox::StringViewCR text) noexcept;
|
||||
|
||||
void setClipboardObject(Context &ctx, ox::UPtr<BaseClipboardObject> &&obj) noexcept;
|
||||
|
||||
ox::Result<BaseClipboardObject*> getClipboardData(Context &ctx, ox::StringView typeId) noexcept;
|
||||
ox::Result<BaseClipboardObject*> getClipboardData(Context &ctx, ox::StringViewCR typeId) noexcept;
|
||||
|
||||
template<typename T>
|
||||
ox::Result<T*> getClipboardObject(Context &ctx) noexcept {
|
||||
|
@ -6,13 +6,9 @@
|
||||
|
||||
#include <ox/fs/fs.hpp>
|
||||
#include <ox/model/desctypes.hpp>
|
||||
#include <ox/std/buffer.hpp>
|
||||
#include <ox/std/size.hpp>
|
||||
|
||||
#include <keel/context.hpp>
|
||||
|
||||
#include "input.hpp"
|
||||
|
||||
namespace turbine {
|
||||
|
||||
class Context;
|
||||
@ -47,10 +43,5 @@ T *applicationData(Context &ctx) noexcept {
|
||||
return applicationDataRaw(ctx).get<T>();
|
||||
}
|
||||
|
||||
void setKeyEventHandler(Context &ctx, KeyEventHandler h) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
KeyEventHandler keyEventHandler(Context &ctx) noexcept;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace turbine {
|
||||
|
||||
class Context;
|
||||
|
||||
using UpdateHandler = int(*)(Context&);
|
||||
|
||||
// Sets event handler that sleeps for the time given in the return value. The
|
||||
// sleep time is a minimum of ~16 milliseconds.
|
||||
void setUpdateHandler(Context &ctx, UpdateHandler) noexcept;
|
||||
|
||||
}
|
@ -21,11 +21,9 @@ class Drawer {
|
||||
virtual void draw(Context&) noexcept = 0;
|
||||
};
|
||||
void addDrawer(Context &ctx, Drawer *cd) noexcept;
|
||||
void removeDrawer(Context &ctx, Drawer *cd) noexcept;
|
||||
void removeDrawer(Context &ctx, Drawer const *cd) noexcept;
|
||||
}
|
||||
|
||||
ox::Error initGfx(Context &ctx) noexcept;
|
||||
|
||||
ox::Error setWindowIcon(Context &ctx, ox::SpanView<ox::SpanView<uint8_t>> const &iconPngs) noexcept;
|
||||
|
||||
void setWindowTitle(Context &ctx, ox::StringViewCR title) noexcept;
|
||||
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/std/defines.hpp>
|
||||
|
||||
namespace turbine {
|
||||
|
||||
enum Key {
|
||||
// GBA implementation currently relies on GamePad entry order
|
||||
GamePad_A = 0,
|
||||
GamePad_B,
|
||||
GamePad_Select,
|
||||
GamePad_Start,
|
||||
GamePad_Right,
|
||||
GamePad_Left,
|
||||
GamePad_Up,
|
||||
GamePad_Down,
|
||||
GamePad_R,
|
||||
GamePad_L,
|
||||
|
||||
Num_0,
|
||||
Num_1,
|
||||
Num_2,
|
||||
Num_3,
|
||||
Num_4,
|
||||
Num_5,
|
||||
Num_6,
|
||||
Num_7,
|
||||
Num_8,
|
||||
Num_9,
|
||||
|
||||
Alpha_A,
|
||||
Alpha_B,
|
||||
Alpha_C,
|
||||
Alpha_D,
|
||||
Alpha_E,
|
||||
Alpha_F,
|
||||
Alpha_G,
|
||||
Alpha_H,
|
||||
Alpha_I,
|
||||
Alpha_J,
|
||||
Alpha_K,
|
||||
Alpha_L,
|
||||
Alpha_M,
|
||||
Alpha_N,
|
||||
Alpha_O,
|
||||
Alpha_P,
|
||||
Alpha_Q,
|
||||
Alpha_R,
|
||||
Alpha_S,
|
||||
Alpha_T,
|
||||
Alpha_U,
|
||||
Alpha_V,
|
||||
Alpha_W,
|
||||
Alpha_X,
|
||||
Alpha_Y,
|
||||
Alpha_Z,
|
||||
|
||||
Mod_Alt,
|
||||
Mod_Ctrl,
|
||||
Mod_Super,
|
||||
Mod_Shift,
|
||||
|
||||
Escape,
|
||||
|
||||
End
|
||||
};
|
||||
|
||||
class Context;
|
||||
|
||||
[[nodiscard]]
|
||||
bool buttonDown(Context const&ctx, Key) noexcept;
|
||||
|
||||
using KeyEventHandler = void(*)(Context&, Key, bool);
|
||||
|
||||
}
|
@ -8,13 +8,85 @@
|
||||
#include <ox/fs/fs.hpp>
|
||||
|
||||
#include "clipboard.hpp"
|
||||
#include "event.hpp"
|
||||
#include "gfx.hpp"
|
||||
#include "input.hpp"
|
||||
|
||||
namespace turbine {
|
||||
|
||||
class Context;
|
||||
|
||||
using TimeMs = uint64_t;
|
||||
using UpdateHandler = int(*)(Context&);
|
||||
|
||||
enum Key {
|
||||
// GBA implementation currently relies on GamePad entry order
|
||||
GamePad_A = 0,
|
||||
GamePad_B,
|
||||
GamePad_Select,
|
||||
GamePad_Start,
|
||||
GamePad_Right,
|
||||
GamePad_Left,
|
||||
GamePad_Up,
|
||||
GamePad_Down,
|
||||
GamePad_R,
|
||||
GamePad_L,
|
||||
|
||||
Num_0,
|
||||
Num_1,
|
||||
Num_2,
|
||||
Num_3,
|
||||
Num_4,
|
||||
Num_5,
|
||||
Num_6,
|
||||
Num_7,
|
||||
Num_8,
|
||||
Num_9,
|
||||
|
||||
Alpha_A,
|
||||
Alpha_B,
|
||||
Alpha_C,
|
||||
Alpha_D,
|
||||
Alpha_E,
|
||||
Alpha_F,
|
||||
Alpha_G,
|
||||
Alpha_H,
|
||||
Alpha_I,
|
||||
Alpha_J,
|
||||
Alpha_K,
|
||||
Alpha_L,
|
||||
Alpha_M,
|
||||
Alpha_N,
|
||||
Alpha_O,
|
||||
Alpha_P,
|
||||
Alpha_Q,
|
||||
Alpha_R,
|
||||
Alpha_S,
|
||||
Alpha_T,
|
||||
Alpha_U,
|
||||
Alpha_V,
|
||||
Alpha_W,
|
||||
Alpha_X,
|
||||
Alpha_Y,
|
||||
Alpha_Z,
|
||||
|
||||
Mod_Alt,
|
||||
Mod_Ctrl,
|
||||
Mod_Super,
|
||||
Mod_Shift,
|
||||
|
||||
Escape,
|
||||
|
||||
End
|
||||
};
|
||||
|
||||
using KeyEventHandler = void(*)(Context&, Key, bool);
|
||||
|
||||
void setKeyEventHandler(Context &ctx, KeyEventHandler h) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
KeyEventHandler keyEventHandler(Context &ctx) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
bool buttonDown(Context const&ctx, Key) noexcept;
|
||||
|
||||
ox::Result<ox::UPtr<Context>> init(ox::UPtr<ox::FileSystem> &&fs, ox::StringViewCR appName) noexcept;
|
||||
|
||||
@ -33,4 +105,8 @@ using ShutdownHandler = bool (*)(Context&);
|
||||
|
||||
void setShutdownHandler(Context &ctx, ShutdownHandler handler) noexcept;
|
||||
|
||||
// Sets event handler that sleeps for the time given in the return value. The
|
||||
// sleep time is a minimum of ~16 milliseconds.
|
||||
void setUpdateHandler(Context &ctx, UpdateHandler) noexcept;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user