Create maker functions for Position and Size
This commit is contained in:
parent
993adc3f26
commit
b35eef3e8e
|
@ -14,28 +14,28 @@ enum LBA {
|
||||||
using namespace JabyEngine;
|
using namespace JabyEngine;
|
||||||
|
|
||||||
// Some default values for the objects
|
// Some default values for the objects
|
||||||
static constexpr auto TriangleColor = GPU::Color24(0x0, 0xFF, 0xFF);
|
static constexpr auto TriangleColor = GPU::Color24::from_rgb(0x0, 0xFF, 0xFF);
|
||||||
static constexpr auto TriangleArea = GPU::AreaI16::create(GPU::PositionI16::create(0, 0), GPU::SizeI16::create(64, 64));
|
static constexpr auto TriangleArea = GPU::AreaI16::create(Make::PositionI16(0, 0), Make::SizeI16(64, 64));
|
||||||
static constexpr auto TriangleTPage = GPU::TPage::create(320, 0, GPU::SemiTransparency::B_Half_add_F_Half, GPU::TexturePageColor::$4bit);
|
static constexpr auto TriangleTPage = GPU::TPage::create(320, 0, GPU::SemiTransparency::B_Half_add_F_Half, GPU::TexturePageColor::$4bit);
|
||||||
static constexpr auto TriangleClut = GPU::PageClut::create(320, 511);
|
static constexpr auto TriangleClut = GPU::PageClut::create(320, 511);
|
||||||
|
|
||||||
static constexpr auto RectangleColor = GPU::Color24(0x80, 0x80, 0xFF);
|
static constexpr auto RectangleColor = GPU::Color24(0x80, 0x80, 0xFF);
|
||||||
static constexpr auto RectangleArea = GPU::AreaI16::create(GPU::PositionI16::create(0, TriangleArea.size.height), GPU::SizeI16::create(80, 80));
|
static constexpr auto RectangleArea = GPU::AreaI16::create(Make::PositionI16(0, TriangleArea.size.height), Make::SizeI16(80, 80));
|
||||||
static constexpr auto RectangleTPage = GPU::TPage::create(320, 256, GPU::SemiTransparency::B_Half_add_F_Half, GPU::TexturePageColor::$4bit);
|
static constexpr auto RectangleTPage = GPU::TPage::create(320, 256, GPU::SemiTransparency::B_Half_add_F_Half, GPU::TexturePageColor::$4bit);
|
||||||
static constexpr auto RectangleClut = GPU::PageClut::create(320, 510);
|
static constexpr auto RectangleClut = GPU::PageClut::create(320, 510);
|
||||||
|
|
||||||
static constexpr auto LineColor = GPU::Color24(0xFF, 0x0, 0x0);
|
static constexpr auto LineColor = GPU::Color24(0xFF, 0x0, 0x0);
|
||||||
|
|
||||||
static constexpr const auto triangle1 = GPU::POLY_F3::create({
|
static constexpr const auto triangle1 = GPU::POLY_F3::create({
|
||||||
GPU::Vertex::create(TriangleArea.position.x, TriangleArea.position.y),
|
Make::Vertex(TriangleArea.position.x, TriangleArea.position.y),
|
||||||
GPU::Vertex::create(TriangleArea.size.width, TriangleArea.size.height),
|
Make::Vertex(TriangleArea.size.width, TriangleArea.size.height),
|
||||||
GPU::Vertex::create(TriangleArea.position.x, TriangleArea.size.height)
|
Make::Vertex(TriangleArea.position.x, TriangleArea.size.height)
|
||||||
}, TriangleColor
|
}, TriangleColor
|
||||||
);
|
);
|
||||||
static constexpr const auto triangle2 = GPU::POLY_FT3::create({
|
static constexpr const auto triangle2 = GPU::POLY_FT3::create({
|
||||||
GPU::Vertex::create(TriangleArea.position.x, TriangleArea.position.y),
|
Make::Vertex(TriangleArea.position.x, TriangleArea.position.y),
|
||||||
GPU::Vertex::create(TriangleArea.size.width, TriangleArea.position.y),
|
Make::Vertex(TriangleArea.size.width, TriangleArea.position.y),
|
||||||
GPU::Vertex::create(TriangleArea.size.width, TriangleArea.size.height)
|
Make::Vertex(TriangleArea.size.width, TriangleArea.size.height)
|
||||||
},{
|
},{
|
||||||
// Texture
|
// Texture
|
||||||
GPU::PagePosition::create(TriangleArea.position.x, TriangleArea.position.y),
|
GPU::PagePosition::create(TriangleArea.position.x, TriangleArea.position.y),
|
||||||
|
@ -89,39 +89,39 @@ static constexpr const auto rectangle5 = GPU::POLY_GT4::create(GPU::AreaI16::cre
|
||||||
).set_semi_transparent(true);
|
).set_semi_transparent(true);
|
||||||
|
|
||||||
static constexpr const auto line1 = GPU::LINE_F::create(LineColor,
|
static constexpr const auto line1 = GPU::LINE_F::create(LineColor,
|
||||||
GPU::Vertex::create(0, 0),
|
Make::Vertex(0, 0),
|
||||||
GPU::Vertex::create(GPU::Display::Width, GPU::Display::Height)
|
Make::Vertex(GPU::Display::Width, GPU::Display::Height)
|
||||||
);
|
);
|
||||||
static constexpr const auto line2 = GPU::LINE_F::create(LineColor.invert(),
|
static constexpr const auto line2 = GPU::LINE_F::create(LineColor.invert(),
|
||||||
GPU::Vertex::create(0, 0),
|
Make::Vertex(0, 0),
|
||||||
GPU::Vertex::create(16, 0),
|
Make::Vertex(16, 0),
|
||||||
GPU::Vertex::create(16, 16),
|
Make::Vertex(16, 16),
|
||||||
GPU::Vertex::create(0, 0)
|
Make::Vertex(0, 0)
|
||||||
);
|
);
|
||||||
static constexpr const auto line3 = GPU::LINE_G::create(
|
static constexpr const auto line3 = GPU::LINE_G::create(
|
||||||
GPU::ColorVertex{LineColor, GPU::Vertex::create(GPU::Display::Width, 0)},
|
GPU::ColorVertex{LineColor, Make::Vertex(GPU::Display::Width, 0)},
|
||||||
GPU::ColorVertex{LineColor.invert(), GPU::Vertex::create(0, GPU::Display::Height)}
|
GPU::ColorVertex{LineColor.invert(), Make::Vertex(0, GPU::Display::Height)}
|
||||||
);
|
);
|
||||||
static constexpr const auto line4 = GPU::LINE_G::create(
|
static constexpr const auto line4 = GPU::LINE_G::create(
|
||||||
GPU::ColorVertex{GPU::Color24::Red(), GPU::Vertex::create(0, 0)},
|
GPU::ColorVertex{GPU::Color24::Red(), Make::Vertex(0, 0)},
|
||||||
GPU::ColorVertex{GPU::Color24::Green(), GPU::Vertex::create(0, 16)},
|
GPU::ColorVertex{GPU::Color24::Green(), Make::Vertex(0, 16)},
|
||||||
GPU::ColorVertex{GPU::Color24::Blue(), GPU::Vertex::create(16, 16)},
|
GPU::ColorVertex{GPU::Color24::Blue(), Make::Vertex(16, 16)},
|
||||||
GPU::ColorVertex{GPU::Color24::White(), GPU::Vertex::create(0, 0)}
|
GPU::ColorVertex{GPU::Color24::White(), Make::Vertex(0, 0)}
|
||||||
);
|
);
|
||||||
|
|
||||||
static constexpr const auto rect1 = GPU::TILE::create(GPU::AreaI16::create(GPU::PositionI16::create(GPU::Display::Width - 32, GPU::Display::Height - 32), GPU::SizeI16::create(32, 32)), GPU::Color24::Green());
|
static constexpr const auto rect1 = GPU::TILE::create(GPU::AreaI16::create(Make::PositionI16(GPU::Display::Width - 32, GPU::Display::Height - 32), Make::SizeI16(32, 32)), GPU::Color24::Green());
|
||||||
static constexpr const auto rect2 = GPU::TILE_16::create(GPU::PositionI16::create(GPU::Display::Width - 16, GPU::Display::Height - 16), GPU::Color24::Blue());
|
static constexpr const auto rect2 = GPU::TILE_16::create(Make::PositionI16(GPU::Display::Width - 16, GPU::Display::Height - 16), GPU::Color24::Blue());
|
||||||
static constexpr const auto rect3 = GPU::TILE_8::create(GPU::PositionI16::create(GPU::Display::Width - 8, GPU::Display::Height - 8), GPU::Color24::Yellow());
|
static constexpr const auto rect3 = GPU::TILE_8::create(Make::PositionI16(GPU::Display::Width - 8, GPU::Display::Height - 8), GPU::Color24::Yellow());
|
||||||
static constexpr const auto rect4 = GPU::TILE_1::create(GPU::PositionI16::create(GPU::Display::Width - 1, GPU::Display::Height - 1), GPU::Color24::Red());
|
static constexpr const auto rect4 = GPU::TILE_1::create(Make::PositionI16(GPU::Display::Width - 1, GPU::Display::Height - 1), GPU::Color24::Red());
|
||||||
|
|
||||||
static constexpr const auto texpage = GPU::TexPage::create(GPU::PositionU16::create(320, 0), GPU::TexturePageColor::$4bit);
|
static constexpr const auto texpage = GPU::TexPage::create(Make::PositionU16(320, 0), GPU::TexturePageColor::$4bit);
|
||||||
static constexpr const auto rect5 = GPU::SPRT::create(GPU::AreaI16(GPU::PositionI16::create(0, GPU::Display::Height - 32), GPU::SizeI16(32, 32)), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Green());
|
static constexpr const auto rect5 = GPU::SPRT::create(GPU::AreaI16(Make::PositionI16(0, GPU::Display::Height - 32), Make::SizeI16(32, 32)), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Green());
|
||||||
static constexpr const auto rect6 = GPU::SPRT_16::create(GPU::Vertex::create(0, GPU::Display::Height - 16), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Blue());
|
static constexpr const auto rect6 = GPU::SPRT_16::create(Make::Vertex(0, GPU::Display::Height - 16), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Blue());
|
||||||
static constexpr const auto rect7 = GPU::SPRT_8::create(GPU::Vertex::create(0, GPU::Display::Height - 8), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Yellow());
|
static constexpr const auto rect7 = GPU::SPRT_8::create(Make::Vertex(0, GPU::Display::Height - 8), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Yellow());
|
||||||
static constexpr const auto rect8 = GPU::SPRT_1::create(GPU::Vertex::create(0, GPU::Display::Height - 1), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Red());
|
static constexpr const auto rect8 = GPU::SPRT_1::create(Make::Vertex(0, GPU::Display::Height - 1), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Red());
|
||||||
|
|
||||||
static auto rect9 = GPU::SPRT::create(GPU::AreaI16(GPU::PositionI16::create(GPU::Display::Width/2, GPU::Display::Height/2), GPU::SizeI16::create(32, 32)).centered(), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Grey()).linked();
|
static auto rect9 = GPU::SPRT::create(GPU::AreaI16(Make::PositionI16(GPU::Display::Width/2, GPU::Display::Height/2), Make::SizeI16(32, 32)).centered(), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Grey()).linked();
|
||||||
static auto rect10 = GPU::SPRT::create(GPU::AreaI16(GPU::PositionI16::create(GPU::Display::Width/2, GPU::Display::Height/2 - 32), GPU::SizeI16::create(32, 32)).centered(), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Grey()).linked();
|
static auto rect10 = GPU::SPRT::create(GPU::AreaI16(Make::PositionI16(GPU::Display::Width/2, GPU::Display::Height/2 - 32), Make::SizeI16(32, 32)).centered(), {GPU::PagePosition::create(0, 0), TriangleClut}, GPU::Color24::Grey()).linked();
|
||||||
|
|
||||||
static void load_assets() {
|
static void load_assets() {
|
||||||
static const CDFile Assets[] = {
|
static const CDFile Assets[] = {
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#pragma once
|
||||||
|
#include "../../stdint.h"
|
||||||
|
|
||||||
|
namespace JabyEngine {
|
||||||
|
static constexpr int8_t operator""_i8(unsigned long long int value) {
|
||||||
|
return static_cast<int8_t>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr uint8_t operator""_u8(unsigned long long int value) {
|
||||||
|
return static_cast<uint8_t>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ###################################################################
|
||||||
|
|
||||||
|
static constexpr int16_t operator""_i16(unsigned long long int value) {
|
||||||
|
return static_cast<int16_t>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr uint16_t operator""_u16(unsigned long long int value) {
|
||||||
|
return static_cast<uint16_t>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ###################################################################
|
||||||
|
|
||||||
|
static constexpr int32_t operator""_i32(unsigned long long int value) {
|
||||||
|
return static_cast<int32_t>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr uint32_t operator""_u32(unsigned long long int value) {
|
||||||
|
return static_cast<uint32_t>(value);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,71 @@
|
||||||
#ifndef __JABYENGINE_GPU_PRIMITIVES_HPP__
|
#ifndef __JABYENGINE_GPU_PRIMITIVES_HPP__
|
||||||
#define __JABYENGINE_GPU_PRIMITIVES_HPP__
|
#define __JABYENGINE_GPU_PRIMITIVES_HPP__
|
||||||
|
#include "../Auxiliary/literals.hpp"
|
||||||
#include "Primitives/primitive_gpu_commands.hpp"
|
#include "Primitives/primitive_gpu_commands.hpp"
|
||||||
#include "Primitives/primitive_line_types.hpp"
|
#include "Primitives/primitive_line_types.hpp"
|
||||||
#include "Primitives/primitive_rectangle_types.hpp"
|
#include "Primitives/primitive_rectangle_types.hpp"
|
||||||
#include "Primitives/primitive_poly_types.hpp"
|
#include "Primitives/primitive_poly_types.hpp"
|
||||||
|
|
||||||
|
namespace JabyEngine {
|
||||||
|
namespace Make {
|
||||||
|
using JabyEngine::operator""_i16;
|
||||||
|
using JabyEngine::operator""_u16;
|
||||||
|
|
||||||
|
template<typename T, typename...ARGS>
|
||||||
|
static constexpr T creator_template(ARGS...args) {
|
||||||
|
return T::create(args...);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ###################################################################
|
||||||
|
|
||||||
|
static constexpr GPU::SizeI16 SizeI16() {
|
||||||
|
return creator_template<GPU::SizeI16>(0_i16, 0_i16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr GPU::SizeI16 SizeI16(int16_t x, int16_t y) {
|
||||||
|
return creator_template<GPU::SizeI16>(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ###################################################################
|
||||||
|
|
||||||
|
static constexpr GPU::SizeU16 SizeU16() {
|
||||||
|
return creator_template<GPU::SizeU16>(0_u16, 0_u16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr GPU::SizeU16 SizeU16(uint16_t x, uint16_t y) {
|
||||||
|
return creator_template<GPU::SizeU16>(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ###################################################################
|
||||||
|
|
||||||
|
static constexpr GPU::PositionI16 PositionI16() {
|
||||||
|
return creator_template<GPU::PositionI16>(0_i16, 0_i16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr GPU::PositionI16 PositionI16(int16_t x, int16_t y) {
|
||||||
|
return creator_template<GPU::PositionI16>(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ###################################################################
|
||||||
|
|
||||||
|
static constexpr GPU::PositionU16 PositionU16() {
|
||||||
|
return creator_template<GPU::PositionU16>(0_u16, 0_u16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr GPU::PositionU16 PositionU16(uint16_t x, uint16_t y) {
|
||||||
|
return creator_template<GPU::PositionU16>(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ###################################################################
|
||||||
|
|
||||||
|
static constexpr GPU::Vertex Vertex() {
|
||||||
|
return creator_template<GPU::Vertex>(0_i16, 0_i16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr GPU::Vertex Vertex(int16_t x, int16_t y) {
|
||||||
|
return creator_template<GPU::Vertex>(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // !__JABYENGINE_GPU_PRIMITIVES_HPP__
|
#endif // !__JABYENGINE_GPU_PRIMITIVES_HPP__
|
Loading…
Reference in New Issue