Testing font and color font
This commit is contained in:
parent
cf737459aa
commit
13c7cba599
|
@ -1,7 +1,11 @@
|
||||||
#ifndef __ASSETS_HPP__
|
#ifndef __ASSETS_HPP__
|
||||||
#define __ASSETS_HPP__
|
#define __ASSETS_HPP__
|
||||||
|
#include <PSX/File/Processor/cd_file_processor.hpp>
|
||||||
|
|
||||||
namespace Assets {
|
namespace Assets {
|
||||||
|
using namespace JabyEngine;
|
||||||
|
|
||||||
|
static constexpr auto FontTIM = SimpleTIM(960, 0, 960, 511);
|
||||||
void load_for_main();
|
void load_for_main();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,25 @@
|
||||||
#include "assets.hpp"
|
#include "assets.hpp"
|
||||||
|
#include <PSX/GPU/gpu_primitives.hpp>
|
||||||
|
#include <PSX/GPU/gpu.hpp>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
using namespace JabyEngine;
|
||||||
|
static auto FontPage = GPU::TexPage({Assets::FontTIM.get_texture_x(), Assets::FontTIM.get_texture_y()}, GPU::TexturePageColor::$4bit).linked();
|
||||||
|
static auto FontTest = GPU::SPRT(
|
||||||
|
GPU::AreaI16({0, 0}, {256, 96}), {GPU::PagePosition(0, 0), GPU::PageClut(Assets::FontTIM.get_clut_x(), Assets::FontTIM.get_clut_y())},
|
||||||
|
GPU::Color24::Grey()
|
||||||
|
).linked();
|
||||||
|
static auto FontTestColor = GPU::SPRT(
|
||||||
|
GPU::AreaI16({0, 96}, {256, 96}), {GPU::PagePosition(0, 0), GPU::PageClut(Assets::FontTIM.get_clut_x(), Assets::FontTIM.get_clut_y())},
|
||||||
|
GPU::Color24(0x0, 0x0, 0xA0)
|
||||||
|
).linked();
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Assets::load_for_main();
|
Assets::load_for_main();
|
||||||
printf("Planschbecken c:\n");
|
|
||||||
|
FontPage.concat(FontTest).concat(FontTestColor);
|
||||||
|
while(true) {
|
||||||
|
GPU::swap_buffers_vsync(1);
|
||||||
|
GPU::render(FontPage);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
#include "assets.hpp"
|
#include "assets.hpp"
|
||||||
#include <PSX/File/Processor/cd_file_processor.hpp>
|
|
||||||
#include <PSX/AutoLBA/auto_lba_declaration.hpp>
|
#include <PSX/AutoLBA/auto_lba_declaration.hpp>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -13,6 +12,29 @@ namespace Assets {
|
||||||
__declare_lba_header(LBA);
|
__declare_lba_header(LBA);
|
||||||
|
|
||||||
void load_for_main() {
|
void load_for_main() {
|
||||||
printf("Loading assets! %i\n", lba[LBA::FONT].get_lba());
|
static const CDFile Assets[] = {
|
||||||
|
CDFileBuilder::simple_tim(LBA::FONT, FontTIM),
|
||||||
|
};
|
||||||
|
|
||||||
|
const auto buffer_cfg = CDFileProcessor::BufferConfiguration::new_default();
|
||||||
|
CDFileProcessor file_processor;
|
||||||
|
|
||||||
|
file_processor.setup(lba, Assets, buffer_cfg);
|
||||||
|
while(true) {
|
||||||
|
switch(file_processor.process()) {
|
||||||
|
case Progress::InProgress:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Progress::Done:
|
||||||
|
if(!file_processor.next(lba, buffer_cfg)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Progress::Error:
|
||||||
|
printf("Error detected! Aborting load\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -34,11 +34,16 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const T& concat(const T& obj) {
|
T& concat(T& obj) {
|
||||||
Link::set_adr(&obj);
|
Link::set_adr(&obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
const T& concat(const T& obj) {
|
||||||
|
return concat(const_cast<T&>(obj));
|
||||||
|
}
|
||||||
|
|
||||||
constexpr void terminate() {
|
constexpr void terminate() {
|
||||||
this->value |= TerminationValue;
|
this->value |= TerminationValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,20 +78,20 @@ namespace JabyEngine {
|
||||||
return Color24(0xFF, 0xFF, 0xFF);
|
return Color24(0xFF, 0xFF, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Color24 Red() {
|
static constexpr Color24 Red(uint8_t base = 0xFF) {
|
||||||
return Color24(0xFF, 0x0, 0x0);
|
return Color24(base, 0x0, 0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Color24 Green() {
|
static constexpr Color24 Green(uint8_t base = 0xFF) {
|
||||||
return Color24(0x0, 0xFF, 0x0);
|
return Color24(0x0, base, 0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Color24 Blue() {
|
static constexpr Color24 Blue(uint8_t base = 0xFF) {
|
||||||
return Color24(0x0, 0x0, 0xFF);
|
return Color24(0x0, 0x0, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr Color24 Yellow() {
|
static constexpr Color24 Yellow(uint8_t base = 0xFF) {
|
||||||
return Color24(0xFF, 0xFF, 0x0);
|
return Color24(base, base, 0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Color24 invert() const {
|
constexpr Color24 invert() const {
|
||||||
|
|
Loading…
Reference in New Issue