Introduce corner frames

This commit is contained in:
Jaby 2024-01-05 21:42:15 -06:00
parent d59e2d163e
commit dfb0a72ec8
3 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,5 @@
#include "include/frame.hpp"
#include <PSX/GPU/gpu.hpp>
namespace ScreenCenter {
}

View File

@ -0,0 +1,36 @@
#pragma once
#include <PSX/GPU/gpu.hpp>
#include <PSX/GPU/make_gpu_primitives.hpp>
namespace ScreenCenter {
using namespace JabyEngine;
class Frame : public GPU::internal::LinkedElementCreator<Frame> {
private:
GPU::TILE top_left[2];
GPU::TILE top_right[2];
GPU::TILE bottom_left[2];
GPU::TILE bottom_right[2];
public:
static constexpr Frame::Linked create() {
constexpr auto BaseColor = GPU::Color24::from_rgb(0x1D, 0xA0, 0xA3);
constexpr auto Size = Make::SizeI16(64, 16);
Frame frame;
frame.top_left[0] = Make::TILE(Make::AreaI16(0, 0, Size.width, Size.height), BaseColor);
frame.top_left[1] = Make::TILE(Make::AreaI16(0, 0, Size.height, Size.width), BaseColor);
frame.top_right[0] = Make::TILE(Make::AreaI16(GPU::Display::Width - Size.width, 0, Size.width, Size.height), BaseColor);
frame.top_right[1] = Make::TILE(Make::AreaI16(GPU::Display::Width - Size.height, 0, Size.height, Size.width), BaseColor);
frame.bottom_left[0] = Make::TILE(Make::AreaI16(0, GPU::Display::Height - Size.width, Size.height, Size.width), BaseColor);
frame.bottom_left[1] = Make::TILE(Make::AreaI16(0, GPU::Display::Height - Size.height, Size.width, Size.height), BaseColor);
frame.bottom_right[0] = Make::TILE(Make::AreaI16(GPU::Display::Width - Size.height, GPU::Display::Height - Size.width, Size.height, Size.width), BaseColor);
frame.bottom_right[1] = Make::TILE(Make::AreaI16(GPU::Display::Width - Size.width, GPU::Display::Height - Size.height, Size.width, Size.height), BaseColor);
return frame.linked();
}
};
}

View File

@ -1,4 +1,5 @@
#include "../../../include/shared.hpp"
#include "include/frame.hpp"
#include <PSX/GPU/gpu.hpp>
#include <PSX/Periphery/periphery.hpp>
#include <stdio.h>
@ -6,6 +7,8 @@
namespace ScreenCenter {
using namespace JabyEngine;
static const auto frame = Frame::create();
static void setup() {
Shared::back_menu.reset();
}
@ -17,11 +20,12 @@ namespace ScreenCenter {
}
auto cursor = FontWriter::update(Make::PositionI16(8, 8));
FontWriter::bios_font_writer.write(cursor, "NOTHING HERE TO SEE", GPU::Color24::Red());
FontWriter::bios_font_writer.write(cursor, "NOTHING TO SEE HERE", GPU::Color24::Red());
return false;
}
static void render() {
GPU::render(frame);
Shared::back_menu.render();
}