emulator: add 30 second countdown
This commit is contained in:
parent
ebfc839acb
commit
da897d4dce
16
src/font.cpp
16
src/font.cpp
@ -5,6 +5,7 @@
|
|||||||
#include "font.hpp"
|
#include "font.hpp"
|
||||||
|
|
||||||
#include "math/float_types.hpp"
|
#include "math/float_types.hpp"
|
||||||
|
#include "printf/unparse.h"
|
||||||
|
|
||||||
namespace font {
|
namespace font {
|
||||||
|
|
||||||
@ -109,4 +110,19 @@ void draw_string(ta_parameter_writer& writer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw_integer(ta_parameter_writer& writer,
|
||||||
|
const font& face,
|
||||||
|
int n,
|
||||||
|
int length, int fill,
|
||||||
|
float x, float y, float z,
|
||||||
|
int base_color)
|
||||||
|
{
|
||||||
|
char buf[16];
|
||||||
|
|
||||||
|
int len = unparse_base10(buf, n, length, fill);
|
||||||
|
buf[len] = 0;
|
||||||
|
|
||||||
|
draw_string(writer, face, buf, x, y, z, base_color);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,4 +37,11 @@ namespace font {
|
|||||||
const char * s,
|
const char * s,
|
||||||
float x, float y, float z,
|
float x, float y, float z,
|
||||||
int base_color);
|
int base_color);
|
||||||
|
|
||||||
|
void draw_integer(ta_parameter_writer& writer,
|
||||||
|
const font& face,
|
||||||
|
int n,
|
||||||
|
int length, int fill,
|
||||||
|
float x, float y, float z,
|
||||||
|
int base_color);
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,9 @@ void main()
|
|||||||
|
|
||||||
if (emulator) {
|
if (emulator) {
|
||||||
scene::emulator::current_message_id = scene::emulator::counterfeit;
|
scene::emulator::current_message_id = scene::emulator::counterfeit;
|
||||||
//scene::scene_init(scene::id::emulator);
|
scene::scene_init(scene::id::emulator);
|
||||||
scene::scene_init(scene::id::tracker);
|
//scene::scene_init(scene::id::tracker);
|
||||||
|
//scene::scene_init(scene::id::logo);
|
||||||
} else {
|
} else {
|
||||||
scene::scene_init(scene::id::logo);
|
scene::scene_init(scene::id::logo);
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,8 @@ namespace scene::emulator {
|
|||||||
|
|
||||||
int current_message_id = 0;
|
int current_message_id = 0;
|
||||||
|
|
||||||
|
static int tick = 0;
|
||||||
|
|
||||||
void draw_title(ta_parameter_writer& writer, int color)
|
void draw_title(ta_parameter_writer& writer, int color)
|
||||||
{
|
{
|
||||||
const font::font& face = font::fonts[font::font::ter_u32n];
|
const font::font& face = font::fonts[font::font::ter_u32n];
|
||||||
@ -124,6 +126,11 @@ namespace scene::emulator {
|
|||||||
draw_string(writer, face, s, x, y, 0.1, base_color);
|
draw_string(writer, face, s, x, y, 0.1, base_color);
|
||||||
y += face.height;
|
y += face.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float tick_div = framebuffer.px_height == 480 ? (1.f / 60.f) : (1.f / 120.f);
|
||||||
|
int n = 30.000 - (tick * tick_div);
|
||||||
|
y += face.height;
|
||||||
|
draw_integer(writer, face, n, 0, 0, x, y, 0.1, base_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void transfer(ta_multiwriter& multi)
|
void transfer(ta_multiwriter& multi)
|
||||||
@ -150,6 +157,8 @@ namespace scene::emulator {
|
|||||||
{0, 0, 0.1},
|
{0, 0, 0.1},
|
||||||
{0, 0, 0.1},
|
{0, 0, 0.1},
|
||||||
0x0);
|
0x0);
|
||||||
|
|
||||||
|
tick += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
@ -165,6 +174,14 @@ namespace scene::emulator {
|
|||||||
|
|
||||||
int done()
|
int done()
|
||||||
{
|
{
|
||||||
|
float tick_mul = framebuffer.px_height == 480 ? 60 : 120;
|
||||||
|
|
||||||
|
if (tick >= (30.000 * tick_mul)) {
|
||||||
|
int scene_id = ::scene::id::logo;
|
||||||
|
printf("scene transition to logo %d\n", scene_id);
|
||||||
|
return scene_id;
|
||||||
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user