mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[ion/simulator] Add a Window namespace
This commit is contained in:
@@ -21,12 +21,12 @@ ion_src += $(addprefix ion/src/simulator/shared/, \
|
||||
keyboard_dummy.cpp:+headless \
|
||||
keyboard_sdl.cpp:-headless \
|
||||
layout.cpp:-headless \
|
||||
main_headless.cpp:+headless \
|
||||
main_sdl.cpp:-headless \
|
||||
power.cpp \
|
||||
random.cpp \
|
||||
timing.cpp \
|
||||
timing_msleep.cpp:-headless \
|
||||
window_headless.cpp:+headless \
|
||||
window_sdl.cpp:-headless \
|
||||
)
|
||||
|
||||
ion_simulator_assets = background.jpg horizontal_arrow.png vertical_arrow.png round.png small_squircle.png large_squircle.png
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "main.h"
|
||||
#include "platform.h"
|
||||
#include "layout.h"
|
||||
#include "events.h"
|
||||
#include "window.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ion/events.h>
|
||||
@@ -183,7 +183,7 @@ Event getPlatformEvent() {
|
||||
while (SDL_PollEvent(&event)) {
|
||||
// The while is important: it'll do a fast-pass over all useless SDL events
|
||||
if (event.type == SDL_WINDOWEVENT) {
|
||||
Ion::Simulator::Main::relayout();
|
||||
Ion::Simulator::Window::relayout();
|
||||
break;
|
||||
}
|
||||
if (event.type == SDL_QUIT) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include "main.h"
|
||||
#include "platform.h"
|
||||
#include "framebuffer.h"
|
||||
#include "events.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "framebuffer.h"
|
||||
#include "window.h"
|
||||
#include <ion/display.h>
|
||||
#include "main.h"
|
||||
|
||||
/* Drawing on an SDL texture
|
||||
* In SDL2, drawing bitmap data happens through textures, whose data lives in
|
||||
@@ -23,14 +23,14 @@ static KDFrameBuffer sFrameBuffer = KDFrameBuffer(sPixels, KDSize(Ion::Display::
|
||||
|
||||
void pushRect(KDRect r, const KDColor * pixels) {
|
||||
if (sFrameBufferActive) {
|
||||
Simulator::Main::setNeedsRefresh();
|
||||
Simulator::Window::setNeedsRefresh();
|
||||
sFrameBuffer.pushRect(r, pixels);
|
||||
}
|
||||
}
|
||||
|
||||
void pushRectUniform(KDRect r, KDColor c) {
|
||||
if (sFrameBufferActive) {
|
||||
Simulator::Main::setNeedsRefresh();
|
||||
Simulator::Window::setNeedsRefresh();
|
||||
sFrameBuffer.pushRectUniform(r, c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "main.h"
|
||||
#include "platform.h"
|
||||
#include "layout.h"
|
||||
#include "platform.h"
|
||||
#include "window.h"
|
||||
|
||||
#include <ion/keyboard.h>
|
||||
#include <SDL.h>
|
||||
@@ -58,7 +58,7 @@ State scan() {
|
||||
IonSimulatorCallbackDidScanKeyboard();
|
||||
|
||||
// Grab this opportunity to refresh the display if needed
|
||||
Simulator::Main::refresh();
|
||||
Simulator::Window::refresh();
|
||||
|
||||
// Start with a "clean" state
|
||||
State state;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "layout.h"
|
||||
#include "main.h"
|
||||
#include "window.h"
|
||||
#include "platform.h"
|
||||
#include <ion.h>
|
||||
#include <limits.h>
|
||||
@@ -239,13 +239,13 @@ void highlightKeyAt(SDL_Point * p) {
|
||||
}
|
||||
if (newHighlightedKeyIndex != sHighlightedKeyIndex) {
|
||||
sHighlightedKeyIndex = newHighlightedKeyIndex;
|
||||
Main::setNeedsRefresh();
|
||||
Window::setNeedsRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
void unhighlightKey() {
|
||||
sHighlightedKeyIndex = -1;
|
||||
Main::setNeedsRefresh();
|
||||
Window::setNeedsRefresh();
|
||||
}
|
||||
|
||||
void drawHighlightedKey(SDL_Renderer * renderer) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef ION_SIMULATOR_MAIN_H
|
||||
#define ION_SIMULATOR_MAIN_H
|
||||
#ifndef ION_SIMULATOR_WINDOW_H
|
||||
#define ION_SIMULATOR_WINDOW_H
|
||||
|
||||
namespace Ion {
|
||||
namespace Simulator {
|
||||
namespace Main {
|
||||
namespace Window {
|
||||
|
||||
void init();
|
||||
void quit();
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "main.h"
|
||||
#include "window.h"
|
||||
#include "display.h"
|
||||
#include "platform.h"
|
||||
#include "framebuffer.h"
|
||||
@@ -52,7 +52,7 @@ int main(int argc, char * argv[]) {
|
||||
|
||||
namespace Ion {
|
||||
namespace Simulator {
|
||||
namespace Main {
|
||||
namespace Window {
|
||||
|
||||
void init() {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "main.h"
|
||||
#include "window.h"
|
||||
#include "display.h"
|
||||
#include "haptics.h"
|
||||
#include "layout.h"
|
||||
@@ -25,14 +25,14 @@ int main(int argc, char * argv[]) {
|
||||
#if EPSILON_TELEMETRY
|
||||
Ion::Simulator::Telemetry::init();
|
||||
#endif
|
||||
Ion::Simulator::Main::init();
|
||||
Ion::Simulator::Window::init();
|
||||
Ion::Simulator::Haptics::init();
|
||||
|
||||
ion_main(arguments.size(), &arguments[0]);
|
||||
|
||||
// Shutdown
|
||||
Ion::Simulator::Haptics::shutdown();
|
||||
Ion::Simulator::Main::quit();
|
||||
Ion::Simulator::Window::quit();
|
||||
#if EPSILON_TELEMETRY
|
||||
Ion::Simulator::Telemetry::shutdown();
|
||||
#endif
|
||||
@@ -42,7 +42,7 @@ int main(int argc, char * argv[]) {
|
||||
|
||||
namespace Ion {
|
||||
namespace Simulator {
|
||||
namespace Main {
|
||||
namespace Window {
|
||||
|
||||
static SDL_Window * sWindow = nullptr;
|
||||
static SDL_Renderer * sRenderer = nullptr;
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <ion.h>
|
||||
#include "../shared/main.h"
|
||||
#include "../shared/window.h"
|
||||
|
||||
extern "C" const char * IonSoftwareVersion() {
|
||||
return Ion::softwareVersion();
|
||||
@@ -10,6 +10,6 @@ extern "C" const char * IonPatchLevel() {
|
||||
}
|
||||
|
||||
extern "C" void IonDisplayForceRefresh() {
|
||||
Ion::Simulator::Main::setNeedsRefresh();
|
||||
Ion::Simulator::Main::refresh();
|
||||
Ion::Simulator::Window::setNeedsRefresh();
|
||||
Ion::Simulator::Window::refresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user