Create maker functions for Position and Size
This commit is contained in:
32
include/PSX/Auxiliary/literals.hpp
Normal file
32
include/PSX/Auxiliary/literals.hpp
Normal file
@@ -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__
|
||||
#define __JABYENGINE_GPU_PRIMITIVES_HPP__
|
||||
#include "../Auxiliary/literals.hpp"
|
||||
#include "Primitives/primitive_gpu_commands.hpp"
|
||||
#include "Primitives/primitive_line_types.hpp"
|
||||
#include "Primitives/primitive_rectangle_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__
|
Reference in New Issue
Block a user