Update PoolBox with latest changes
This commit is contained in:
parent
b43b7fca2f
commit
f69e60b2de
|
@ -1,7 +1,29 @@
|
||||||
|
#include "../../../include/shared.hpp"
|
||||||
|
#include <PSX/GPU/gpu.hpp>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
namespace ScreenCenter {
|
namespace ScreenCenter {
|
||||||
|
using namespace JabyEngine;
|
||||||
|
|
||||||
|
static const char*const ASCII = "!\"#$%&'()*+,-./0\n123456789:;<=>?@\nABCDEFGHIJKLMNOP\nQRSTUVWXYZ[\\]^_`\nabcdefghijklmnop\nqrstuvwxyz{|}~";
|
||||||
|
|
||||||
|
static void setup() {}
|
||||||
|
static void update() {
|
||||||
|
auto cursor = FontWriter::update(Make::PositionI16(8, 8));
|
||||||
|
|
||||||
|
FontWriter::bios_font_writer.write(cursor, ASCII);
|
||||||
|
}
|
||||||
|
static void render() {
|
||||||
|
FontWriter::bios_font_writer.render();
|
||||||
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
printf("BlubbBlubbBlubbBlubb\n");
|
setup();
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
update();
|
||||||
|
GPU::swap_buffers_vsync(1);
|
||||||
|
render();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -81,7 +81,7 @@ static void setup() {
|
||||||
namespace NormalScene {
|
namespace NormalScene {
|
||||||
static void update() {
|
static void update() {
|
||||||
static const char Title[] = "Pool Box";
|
static const char Title[] = "Pool Box";
|
||||||
static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.font_size.width;
|
static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.get_font_size().width;
|
||||||
|
|
||||||
Periphery::query_controller();
|
Periphery::query_controller();
|
||||||
auto cursor = FontWriter::update(JabyEngine::Make::PositionI16((GPU::Display::Width-TitleLength)/2, 16));
|
auto cursor = FontWriter::update(JabyEngine::Make::PositionI16((GPU::Display::Width-TitleLength)/2, 16));
|
||||||
|
@ -108,7 +108,7 @@ namespace NormalScene {
|
||||||
namespace LoadingScene {
|
namespace LoadingScene {
|
||||||
static void update() {
|
static void update() {
|
||||||
static const char Title[] = "Loading...";
|
static const char Title[] = "Loading...";
|
||||||
static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.font_size.width;
|
static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.get_font_size().width;
|
||||||
|
|
||||||
auto cursor = FontWriter::update(JabyEngine::Make::PositionI16((GPU::Display::Width-TitleLength)/2, (GPU::Display::Height-16)/2));
|
auto cursor = FontWriter::update(JabyEngine::Make::PositionI16((GPU::Display::Width-TitleLength)/2, (GPU::Display::Height-16)/2));
|
||||||
FontWriter::new_font_writer.write(cursor, Title, GPU::Color24::Blue(0xD0));
|
FontWriter::new_font_writer.write(cursor, Title, GPU::Color24::Blue(0xD0));
|
||||||
|
|
|
@ -198,6 +198,7 @@ namespace JabyEngine {
|
||||||
using PositionU8 = Position<uint8_t>;
|
using PositionU8 = Position<uint8_t>;
|
||||||
using PositionI16 = Position<int16_t>;
|
using PositionI16 = Position<int16_t>;
|
||||||
using PositionU16 = Position<uint16_t>;
|
using PositionU16 = Position<uint16_t>;
|
||||||
|
using Vertex = PositionI16;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct Size {
|
struct Size {
|
||||||
|
@ -208,12 +209,17 @@ namespace JabyEngine {
|
||||||
return Size{w, h};
|
return Size{w, h};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename S>
|
||||||
|
static constexpr Size from(const Size<S>& size) {
|
||||||
|
return Size::create(static_cast<T>(size.width), static_cast<T>(size.height));
|
||||||
|
}
|
||||||
|
|
||||||
auto operator<=>(const Size<T>&) const = default;
|
auto operator<=>(const Size<T>&) const = default;
|
||||||
};
|
};
|
||||||
typedef Size<int16_t> SizeI16;
|
using SizeI8 = Size<int8_t>;
|
||||||
typedef Size<uint16_t> SizeU16;
|
using SizeU8 = Size<uint8_t>;
|
||||||
// Type used for primitives
|
using SizeI16 = Size<int16_t>;
|
||||||
typedef PositionI16 Vertex;
|
using SizeU16 = Size<uint16_t>;
|
||||||
|
|
||||||
template<typename T, typename S>
|
template<typename T, typename S>
|
||||||
static constexpr T tile_id_for(S id, S row_count, Size<S> size) {
|
static constexpr T tile_id_for(S id, S row_count, Size<S> size) {
|
||||||
|
|
|
@ -13,6 +13,24 @@ namespace JabyEngine {
|
||||||
|
|
||||||
// ###################################################################
|
// ###################################################################
|
||||||
|
|
||||||
|
static constexpr GPU::SizeI8 SizeI8() {
|
||||||
|
return creator_template<GPU::SizeI8>(0_i8, 0_i8);
|
||||||
|
}
|
||||||
|
static constexpr GPU::SizeI8 SizeI8(int8_t x, int8_t y) {
|
||||||
|
return creator_template<GPU::SizeI8>(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ###################################################################
|
||||||
|
|
||||||
|
static constexpr GPU::SizeU8 SizeU8() {
|
||||||
|
return creator_template<GPU::SizeU8>(0_u8, 0_u8);
|
||||||
|
}
|
||||||
|
static constexpr GPU::SizeU8 SizeU8(uint8_t x, uint8_t y) {
|
||||||
|
return creator_template<GPU::SizeU8>(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ###################################################################
|
||||||
|
|
||||||
static constexpr GPU::SizeI16 SizeI16() {
|
static constexpr GPU::SizeI16 SizeI16() {
|
||||||
return creator_template<GPU::SizeI16>(0_i16, 0_i16);
|
return creator_template<GPU::SizeI16>(0_i16, 0_i16);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue