[ion/simulator] Get rid of the headless target

This commit is contained in:
Romain Goyet
2020-09-17 16:42:28 -04:00
committed by Léa Saviot
parent 2bee7eb267
commit a834c954b8
11 changed files with 31 additions and 109 deletions

View File

@@ -1,11 +0,0 @@
#include <ion/events.h>
namespace Ion {
namespace Events {
Event getPlatformEvent() {
return None;
}
}
}

View File

@@ -1,11 +0,0 @@
#include <ion/keyboard.h>
namespace Ion {
namespace Keyboard {
State scan() {
return State();
}
}
}

View File

@@ -1,4 +0,0 @@
#include <ion/timing.h>
void Ion::Timing::msleep(uint32_t ms) {
}

View File

@@ -3,35 +3,28 @@ ion_src += $(addprefix ion/src/shared/dummy/, \
battery.cpp \
display.cpp \
exam_mode.cpp \
events_platform.cpp:+headless \
fcc_id.cpp \
keyboard.cpp:+headless \
led.cpp \
power.cpp \
serial_number.cpp \
stack.cpp \
timing_msleep.cpp:+headless \
usb.cpp \
)
ion_src += $(addprefix ion/src/simulator/shared/, \
dummy/keyboard.cpp:+headless \
dummy/window.cpp:+headless \
clipboard.cpp \
console_stdio.cpp:-consoledisplay \
console.cpp \
crc32.cpp \
display.cpp:-headless \
display.cpp \
events.cpp \
events_platform.cpp:-headless \
events_platform.cpp \
framebuffer.cpp \
framebuffer_png.cpp:+headless \
keyboard.cpp:-headless \
layout.cpp:-headless \
keyboard.cpp \
layout.cpp \
main.cpp \
random.cpp \
timing.cpp \
timing_msleep.cpp:-headless \
window.cpp:-headless \
window.cpp \
)
ion_simulator_assets = background.jpg horizontal_arrow.png vertical_arrow.png round.png small_squircle.png large_squircle.png

View File

@@ -1,19 +0,0 @@
#include "../keyboard.h"
namespace Ion {
namespace Simulator {
namespace Keyboard {
void keyDown(Ion::Keyboard::Key k) {
}
void keyUp(Ion::Keyboard::Key k) {
}
bool scanHandlesSDLKey(SDL_Scancode key) {
return false;
}
}
}
}

View File

@@ -1,24 +0,0 @@
#include "../window.h"
namespace Ion {
namespace Simulator {
namespace Window {
void init() {
Ion::Simulator::Framebuffer::setActive(false);
}
void quit() {
}
void setNeedsRefresh() {
}
void relayout() {
}
void refresh() {
}
}
}
}

View File

@@ -1,9 +1,24 @@
#include <ion/timing.h>
#include "window.h"
#include <chrono>
#include <SDL.h>
static auto start = std::chrono::steady_clock::now();
uint64_t Ion::Timing::millis() {
namespace Ion {
namespace Timing {
uint64_t millis() {
auto elapsed = std::chrono::steady_clock::now() - start;
return std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
}
void msleep(uint32_t ms) {
if (Simulator::Window::isHeadless()) {
return;
}
SDL_Delay(ms);
}
}
}

View File

@@ -1,10 +0,0 @@
#include <ion/timing.h>
#include "window.h"
#include <SDL.h>
void Ion::Timing::msleep(uint32_t ms) {
if (Ion::Simulator::Window::isHeadless()) {
return;
}
SDL_Delay(ms);
}