Integrate all the progress into master #6

Merged
jaby merged 595 commits from ToolBox into main 2025-01-01 13:17:44 +00:00
4 changed files with 53 additions and 7 deletions
Showing only changes of commit f69e60b2de - Show all commits

View File

@ -1,7 +1,29 @@
#include "../../../include/shared.hpp"
#include <PSX/GPU/gpu.hpp>
#include <stdio.h>
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() {
printf("BlubbBlubbBlubbBlubb\n");
setup();
while(true) {
update();
GPU::swap_buffers_vsync(1);
render();
}
}
}

View File

@ -81,7 +81,7 @@ static void setup() {
namespace NormalScene {
static void update() {
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();
auto cursor = FontWriter::update(JabyEngine::Make::PositionI16((GPU::Display::Width-TitleLength)/2, 16));
@ -108,7 +108,7 @@ namespace NormalScene {
namespace LoadingScene {
static void update() {
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));
FontWriter::new_font_writer.write(cursor, Title, GPU::Color24::Blue(0xD0));

View File

@ -198,6 +198,7 @@ namespace JabyEngine {
using PositionU8 = Position<uint8_t>;
using PositionI16 = Position<int16_t>;
using PositionU16 = Position<uint16_t>;
using Vertex = PositionI16;
template<typename T>
struct Size {
@ -208,12 +209,17 @@ namespace JabyEngine {
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;
};
typedef Size<int16_t> SizeI16;
typedef Size<uint16_t> SizeU16;
// Type used for primitives
typedef PositionI16 Vertex;
using SizeI8 = Size<int8_t>;
using SizeU8 = Size<uint8_t>;
using SizeI16 = Size<int16_t>;
using SizeU16 = Size<uint16_t>;
template<typename T, typename S>
static constexpr T tile_id_for(S id, S row_count, Size<S> size) {

View File

@ -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() {
return creator_template<GPU::SizeI16>(0_i16, 0_i16);
}