mirror of
https://github.com/Kapendev/parin.git
synced 2025-04-26 13:09:56 +03:00
A lot of changes because I made a game with it and have better ideas now.
This commit is contained in:
parent
2c42a383e6
commit
9e09d4199e
20 changed files with 378 additions and 953 deletions
4
TODO.md
4
TODO.md
|
@ -1,15 +1,11 @@
|
|||
# NOW
|
||||
|
||||
* Add commands and checks in dialogue system.
|
||||
* Clean up dialogue system and dialogue example.
|
||||
* Test engine on Windows.
|
||||
|
||||
# TODO
|
||||
|
||||
* Clean strconv module.
|
||||
* Combine strconv with other str modules.
|
||||
* Test str modules and add unicode support.
|
||||
* Fix SumType to work with generic types.
|
||||
* Work on UI.
|
||||
* Collision functionality must be implemented.
|
||||
* Add more parsing options for fmt.d and strconv.d.
|
||||
|
|
106
core/ascii.d
106
core/ascii.d
|
@ -1,106 +0,0 @@
|
|||
// Copyright 2024 Alexandros F. G. Kapretsos
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// The ascii module assists in handling ASCII characters.
|
||||
|
||||
module popka.core.ascii;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
enum {
|
||||
digitChars = "0123456789",
|
||||
upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
lowerChars = "abcdefghijklmnopqrstuvwxyz",
|
||||
alphaChars = upperChars ~ lowerChars,
|
||||
spaceChars = " \t\v\r\n\f",
|
||||
}
|
||||
|
||||
bool isDigit(char c) {
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
bool isDigit(const(char)[] str) {
|
||||
foreach (c; str) {
|
||||
if (!isDigit(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isUpper(char c) {
|
||||
return c >= 'A' && c <= 'Z';
|
||||
}
|
||||
|
||||
bool isUpper(const(char)[] str) {
|
||||
foreach (c; str) {
|
||||
if (!isUpper(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isLower(char c) {
|
||||
return c >= 'a' && c <= 'z';
|
||||
}
|
||||
|
||||
bool isLower(const(char)[] str) {
|
||||
foreach (c; str) {
|
||||
if (!isLower(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isAlpha(char c) {
|
||||
return isLower(c) || isUpper(c);
|
||||
}
|
||||
|
||||
bool isAlpha(const(char)[] str) {
|
||||
foreach (c; str) {
|
||||
if (!isAlpha(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isSpace(char c) {
|
||||
foreach (sc; spaceChars) {
|
||||
if (c == sc) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isSpace(const(char)[] str) {
|
||||
foreach (c; str) {
|
||||
if (!isSpace(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
char toDigit(char c) {
|
||||
return isDigit(c) ? cast(char) (c - 48) : '0';
|
||||
}
|
||||
|
||||
void toDigit(char[] str) {
|
||||
foreach (ref c; str) {
|
||||
c = toDigit(c);
|
||||
}
|
||||
}
|
||||
|
||||
char toUpper(char c) {
|
||||
return isLower(c) ? cast(char) (c - 32) : c;
|
||||
}
|
||||
|
||||
void toUpper(char[] str) {
|
||||
foreach (ref c; str) {
|
||||
c = toUpper(c);
|
||||
}
|
||||
}
|
||||
|
||||
char toLower(char c) {
|
||||
return isUpper(c) ? cast(char) (c + 32) : c;
|
||||
}
|
||||
|
||||
void toLower(char[] str) {
|
||||
foreach (ref c; str) {
|
||||
c = toLower(c);
|
||||
}
|
||||
}
|
||||
|
||||
unittest {}
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
module popka.core.basic;
|
||||
|
||||
public import popka.core.ascii;
|
||||
public import popka.core.color;
|
||||
public import popka.core.container;
|
||||
public import popka.core.fmt;
|
||||
|
@ -14,8 +13,3 @@ public import popka.core.io;
|
|||
public import popka.core.math;
|
||||
public import popka.core.strconv;
|
||||
public import popka.core.strutils;
|
||||
public import popka.core.sumtype;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
unittest {}
|
||||
|
|
29
core/color.d
29
core/color.d
|
@ -1,26 +1,23 @@
|
|||
// Copyright 2024 Alexandros F. G. Kapretsos
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// The color module specializes in handling color-related operations,
|
||||
/// offering a suite of procedures tailored for manipulating and managing color properties within a program.
|
||||
/// The color module specializes in handling color-related operations.
|
||||
|
||||
module popka.core.color;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
enum {
|
||||
blank = Color(),
|
||||
black = Color(0),
|
||||
darkGray = Color(40),
|
||||
lightGray = Color(220),
|
||||
white = Color(255),
|
||||
red = Color(255, 0, 0),
|
||||
green = Color(0, 255, 0),
|
||||
blue = Color(0, 0, 255),
|
||||
yellow = Color(255, 255, 0),
|
||||
magenta = Color(255, 0, 255),
|
||||
cyan = Color(0, 255, 255),
|
||||
}
|
||||
enum blank = Color();
|
||||
enum black = Color(0);
|
||||
enum darkGray = Color(40);
|
||||
enum lightGray = Color(220);
|
||||
enum white = Color(255);
|
||||
enum red = Color(255, 0, 0);
|
||||
enum green = Color(0, 255, 0);
|
||||
enum blue = Color(0, 0, 255);
|
||||
enum yellow = Color(255, 255, 0);
|
||||
enum magenta = Color(255, 0, 255);
|
||||
enum cyan = Color(0, 255, 255);
|
||||
|
||||
struct Color {
|
||||
ubyte r;
|
||||
|
@ -49,5 +46,3 @@ struct Color {
|
|||
this(rgba[0], rgba[1], rgba[2], rgba[3]);
|
||||
}
|
||||
}
|
||||
|
||||
unittest {}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright 2024 Alexandros F. G. Kapretsos
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// The container module serves as a hub for various data structures,
|
||||
/// offering a cohesive set of tools for efficient storage and retrieval of information within a program.
|
||||
/// The container module serves as a hub for various data structures.
|
||||
|
||||
module popka.core.container;
|
||||
|
||||
|
@ -426,5 +425,3 @@ struct Grid(T) {
|
|||
colCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
unittest {}
|
||||
|
|
|
@ -50,5 +50,3 @@ void writeText(const(char)[] path, List!char content) {
|
|||
io.fclose(f);
|
||||
content.pop();
|
||||
}
|
||||
|
||||
unittest {}
|
||||
|
|
15
core/math.d
15
core/math.d
|
@ -1,7 +1,8 @@
|
|||
// Copyright 2024 Alexandros F. G. Kapretsos
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// The math module covers essential mathematical operations, vectors, and shapes like rectangles.
|
||||
/// The math module covers
|
||||
/// essential mathematical operations, vectors, and shapes.
|
||||
|
||||
module popka.core.math;
|
||||
|
||||
|
@ -9,6 +10,8 @@ import math = core.stdc.math;
|
|||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
enum pi = 3.141592f;
|
||||
|
||||
enum Hook : ubyte {
|
||||
topLeft, top, topRight,
|
||||
left, center, right,
|
||||
|
@ -467,6 +470,14 @@ float sqrt(float x) {
|
|||
return math.sqrtf(x);
|
||||
}
|
||||
|
||||
float sin(float x) {
|
||||
return math.sinf(x);
|
||||
}
|
||||
|
||||
float cos(float x) {
|
||||
return math.cosf(x);
|
||||
}
|
||||
|
||||
float lerp(float from, float to, float weight) {
|
||||
return from + (to - from) * weight;
|
||||
}
|
||||
|
@ -490,5 +501,3 @@ float moveTo(float from, float to, float delta, float slowdown) {
|
|||
float target = ((from * (slowdown - 1.0f)) + to) / slowdown;
|
||||
return from + (target - from) * delta;
|
||||
}
|
||||
|
||||
unittest {}
|
||||
|
|
165
core/strconv.d
165
core/strconv.d
|
@ -7,11 +7,10 @@
|
|||
|
||||
module popka.core.strconv;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
import popka.core.strutils;
|
||||
import popka.core.traits;
|
||||
|
||||
struct ToStrOptions {
|
||||
uint floatPrecision = 2;
|
||||
}
|
||||
@safe @nogc nothrow:
|
||||
|
||||
enum ToValueResultError : ubyte {
|
||||
none,
|
||||
|
@ -19,29 +18,40 @@ enum ToValueResultError : ubyte {
|
|||
overflow,
|
||||
}
|
||||
|
||||
struct ToStrOptions {
|
||||
ubyte floatPrecision = 2;
|
||||
}
|
||||
|
||||
struct ToValueResult(T) {
|
||||
T value;
|
||||
ToValueResultError error;
|
||||
}
|
||||
|
||||
const(char)[] boolToStr(bool value) {
|
||||
static char[64] buf = void;
|
||||
auto result = buf[];
|
||||
const(char)[] charToStr(char value) {
|
||||
static char[1] buffer = void;
|
||||
auto result = buffer[];
|
||||
|
||||
result[0] = value;
|
||||
result = result[0 .. 1];
|
||||
return result;
|
||||
}
|
||||
|
||||
const(char)[] boolToStr(bool value) {
|
||||
static char[8] buffer = void;
|
||||
|
||||
auto result = buffer[];
|
||||
if (value) {
|
||||
result[0 .. 4] = "true";
|
||||
result = result[0 .. 4];
|
||||
result.copyStr("true");
|
||||
} else {
|
||||
result[0 .. 5] = "false";
|
||||
result = result[0 .. 5];
|
||||
result.copyStr("false");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const(char)[] unsignedToStr(ulong value) {
|
||||
static char[64] buf = void;
|
||||
auto result = buf[];
|
||||
static char[64] buffer = void;
|
||||
|
||||
auto result = buffer[];
|
||||
if (value == 0) {
|
||||
result[0] = '0';
|
||||
result = result[0 .. 1];
|
||||
|
@ -57,30 +67,24 @@ const(char)[] unsignedToStr(ulong value) {
|
|||
}
|
||||
|
||||
const(char)[] signedToStr(long value) {
|
||||
static char[64] buf = void;
|
||||
auto result = buf[];
|
||||
static char[64] buffer = void;
|
||||
|
||||
auto result = buffer[];
|
||||
if (value < 0) {
|
||||
auto temp = unsignedToStr(-value);
|
||||
result[0] = '-';
|
||||
foreach (i, c; temp) {
|
||||
result[1 + i] = c;
|
||||
}
|
||||
result = result[0 .. 1 + temp.length];
|
||||
result.copyStr(temp, 1);
|
||||
} else {
|
||||
auto temp = unsignedToStr(value);
|
||||
foreach (i, c; temp) {
|
||||
result[i] = c;
|
||||
}
|
||||
result = result[0 .. temp.length];
|
||||
result.copyStr(temp, 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const(char)[] floatToStr(double value, uint precision = 2) {
|
||||
static char[64] buf = void;
|
||||
auto result = buf[];
|
||||
const(char)[] doubleToStr(double value, uint precision = 2) {
|
||||
static char[64] buffer = void;
|
||||
|
||||
auto result = buffer[];
|
||||
auto fractionalDigitCount = 0;
|
||||
auto cleanNumber = value;
|
||||
while (cleanNumber != cast(double) (cast(long) cleanNumber)) {
|
||||
|
@ -93,9 +97,7 @@ const(char)[] floatToStr(double value, uint precision = 2) {
|
|||
|
||||
if (temp.length <= fractionalDigitCount) {
|
||||
i -= temp.length;
|
||||
foreach (ii, c; temp) {
|
||||
result[i + ii] = c;
|
||||
}
|
||||
result.copyStrChars(temp, i);
|
||||
if (temp.length < fractionalDigitCount) {
|
||||
i -= fractionalDigitCount - temp.length;
|
||||
result[i .. i + fractionalDigitCount - temp.length] = '0';
|
||||
|
@ -110,20 +112,14 @@ const(char)[] floatToStr(double value, uint precision = 2) {
|
|||
i -= 1;
|
||||
result[i] = '.';
|
||||
i -= temp.length;
|
||||
foreach (ii, c; temp) {
|
||||
result[i + ii] = c;
|
||||
}
|
||||
result.copyStrChars(temp, i);
|
||||
} else {
|
||||
i -= fractionalDigitCount;
|
||||
foreach (ii, c; temp[$ - fractionalDigitCount .. $]) {
|
||||
result[i + ii] = c;
|
||||
}
|
||||
result.copyStrChars(temp[$ - fractionalDigitCount .. $], i);
|
||||
i -= 1;
|
||||
result[i] = '.';
|
||||
i -= (temp.length - fractionalDigitCount);
|
||||
foreach (ii, c; temp[0 .. $ - fractionalDigitCount]) {
|
||||
result[i + ii] = c;
|
||||
}
|
||||
result.copyStrChars(temp[0 .. $ - fractionalDigitCount], i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,26 +131,18 @@ const(char)[] floatToStr(double value, uint precision = 2) {
|
|||
return result;
|
||||
}
|
||||
|
||||
const(char)[] charToStr(char value) {
|
||||
static char[1] buf = void;
|
||||
auto result = buf[];
|
||||
|
||||
result[0] = value;
|
||||
result = result[0 .. 1];
|
||||
return result;
|
||||
}
|
||||
|
||||
const(char)[] enumToStr(T)(T value) {
|
||||
static char[128] buf = void;
|
||||
auto result = buf[];
|
||||
static char[64] buffer = void;
|
||||
|
||||
auto result = buffer[];
|
||||
auto name = "";
|
||||
final switch (value) {
|
||||
static foreach (member; __traits(allMembers, T)) {
|
||||
mixin("case T." ~ member ~ ": name = member; goto exitSwitchEarly;");
|
||||
mixin("case T." ~ member ~ ": name = member; goto switchExit;");
|
||||
}
|
||||
}
|
||||
exitSwitchEarly:
|
||||
switchExit:
|
||||
|
||||
foreach (i, c; name) {
|
||||
result[i] = c;
|
||||
}
|
||||
|
@ -164,9 +152,9 @@ const(char)[] enumToStr(T)(T value) {
|
|||
|
||||
@trusted
|
||||
const(char)[] strzToStr(const(char)* value) {
|
||||
static char[1024] buf = void;
|
||||
auto result = buf[];
|
||||
static char[1024] buffer = void;
|
||||
|
||||
auto result = buffer[];
|
||||
size_t strzLength = 0;
|
||||
while (value[strzLength] != '\0') {
|
||||
result[strzLength] = value[strzLength];
|
||||
|
@ -176,38 +164,25 @@ const(char)[] strzToStr(const(char)* value) {
|
|||
return result;
|
||||
}
|
||||
|
||||
const(char)[] strToStr(const(char)[] value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
const(char)[] toStr(T)(T value, ToStrOptions options = ToStrOptions()) {
|
||||
enum isBool = is(T == bool);
|
||||
enum isUnsigned = is(T == ubyte) || is(T == ushort) || is(T == uint) || is(T == ulong);
|
||||
enum isSigned = is(T == byte) || is(T == short) || is(T == int) || is(T == long);
|
||||
enum isFloat = is(T == float) || is(T == double);
|
||||
enum isChar = is(T == char) || is(T == const(char)) || is(T == immutable(char));
|
||||
enum isEnum = is(T == enum);
|
||||
enum isStrz = is(T : const(char)*);
|
||||
enum isStr = is(T : const(char)[]);
|
||||
|
||||
static if (isBool) {
|
||||
return boolToStr(value);
|
||||
} else static if (isUnsigned) {
|
||||
return unsignedToStr(value);
|
||||
} else static if (isSigned) {
|
||||
return signedToStr(value);
|
||||
} else static if (isFloat) {
|
||||
return floatToStr(value, options.floatPrecision);
|
||||
} else static if (isChar) {
|
||||
static if (isChar!T) {
|
||||
return charToStr(value);
|
||||
} else static if (isEnum) {
|
||||
return enumToStr(value);
|
||||
} else static if (isStrz) {
|
||||
} else static if (isBool!T) {
|
||||
return boolToStr(value);
|
||||
} else static if (isUnsigned!T) {
|
||||
return unsignedToStr(value);
|
||||
} else static if (isSigned!T) {
|
||||
return signedToStr(value);
|
||||
} else static if (isDouble!T) {
|
||||
return doubleToStr(value, options.floatPrecision);
|
||||
} else static if (isStr!T) {
|
||||
return value;
|
||||
} else static if (isStrz!T) {
|
||||
return strzToStr(value);
|
||||
} else static if (isStr) {
|
||||
return strToStr(value);
|
||||
} else static if (isEnum!T) {
|
||||
return enumToStr(value);
|
||||
} else {
|
||||
static assert(0, "The 'toStr' function exclusively handles numerical valueues, booleans, characters and strings.");
|
||||
static assert(0, "The 'toStr' function doesn't handle this type.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,7 +245,7 @@ ToValueResult!long toSigned(const(char)[] str) {
|
|||
return result;
|
||||
}
|
||||
|
||||
ToValueResult!double toFloat(const(char)[] str) {
|
||||
ToValueResult!double toDouble(const(char)[] str) {
|
||||
auto result = ToValueResult!double();
|
||||
result.value = 0.0;
|
||||
auto hasDot = false;
|
||||
|
@ -301,20 +276,32 @@ ToValueResult!double toFloat(const(char)[] str) {
|
|||
return result;
|
||||
}
|
||||
|
||||
T toEnum(T)(const(char)[] str) {
|
||||
ToValueResult!T toEnum(T)(const(char)[] str) {
|
||||
auto result = ToValueResult!T();
|
||||
switch (str) {
|
||||
static foreach (member; __traits(allMembers, T)) {
|
||||
mixin("case " ~ member.stringof ~ ": return T." ~ member ~ ";");
|
||||
mixin("case " ~ member.stringof ~ ": result.value = T." ~ member ~ "; goto switchExit;");
|
||||
}
|
||||
default: return T.init;
|
||||
default: result.error = ToValueResultError.invalid;
|
||||
}
|
||||
switchExit:
|
||||
return result;
|
||||
}
|
||||
|
||||
T toEnumWithNone(T)(const(char)[] str) {
|
||||
auto conv = toEnum!T(str);
|
||||
if (conv.error) {
|
||||
return T.init;
|
||||
} else {
|
||||
return conv.value;
|
||||
}
|
||||
}
|
||||
|
||||
@trusted
|
||||
const(char)* toStrz(const(char)[] str) {
|
||||
static char[1024] buf = void;
|
||||
auto result = buf[];
|
||||
static char[1024] buffer = void;
|
||||
|
||||
auto result = buffer[];
|
||||
foreach (i, c; str) {
|
||||
result[i] = c;
|
||||
}
|
||||
|
@ -324,12 +311,12 @@ const(char)* toStrz(const(char)[] str) {
|
|||
|
||||
unittest {
|
||||
auto text1 = "1.0";
|
||||
auto conv1 = toFloat(text1);
|
||||
auto conv1 = toDouble(text1);
|
||||
assert(conv1.value == 1.0);
|
||||
assert(conv1.error == ToValueResultError.none);
|
||||
|
||||
auto text2 = "1";
|
||||
auto conv2 = toFloat(text2);
|
||||
auto conv2 = toDouble(text2);
|
||||
assert(conv2.value == 0.0);
|
||||
assert(conv2.error == ToValueResultError.invalid);
|
||||
}
|
||||
|
|
132
core/strutils.d
132
core/strutils.d
|
@ -1,23 +1,116 @@
|
|||
// Copyright 2024 Alexandros F. G. Kapretsos
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// The strutils module contains handy procedures designed to assist with various string manipulation tasks.
|
||||
/// The strutils module contains procedures
|
||||
/// designed to assist with various string manipulation tasks.
|
||||
|
||||
module popka.core.strutils;
|
||||
|
||||
import popka.core.ascii;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
enum digitChars = "0123456789";
|
||||
enum upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
enum lowerChars = "abcdefghijklmnopqrstuvwxyz";
|
||||
enum alphaChars = upperChars ~ lowerChars;
|
||||
enum spaceChars = " \t\v\r\n\f";
|
||||
|
||||
bool isStrz(const(char)[] str) {
|
||||
return str.length != 0 && str[$ - 1] == '\0';
|
||||
}
|
||||
|
||||
bool isDigit(char c) {
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
bool isDigit(const(char)[] str) {
|
||||
foreach (c; str) {
|
||||
if (!isDigit(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isUpper(char c) {
|
||||
return c >= 'A' && c <= 'Z';
|
||||
}
|
||||
|
||||
bool isUpper(const(char)[] str) {
|
||||
foreach (c; str) {
|
||||
if (!isUpper(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isLower(char c) {
|
||||
return c >= 'a' && c <= 'z';
|
||||
}
|
||||
|
||||
bool isLower(const(char)[] str) {
|
||||
foreach (c; str) {
|
||||
if (!isLower(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isAlpha(char c) {
|
||||
return isLower(c) || isUpper(c);
|
||||
}
|
||||
|
||||
bool isAlpha(const(char)[] str) {
|
||||
foreach (c; str) {
|
||||
if (!isAlpha(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isSpace(char c) {
|
||||
foreach (sc; spaceChars) {
|
||||
if (c == sc) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isSpace(const(char)[] str) {
|
||||
foreach (c; str) {
|
||||
if (!isSpace(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
char toDigit(char c) {
|
||||
return isDigit(c) ? cast(char) (c - 48) : '?';
|
||||
}
|
||||
|
||||
void toDigit(char[] str) {
|
||||
foreach (ref c; str) {
|
||||
c = toDigit(c);
|
||||
}
|
||||
}
|
||||
|
||||
char toUpper(char c) {
|
||||
return isLower(c) ? cast(char) (c - 32) : c;
|
||||
}
|
||||
|
||||
void toUpper(char[] str) {
|
||||
foreach (ref c; str) {
|
||||
c = toUpper(c);
|
||||
}
|
||||
}
|
||||
|
||||
char toLower(char c) {
|
||||
return isUpper(c) ? cast(char) (c + 32) : c;
|
||||
}
|
||||
|
||||
void toLower(char[] str) {
|
||||
foreach (ref c; str) {
|
||||
c = toLower(c);
|
||||
}
|
||||
}
|
||||
|
||||
bool equals(const(char)[] str, const(char)[] other) {
|
||||
return str == other;
|
||||
}
|
||||
|
||||
bool equalsi(const(char)[] str, const(char)[] other) {
|
||||
bool equalsCaseInsensitive(const(char)[] str, const(char)[] other) {
|
||||
if (str.length != other.length) return false;
|
||||
foreach (i; 0 .. str.length) {
|
||||
if (toUpper(str[i]) != toUpper(other[i])) return false;
|
||||
|
@ -30,7 +123,7 @@ bool startsWith(const(char)[] str, const(char)[] start) {
|
|||
return str[0 .. start.length] == start;
|
||||
}
|
||||
|
||||
bool startsWithi(const(char)[] str, const(char)[] start) {
|
||||
bool startsWithCaseInsensitive(const(char)[] str, const(char)[] start) {
|
||||
if (str.length < start.length) return false;
|
||||
foreach (i; 0 .. start.length) {
|
||||
if (toUpper(str[i]) != toUpper(start[i])) return false;
|
||||
|
@ -43,7 +136,7 @@ bool endsWith(const(char)[] str, const(char)[] end) {
|
|||
return str[$ - end.length - 1 .. end.length] == end;
|
||||
}
|
||||
|
||||
bool endsWithi(const(char)[] str, const(char)[] end) {
|
||||
bool endsWithCaseInsensitive(const(char)[] str, const(char)[] end) {
|
||||
if (str.length < end.length) return false;
|
||||
foreach (i; str.length - end.length - 1 .. end.length) {
|
||||
if (toUpper(str[i]) != toUpper(end[i])) return false;
|
||||
|
@ -63,11 +156,11 @@ int count(const(char)[] str, const(char)[] item) {
|
|||
return result;
|
||||
}
|
||||
|
||||
int counti(const(char)[] str, const(char)[] item) {
|
||||
int countCaseInsensitive(const(char)[] str, const(char)[] item) {
|
||||
int result = 0;
|
||||
if (str.length < item.length || item.length == 0) return result;
|
||||
foreach (i; 0 .. str.length - item.length) {
|
||||
if (equalsi(str[i .. i + item.length], item)) {
|
||||
if (equalsCaseInsensitive(str[i .. i + item.length], item)) {
|
||||
result += 1;
|
||||
i += item.length - 1;
|
||||
}
|
||||
|
@ -83,10 +176,10 @@ int findStart(const(char)[] str, const(char)[] item) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
int findStarti(const(char)[] str, const(char)[] item) {
|
||||
int findStartCaseInsensitive(const(char)[] str, const(char)[] item) {
|
||||
if (str.length < item.length || item.length == 0) return -1;
|
||||
foreach (i; 0 .. str.length - item.length) {
|
||||
if (equalsi(str[i + item.length .. item.length], item)) return cast(int) i;
|
||||
if (equalsCaseInsensitive(str[i + item.length .. item.length], item)) return cast(int) i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -99,10 +192,10 @@ int findEnd(const(char)[] str, const(char)[] item) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
int findEndi(const(char)[] str, const(char)[] item) {
|
||||
int findEndCaseInsensitive(const(char)[] str, const(char)[] item) {
|
||||
if (str.length < item.length || item.length == 0) return -1;
|
||||
foreach_reverse (i; 0 .. str.length - item.length) {
|
||||
if (equalsi(str[i + item.length .. item.length], item)) return cast(int) i;
|
||||
if (equalsCaseInsensitive(str[i + item.length .. item.length], item)) return cast(int) i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -129,7 +222,9 @@ const(char)[] trim(const(char)[] str) {
|
|||
return str.trimStart().trimEnd();
|
||||
}
|
||||
|
||||
const(char)[] skipValue(ref const(char)[] str, char sep = ',') {
|
||||
// TODO: Add sep that is a string.
|
||||
|
||||
const(char)[] skipValue(ref const(char)[] str, char sep) {
|
||||
foreach (i; 0 .. str.length) {
|
||||
if (str[i] == sep) {
|
||||
auto line = str[0 .. i];
|
||||
|
@ -148,4 +243,13 @@ const(char)[] skipLine(ref const(char)[] str) {
|
|||
return skipValue(str, '\n');
|
||||
}
|
||||
|
||||
unittest {}
|
||||
void copyStrChars(char[] str, const(char)[] source, size_t startIndex = 0) {
|
||||
foreach (i, c; source) {
|
||||
str[startIndex + i] = c;
|
||||
}
|
||||
}
|
||||
|
||||
void copyStr(ref char[] str, const(char)[] source, size_t startIndex = 0) {
|
||||
copyStrChars(str, source, startIndex);
|
||||
str = str[0 .. startIndex + source.length];
|
||||
}
|
||||
|
|
106
core/sumtype.d
106
core/sumtype.d
|
@ -1,106 +0,0 @@
|
|||
// Copyright 2024 Alexandros F. G. Kapretsos
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// The sumtype module defines a data structure that can hold one of several possible types.
|
||||
/// It provides functionalities to construct, access, and manipulate these values.
|
||||
|
||||
module popka.core.sumtype;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
struct None {}
|
||||
|
||||
union SumTypeData(A...) {
|
||||
static foreach (i, T; A) {
|
||||
mixin("T " ~ sumTypeDataMemberName!T ~ ";");
|
||||
}
|
||||
}
|
||||
|
||||
alias SumTypeKind = ushort;
|
||||
|
||||
/// A data structure that can hold one of several possible types.
|
||||
/// Note that generic types are not supported.
|
||||
struct SumType(A...) {
|
||||
SumTypeData!A data;
|
||||
SumTypeKind kind;
|
||||
alias data this;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
static foreach (i, T; A) {
|
||||
mixin("enum " ~ sumTypeKindMemberName!T ~ " = i;");
|
||||
}
|
||||
|
||||
static foreach (i, T; A) {
|
||||
@trusted
|
||||
this(T data) {
|
||||
this.data = *(cast(SumTypeData!A*) &data);
|
||||
this.kind = i;
|
||||
}
|
||||
}
|
||||
|
||||
static foreach (i, T; A) {
|
||||
@trusted
|
||||
void opAssign(T rhs) {
|
||||
data = *(cast(SumTypeData!A*) &rhs);
|
||||
kind = i;
|
||||
}
|
||||
}
|
||||
|
||||
auto call(string f, AA...)(AA args) {
|
||||
final switch (kind) {
|
||||
static foreach (i, T; A) {
|
||||
mixin("case " ~ i.stringof ~ ": return " ~ sumTypeDataMemberName!T ~ "." ~ f ~ "(args);");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
alias Optional(T) = SumType!(None, T);
|
||||
|
||||
bool isNone(A...)(SumType!A optional) {
|
||||
return optional.kind == 0;
|
||||
}
|
||||
|
||||
bool isSome(A...)(SumType!A optional) {
|
||||
return optional.kind != 0;
|
||||
}
|
||||
|
||||
bool hasCommonBase(T)() {
|
||||
static assert(is(T : SumType!A, A...), "Type '" ~ T.stringof ~ "' must be a sum type.");
|
||||
alias Base = typeof(T.init.data.tupleof[0]);
|
||||
static foreach (member; T.init.data.tupleof[1 .. $]) {
|
||||
static if (member.tupleof.length == 0) {
|
||||
return false;
|
||||
} else static if (!is(Base == typeof(member.tupleof[0]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template sumTypeMemberName(T) {
|
||||
mixin("enum sumTypeMemberName = \"" ~ ((T.stringof[0] >= 'A' && T.stringof[0] <= 'Z') ? cast(char) (T.stringof[0] + 32) : T.stringof[0]) ~ T.stringof[1 .. $] ~ "\";");
|
||||
}
|
||||
|
||||
template sumTypeDataMemberName(T) {
|
||||
mixin("enum sumTypeDataMemberName = \"" ~ sumTypeMemberName!T ~ "Data\";");
|
||||
}
|
||||
|
||||
template sumTypeKindMemberName(T) {
|
||||
mixin("enum sumTypeKindMemberName = \"" ~ sumTypeMemberName!T ~ "Kind\";");
|
||||
}
|
||||
|
||||
mixin template AddBase(T) {
|
||||
T base;
|
||||
alias base this;
|
||||
}
|
||||
|
||||
unittest {
|
||||
auto optional = Optional!int();
|
||||
assert(optional.isNone);
|
||||
optional = 69;
|
||||
assert(optional.isSome);
|
||||
optional = None();
|
||||
assert(optional.isNone);
|
||||
}
|
84
core/traits.d
Normal file
84
core/traits.d
Normal file
|
@ -0,0 +1,84 @@
|
|||
// Copyright 2024 Alexandros F. G. Kapretsos
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// The traits module provides compile-time procedures
|
||||
/// and enables features like type checking.
|
||||
|
||||
module popka.core.traits;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
bool isBool(T)() {
|
||||
return is(T == bool) ||
|
||||
is(T == const(bool)) ||
|
||||
is(T == immutable(bool));
|
||||
}
|
||||
|
||||
bool isUnsigned(T)() {
|
||||
return is(T == ubyte) ||
|
||||
is(T == const(ubyte)) ||
|
||||
is(T == immutable(ubyte)) ||
|
||||
is(T == ushort) ||
|
||||
is(T == const(ushort)) ||
|
||||
is(T == immutable(ushort)) ||
|
||||
is(T == uint) ||
|
||||
is(T == const(uint)) ||
|
||||
is(T == immutable(uint)) ||
|
||||
is(T == ulong) ||
|
||||
is(T == const(ulong)) ||
|
||||
is(T == immutable(ulong));
|
||||
}
|
||||
|
||||
bool isSigned(T)() {
|
||||
return is(T == byte) ||
|
||||
is(T == const(byte)) ||
|
||||
is(T == immutable(byte)) ||
|
||||
is(T == short) ||
|
||||
is(T == const(short)) ||
|
||||
is(T == immutable(short)) ||
|
||||
is(T == int) ||
|
||||
is(T == const(int)) ||
|
||||
is(T == immutable(int)) ||
|
||||
is(T == long) ||
|
||||
is(T == const(long)) ||
|
||||
is(T == immutable(long));
|
||||
}
|
||||
|
||||
bool isDouble(T)() {
|
||||
return is(T == float) ||
|
||||
is(T == const(float)) ||
|
||||
is(T == immutable(float)) ||
|
||||
is(T == double) ||
|
||||
is(T == const(double)) ||
|
||||
is(T == immutable(double));
|
||||
}
|
||||
|
||||
bool isChar(T)() {
|
||||
return is(T == char) ||
|
||||
is(T == const(char)) ||
|
||||
is(T == immutable(char));
|
||||
}
|
||||
|
||||
bool isStr(T)() {
|
||||
return is(T : const(char)[]);
|
||||
}
|
||||
|
||||
bool isStrz(T)() {
|
||||
return is(T : const(char)*);
|
||||
}
|
||||
|
||||
bool isPtr(T)() {
|
||||
return is(T : const(void)*);
|
||||
}
|
||||
|
||||
bool isSlice(T)() {
|
||||
return is(T : const(A)[], A);
|
||||
}
|
||||
|
||||
bool isEnum(T)() {
|
||||
return is(T == enum);
|
||||
}
|
||||
|
||||
bool isStruct(T)() {
|
||||
return is(T == struct);
|
||||
}
|
|
@ -4,12 +4,12 @@
|
|||
/// The basic module acts as a central hub,
|
||||
/// bundling together numerous specialized modules.
|
||||
|
||||
module popka.example.basic;
|
||||
module popka.examples.basic;
|
||||
|
||||
public import popka.example.camera;
|
||||
public import popka.example.coins;
|
||||
public import popka.example.dialogue;
|
||||
public import popka.example.hello;
|
||||
public import popka.examples.camera;
|
||||
public import popka.examples.coins;
|
||||
public import popka.examples.dialogue;
|
||||
public import popka.examples.hello;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
|
@ -19,5 +19,3 @@ void runEveryExample() {
|
|||
runCameraExample();
|
||||
runDialogueExample();
|
||||
}
|
||||
|
||||
unittest {}
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/// An example that shows how to use the camera structure.
|
||||
|
||||
module popka.example.camera;
|
||||
module popka.examples.camera;
|
||||
|
||||
import popka.basic;
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/// A collect-the-coins example.
|
||||
|
||||
module popka.example.coins;
|
||||
module popka.examples.coins;
|
||||
|
||||
import popka.basic;
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/// An example that shows how to use the dialogue system of Popka.
|
||||
|
||||
module popka.example.dialogue;
|
||||
module popka.examples.dialogue;
|
||||
|
||||
import popka.basic;
|
||||
|
||||
|
@ -18,11 +18,12 @@ void runDialogueExample() {
|
|||
auto script = "
|
||||
# This is a comment.
|
||||
|
||||
! loopCount
|
||||
* Menu
|
||||
^ Select first loop. ^ Select second loop. ^ End dialogue.
|
||||
! choiceCount
|
||||
|
||||
* Point1
|
||||
* menuPoint
|
||||
^ Select first choice. ^ Select second choice. ^ End dialogue.
|
||||
|
||||
* choice1
|
||||
> Bob
|
||||
| Hi.
|
||||
| My name is Bob.
|
||||
|
@ -30,16 +31,16 @@ void runDialogueExample() {
|
|||
| Hello!
|
||||
| Nice to meet you!
|
||||
| My name is Mia.
|
||||
+ loopCount
|
||||
@ Menu
|
||||
+ choiceCount
|
||||
@ menuPoint
|
||||
|
||||
* Point2
|
||||
* choice2
|
||||
> Bob
|
||||
| Yo Mia, this game is the bomb!
|
||||
> Mia
|
||||
| Trueee!
|
||||
+ loopCount
|
||||
@ Menu
|
||||
+ choiceCount
|
||||
@ menuPoint
|
||||
|
||||
* End
|
||||
";
|
||||
|
@ -55,7 +56,7 @@ void runDialogueExample() {
|
|||
if (dialogue.hasOptions) {
|
||||
auto digits = digitChars[1 .. 1 + dialogue.options.length];
|
||||
foreach (i, key; digits) {
|
||||
if (isPressed(key)) {
|
||||
if (key.isPressed) {
|
||||
dialogue.select(i);
|
||||
break;
|
||||
}
|
||||
|
@ -68,16 +69,13 @@ void runDialogueExample() {
|
|||
// Draw the game.
|
||||
if (dialogue.hasOptions) {
|
||||
foreach (i, option; dialogue.options) {
|
||||
drawDebugText("[{}] {}".fmt(i + 1, option), Vec2(8, 8 + i * 14));
|
||||
drawDebugText("{}. {}".fmt(i + 1, option), Vec2(8, 8 + i * 14));
|
||||
}
|
||||
} else if (dialogue.hasText) {
|
||||
drawDebugText("{}: {}".fmt(dialogue.actor, dialogue.text));
|
||||
} else {
|
||||
drawDebugText("The dialogue has ended.");
|
||||
}
|
||||
foreach (i, variable; dialogue.variables.items) {
|
||||
drawDebugText("{} = {}".fmt(variable.name.items, variable.value), Vec2(8, 8 + (i + 5) * 14));
|
||||
}
|
||||
drawRect(Rect(0, resolution.y * 0.75, resolution.x, resolution.y * 0.25), darkGray);
|
||||
drawDebugText(
|
||||
"Press a number to pick an option.\nPress space to continue.",
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/// A hello-world example.
|
||||
|
||||
module popka.example.hello;
|
||||
module popka.examples.hello;
|
||||
|
||||
import popka.basic;
|
||||
|
|
@ -8,7 +8,3 @@ module popka.game.basic;
|
|||
|
||||
public import popka.game.dialogue;
|
||||
public import popka.game.engine;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
unittest {}
|
||||
|
|
|
@ -326,5 +326,3 @@ bool isValidDialogueUnitKind(char c) {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
unittest {}
|
||||
|
|
102
game/engine.d
102
game/engine.d
|
@ -8,21 +8,16 @@ module popka.game.engine;
|
|||
|
||||
import ray = popka.vendor.ray.raylib;
|
||||
import raygl = popka.vendor.ray.rlgl;
|
||||
import popka.game.pixeloid;
|
||||
|
||||
public import popka.core.basic;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
PopkaState popkaState;
|
||||
Font popkaPixeloidFont;
|
||||
|
||||
enum {
|
||||
defaultFPS = 60,
|
||||
defaultBackgroundColor = Color(0x2A, 0x36, 0x3A),
|
||||
defaultDebugFontColor = lightGray,
|
||||
toggleFullscreenWaitTime = 0.125f,
|
||||
}
|
||||
enum defaultFPS = 60;
|
||||
enum defaultBackgroundColor = Color(0x2A, 0x36, 0x3A);
|
||||
enum toggleFullscreenWaitTime = 0.125f;
|
||||
|
||||
enum Flip : ubyte {
|
||||
none,
|
||||
|
@ -36,6 +31,32 @@ enum Filter : ubyte {
|
|||
linear,
|
||||
}
|
||||
|
||||
struct PopkaState {
|
||||
bool isWindowOpen;
|
||||
bool isDrawing;
|
||||
bool isFPSLocked;
|
||||
bool isCursorHidden;
|
||||
|
||||
Color backgroundColor;
|
||||
View view;
|
||||
Vec2 targetViewSize;
|
||||
bool isLockResolutionQueued;
|
||||
bool isUnlockResolutionQueued;
|
||||
|
||||
Vec2 lastWindowSize;
|
||||
float toggleFullscreenTimer = 0.0f;
|
||||
bool isToggleFullscreenQueued;
|
||||
}
|
||||
|
||||
struct DrawOptions {
|
||||
Vec2 scale = Vec2(1.0f);
|
||||
float rotation = 0.0f;
|
||||
Color color = white;
|
||||
Hook hook = Hook.topLeft;
|
||||
Flip flip = Flip.none;
|
||||
Filter filter = Filter.nearest;
|
||||
}
|
||||
|
||||
struct Sprite {
|
||||
ray.Texture2D data;
|
||||
|
||||
|
@ -59,8 +80,10 @@ struct Sprite {
|
|||
|
||||
void load(const(char)[] path) {
|
||||
free();
|
||||
if (path.length != 0) {
|
||||
data = ray.LoadTexture(toStrz(path));
|
||||
}
|
||||
}
|
||||
|
||||
void free() {
|
||||
if (!isEmpty) {
|
||||
|
@ -91,8 +114,10 @@ struct Font {
|
|||
@trusted
|
||||
void load(const(char)[] path, uint size, const(dchar)[] runes = []) {
|
||||
free();
|
||||
if (path.length != 0) {
|
||||
data = ray.LoadFontEx(toStrz(path), size, cast(int*) runes.ptr, cast(int) runes.length);
|
||||
}
|
||||
}
|
||||
|
||||
void free() {
|
||||
if (!isEmpty) {
|
||||
|
@ -162,8 +187,10 @@ struct AudioAsset {
|
|||
|
||||
void load(const(char)[] path) {
|
||||
free();
|
||||
if (path.length != 0) {
|
||||
ray.LoadMusicStream(toStrz(path));
|
||||
}
|
||||
}
|
||||
|
||||
void free() {
|
||||
if (!isEmpty) {
|
||||
|
@ -172,6 +199,10 @@ struct AudioAsset {
|
|||
}
|
||||
}
|
||||
|
||||
void update() {
|
||||
ray.UpdateMusicStream(data);
|
||||
}
|
||||
|
||||
void play() {
|
||||
ray.PlayMusicStream(data);
|
||||
}
|
||||
|
@ -210,6 +241,9 @@ struct TileMap {
|
|||
|
||||
void load(const(char)[] path) {
|
||||
free();
|
||||
if (path.length == 0) {
|
||||
return;
|
||||
}
|
||||
auto file = readText(path);
|
||||
const(char)[] view = file.items;
|
||||
while (view.length != 0) {
|
||||
|
@ -217,7 +251,7 @@ struct TileMap {
|
|||
rowCount += 1;
|
||||
colCount = 0;
|
||||
while (line.length != 0) {
|
||||
auto value = line.skipValue();
|
||||
auto value = line.skipValue(',');
|
||||
colCount += 1;
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +261,7 @@ struct TileMap {
|
|||
foreach (row; 0 .. rowCount) {
|
||||
auto line = view.skipLine();
|
||||
foreach (col; 0 .. colCount) {
|
||||
auto value = line.skipValue();
|
||||
auto value = line.skipValue(',');
|
||||
auto conv = value.toSigned();
|
||||
if (conv.error) {
|
||||
data[row, col] = cast(short) -1;
|
||||
|
@ -301,36 +335,6 @@ struct Camera {
|
|||
}
|
||||
}
|
||||
|
||||
struct DrawOptions {
|
||||
Vec2 scale = Vec2(1.0f);
|
||||
float rotation = 0.0f;
|
||||
Color color = white;
|
||||
Hook hook = Hook.topLeft;
|
||||
Flip flip = Flip.none;
|
||||
Filter filter = Filter.nearest;
|
||||
}
|
||||
|
||||
struct PopkaState {
|
||||
bool isWindowOpen;
|
||||
bool isDrawing;
|
||||
bool isFPSLocked;
|
||||
bool isCursorHidden;
|
||||
|
||||
Color backgroundColor;
|
||||
Font debugFont;
|
||||
Vec2 debugFontSpacing;
|
||||
DrawOptions debugFontOptions;
|
||||
|
||||
View view;
|
||||
Vec2 targetViewSize;
|
||||
bool isLockResolutionQueued;
|
||||
bool isUnlockResolutionQueued;
|
||||
|
||||
Vec2 lastWindowSize;
|
||||
float toggleFullscreenTimer = 0.0f;
|
||||
bool isToggleFullscreenQueued;
|
||||
}
|
||||
|
||||
enum Keyboard {
|
||||
a = ray.KEY_A,
|
||||
b = ray.KEY_B,
|
||||
|
@ -542,8 +546,6 @@ void openWindow(float width, float height, const(char)[] title = "Popka", Color
|
|||
popkaState.isWindowOpen = true;
|
||||
popkaState.backgroundColor = color;
|
||||
popkaState.lastWindowSize = Vec2(width, height);
|
||||
popkaState.debugFont = popkaFont;
|
||||
popkaState.debugFontOptions.color = defaultDebugFontColor;
|
||||
}
|
||||
|
||||
void closeWindow() {
|
||||
|
@ -557,7 +559,6 @@ void freeWindow() {
|
|||
popkaState.view.free();
|
||||
ray.CloseWindow();
|
||||
popkaState = PopkaState();
|
||||
popkaPixeloidFont = Font();
|
||||
}
|
||||
|
||||
bool isWindowOpen() {
|
||||
|
@ -758,16 +759,9 @@ Vec2 deltaMouse() {
|
|||
return toPopka(ray.GetMouseDelta());
|
||||
}
|
||||
|
||||
Font popkaFont() {
|
||||
if (popkaPixeloidFont.isEmpty) {
|
||||
popkaPixeloidFont = loadPixeloidFont();
|
||||
}
|
||||
return popkaPixeloidFont;
|
||||
}
|
||||
|
||||
Font rayFont() {
|
||||
auto result = toPopka(ray.GetFontDefault());
|
||||
result.spacing = Vec2(1.0f, 14.0f);
|
||||
result.spacing = Vec2(2.0f, 14.0f);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1003,6 +997,8 @@ void drawText(Font font, const(char)[] text, Vec2 position, DrawOptions options
|
|||
raygl.rlPopMatrix();
|
||||
}
|
||||
|
||||
void drawDebugText(const(char)[] text, Vec2 position = Vec2(8.0f)) {
|
||||
drawText(popkaState.debugFont, text, position, popkaState.debugFontOptions);
|
||||
void drawDebugText(const(char)[] text, Vec2 position = Vec2(8.0f, 8.0f)) {
|
||||
auto options = DrawOptions();
|
||||
options.color = lightGray;
|
||||
drawText(rayFont, text, position, options);
|
||||
}
|
||||
|
|
513
game/pixeloid.d
513
game/pixeloid.d
|
@ -1,513 +0,0 @@
|
|||
// Copyright 2024 Alexandros F. G. Kapretsos
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// FontAsCode exporter v1.0 - Font data exported as an array of bytes //
|
||||
// //
|
||||
// more info and bugs-report: github.com/raysan5/raylib //
|
||||
// feedback and support: ray[at]raylib.com //
|
||||
// //
|
||||
// Copyright (c) 2018-2023 Ramon Santamaria (@raysan5) //
|
||||
// //
|
||||
// ---------------------------------------------------------------------------------- //
|
||||
// //
|
||||
// TODO: Fill the information and license of the exported font here: //
|
||||
// //
|
||||
// Font name: Pixeloid //
|
||||
// Font creator: GGBotNet (https://ggbot.net/fonts/) //
|
||||
// Font LICENSE: SIL Open Font License //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The pixeloid module functions as a font that can be loaded from memory.
|
||||
/// It supports en, de and el characters.
|
||||
|
||||
module popka.game.pixeloid;
|
||||
|
||||
import ray = popka.vendor.ray.raylib;
|
||||
import popka.game.engine;
|
||||
|
||||
@safe @nogc nothrow:
|
||||
|
||||
enum pixeloidFontRunes = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~äöÜßΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκΛλΜμΝνΞξΟοΠπΡρΣσςΤτΥυΦφΧχΨψΩωʹ͵ͺ;΄΅·ΆΈΉΊΌΎΏΐΪΫάέήίΰϊϋόύώϔ";
|
||||
enum pixeloidFontCompressedDataSize = 1708;
|
||||
|
||||
/// Font image pixels data compressed (DEFLATE).
|
||||
/// NOTE: Original pixel data simplified to GRAYSCALE.
|
||||
immutable ubyte[pixeloidFontCompressedDataSize] pixeloidFontData = [
|
||||
0xed,
|
||||
0xdd, 0xc1, 0x72, 0xeb, 0x36, 0x10, 0x44, 0x51, 0xfc, 0xff, 0x4f, 0x77, 0x16, 0xd9, 0xa4, 0x2a, 0x16, 0xc0, 0x69, 0xf4,
|
||||
0x80, 0x90, 0x7d, 0x73, 0x36, 0x29, 0x3f, 0x5b, 0xa2, 0x38, 0x24, 0x48, 0x69, 0x5a, 0x80, 0x06, 0x00, 0x00, 0x40, 0x03,
|
||||
0x7d, 0xe1, 0xf6, 0xe9, 0x87, 0x9f, 0xe8, 0xc7, 0x9f, 0xfe, 0xad, 0xca, 0x69, 0xb2, 0xbf, 0xf4, 0xe1, 0x31, 0xf4, 0xe1,
|
||||
0x2f, 0x54, 0xd8, 0xfb, 0xb3, 0x9f, 0xab, 0xf0, 0x7b, 0xe7, 0xea, 0xaa, 0xe2, 0xbe, 0xf8, 0xfc, 0x9a, 0x55, 0xdc, 0xb3,
|
||||
0xb9, 0x23, 0x53, 0xa5, 0x7d, 0xa8, 0xc9, 0xef, 0xab, 0x50, 0x7f, 0x15, 0x2a, 0x5d, 0xf9, 0xcd, 0xda, 0x4f, 0x7b, 0xf6,
|
||||
0x9d, 0xbb, 0x6d, 0xf5, 0x47, 0xd3, 0xd1, 0x91, 0xbb, 0x3e, 0x2e, 0xcc, 0x2b, 0xaa, 0xed, 0x2d, 0xd4, 0xd6, 0xe3, 0x76,
|
||||
0x5e, 0x53, 0x9c, 0xa3, 0x50, 0x6d, 0x7b, 0xb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x4b, 0x95, 0xdc, 0xaf, 0x42, 0xdb, 0x99,
|
||||
0x9b, 0x6f, 0xea, 0x96, 0xfa, 0x3f, 0x59, 0xb7, 0xb0, 0xb3, 0xfe, 0xeb, 0xb5, 0x49, 0x3f, 0x8d, 0x4b, 0x3a, 0x5a, 0xff,
|
||||
0x73, 0xab, 0x85, 0x9e, 0xae, 0xbf, 0x3b, 0xfb, 0x92, 0xb3, 0xda, 0xa6, 0x33, 0x32, 0x24, 0x72, 0xdf, 0xef, 0xd5, 0x5f,
|
||||
0x5f, 0x5c, 0x7f, 0xef, 0x6e, 0xc8, 0xb9, 0x67, 0x53, 0x79, 0x86, 0x4d, 0xea, 0x9f, 0xc8, 0xff, 0x3e, 0x19, 0x69, 0x33,
|
||||
0xab, 0xed, 0xae, 0x9f, 0x65, 0xff, 0x5e, 0x72, 0x7f, 0x55, 0xde, 0x61, 0xae, 0x3b, 0xac, 0xf2, 0xbb, 0xe1, 0xfc, 0xfd,
|
||||
0xff, 0x3d, 0xdf, 0x7a, 0xd0, 0xd1, 0x7c, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0xf5, 0xef, 0x7f, 0xec, 0x07,
|
||||
0xea, 0x8f, 0x3f, 0x5b, 0xff, 0x7f, 0x00
|
||||
];
|
||||
|
||||
/// Font characters rectangles data.
|
||||
immutable ray.Rectangle[176] pixeloidFontRects = [
|
||||
ray.Rectangle( 4, 4, 3 , 11 ),
|
||||
ray.Rectangle( 15, 4, 1 , 8 ),
|
||||
ray.Rectangle( 24, 4, 3 , 3 ),
|
||||
ray.Rectangle( 35, 4, 5 , 8 ),
|
||||
ray.Rectangle( 48, 4, 5 , 9 ),
|
||||
ray.Rectangle( 61, 4, 5 , 8 ),
|
||||
ray.Rectangle( 74, 4, 5 , 8 ),
|
||||
ray.Rectangle( 87, 4, 1 , 3 ),
|
||||
ray.Rectangle( 96, 4, 3 , 9 ),
|
||||
ray.Rectangle( 107, 4, 3 , 9 ),
|
||||
ray.Rectangle( 118, 4, 3 , 4 ),
|
||||
ray.Rectangle( 129, 4, 3 , 3 ),
|
||||
ray.Rectangle( 140, 4, 1 , 2 ),
|
||||
ray.Rectangle( 149, 4, 3 , 1 ),
|
||||
ray.Rectangle( 160, 4, 1 , 1 ),
|
||||
ray.Rectangle( 169, 4, 5 , 8 ),
|
||||
ray.Rectangle( 182, 4, 5 , 8 ),
|
||||
ray.Rectangle( 195, 4, 5 , 8 ),
|
||||
ray.Rectangle( 208, 4, 5 , 8 ),
|
||||
ray.Rectangle( 221, 4, 5 , 8 ),
|
||||
ray.Rectangle( 234, 4, 5 , 8 ),
|
||||
ray.Rectangle( 4, 23, 5 , 8 ),
|
||||
ray.Rectangle( 17, 23, 5 , 8 ),
|
||||
ray.Rectangle( 30, 23, 5 , 8 ),
|
||||
ray.Rectangle( 43, 23, 5 , 8 ),
|
||||
ray.Rectangle( 56, 23, 5 , 8 ),
|
||||
ray.Rectangle( 69, 23, 1 , 5 ),
|
||||
ray.Rectangle( 78, 23, 1 , 6 ),
|
||||
ray.Rectangle( 87, 23, 3 , 5 ),
|
||||
ray.Rectangle( 98, 23, 3 , 3 ),
|
||||
ray.Rectangle( 109, 23, 3 , 5 ),
|
||||
ray.Rectangle( 120, 23, 5 , 8 ),
|
||||
ray.Rectangle( 133, 23, 5 , 8 ),
|
||||
ray.Rectangle( 146, 23, 5 , 8 ),
|
||||
ray.Rectangle( 159, 23, 5 , 8 ),
|
||||
ray.Rectangle( 172, 23, 5 , 8 ),
|
||||
ray.Rectangle( 185, 23, 5 , 8 ),
|
||||
ray.Rectangle( 198, 23, 5 , 8 ),
|
||||
ray.Rectangle( 211, 23, 5 , 8 ),
|
||||
ray.Rectangle( 224, 23, 5 , 8 ),
|
||||
ray.Rectangle( 237, 23, 5 , 8 ),
|
||||
ray.Rectangle( 4, 42, 3 , 8 ),
|
||||
ray.Rectangle( 15, 42, 4 , 8 ),
|
||||
ray.Rectangle( 27, 42, 5 , 8 ),
|
||||
ray.Rectangle( 40, 42, 5 , 8 ),
|
||||
ray.Rectangle( 53, 42, 8 , 8 ),
|
||||
ray.Rectangle( 69, 42, 6 , 8 ),
|
||||
ray.Rectangle( 83, 42, 5 , 8 ),
|
||||
ray.Rectangle( 96, 42, 5 , 8 ),
|
||||
ray.Rectangle( 109, 42, 5 , 8 ),
|
||||
ray.Rectangle( 122, 42, 5 , 8 ),
|
||||
ray.Rectangle( 135, 42, 5 , 8 ),
|
||||
ray.Rectangle( 148, 42, 5 , 8 ),
|
||||
ray.Rectangle( 161, 42, 5 , 8 ),
|
||||
ray.Rectangle( 174, 42, 5 , 8 ),
|
||||
ray.Rectangle( 187, 42, 8 , 8 ),
|
||||
ray.Rectangle( 203, 42, 5 , 8 ),
|
||||
ray.Rectangle( 216, 42, 5 , 8 ),
|
||||
ray.Rectangle( 229, 42, 5 , 8 ),
|
||||
ray.Rectangle( 242, 42, 3 , 9 ),
|
||||
ray.Rectangle( 4, 61, 5 , 8 ),
|
||||
ray.Rectangle( 17, 61, 3 , 9 ),
|
||||
ray.Rectangle( 28, 61, 5 , 4 ),
|
||||
ray.Rectangle( 41, 61, 3 , 1 ),
|
||||
ray.Rectangle( 52, 61, 2 , 2 ),
|
||||
ray.Rectangle( 62, 61, 5 , 5 ),
|
||||
ray.Rectangle( 75, 61, 5 , 8 ),
|
||||
ray.Rectangle( 88, 61, 5 , 5 ),
|
||||
ray.Rectangle( 101, 61, 5 , 8 ),
|
||||
ray.Rectangle( 114, 61, 5 , 5 ),
|
||||
ray.Rectangle( 127, 61, 3 , 8 ),
|
||||
ray.Rectangle( 138, 61, 5 , 7 ),
|
||||
ray.Rectangle( 151, 61, 5 , 8 ),
|
||||
ray.Rectangle( 164, 61, 1 , 8 ),
|
||||
ray.Rectangle( 173, 61, 4 , 9 ),
|
||||
ray.Rectangle( 185, 61, 4 , 8 ),
|
||||
ray.Rectangle( 197, 61, 1 , 8 ),
|
||||
ray.Rectangle( 206, 61, 8 , 5 ),
|
||||
ray.Rectangle( 222, 61, 5 , 5 ),
|
||||
ray.Rectangle( 235, 61, 5 , 5 ),
|
||||
ray.Rectangle( 4, 80, 5 , 7 ),
|
||||
ray.Rectangle( 17, 80, 5 , 7 ),
|
||||
ray.Rectangle( 30, 80, 4 , 5 ),
|
||||
ray.Rectangle( 42, 80, 5 , 5 ),
|
||||
ray.Rectangle( 55, 80, 3 , 8 ),
|
||||
ray.Rectangle( 66, 80, 5 , 5 ),
|
||||
ray.Rectangle( 79, 80, 5 , 5 ),
|
||||
ray.Rectangle( 92, 80, 8 , 5 ),
|
||||
ray.Rectangle( 108, 80, 5 , 5 ),
|
||||
ray.Rectangle( 121, 80, 5 , 7 ),
|
||||
ray.Rectangle( 134, 80, 5 , 5 ),
|
||||
ray.Rectangle( 147, 80, 4 , 9 ),
|
||||
ray.Rectangle( 159, 80, 1 , 9 ),
|
||||
ray.Rectangle( 168, 80, 4 , 9 ),
|
||||
ray.Rectangle( 180, 80, 5 , 3 ),
|
||||
ray.Rectangle( 193, 80, 5 , 8 ),
|
||||
ray.Rectangle( 206, 80, 5 , 8 ),
|
||||
ray.Rectangle( 219, 80, 5 , 9 ),
|
||||
ray.Rectangle( 232, 80, 5 , 8 ),
|
||||
ray.Rectangle( 4, 99, 5 , 8 ),
|
||||
ray.Rectangle( 17, 99, 5 , 5 ),
|
||||
ray.Rectangle( 30, 99, 5 , 8 ),
|
||||
ray.Rectangle( 43, 99, 4 , 9 ),
|
||||
ray.Rectangle( 55, 99, 5 , 8 ),
|
||||
ray.Rectangle( 68, 99, 5 , 6 ),
|
||||
ray.Rectangle( 81, 99, 5 , 8 ),
|
||||
ray.Rectangle( 94, 99, 4 , 8 ),
|
||||
ray.Rectangle( 106, 99, 5 , 8 ),
|
||||
ray.Rectangle( 119, 99, 4 , 5 ),
|
||||
ray.Rectangle( 131, 99, 5 , 8 ),
|
||||
ray.Rectangle( 144, 99, 4 , 9 ),
|
||||
ray.Rectangle( 156, 99, 5 , 8 ),
|
||||
ray.Rectangle( 169, 99, 5 , 6 ),
|
||||
ray.Rectangle( 182, 99, 5 , 8 ),
|
||||
ray.Rectangle( 195, 99, 5 , 5 ),
|
||||
ray.Rectangle( 208, 99, 3 , 8 ),
|
||||
ray.Rectangle( 219, 99, 1 , 5 ),
|
||||
ray.Rectangle( 228, 99, 5 , 8 ),
|
||||
ray.Rectangle( 241, 99, 4 , 5 ),
|
||||
ray.Rectangle( 4, 118, 5 , 8 ),
|
||||
ray.Rectangle( 17, 118, 4 , 8 ),
|
||||
ray.Rectangle( 29, 118, 8 , 8 ),
|
||||
ray.Rectangle( 45, 118, 5 , 6 ),
|
||||
ray.Rectangle( 58, 118, 6 , 8 ),
|
||||
ray.Rectangle( 72, 118, 5 , 5 ),
|
||||
ray.Rectangle( 85, 118, 5 , 8 ),
|
||||
ray.Rectangle( 98, 118, 4 , 9 ),
|
||||
ray.Rectangle( 110, 118, 5 , 8 ),
|
||||
ray.Rectangle( 123, 118, 5 , 5 ),
|
||||
ray.Rectangle( 136, 118, 5 , 8 ),
|
||||
ray.Rectangle( 149, 118, 5 , 5 ),
|
||||
ray.Rectangle( 162, 118, 5 , 8 ),
|
||||
ray.Rectangle( 175, 118, 4 , 7 ),
|
||||
ray.Rectangle( 187, 118, 4 , 8 ),
|
||||
ray.Rectangle( 199, 118, 5 , 5 ),
|
||||
ray.Rectangle( 212, 118, 5 , 7 ),
|
||||
ray.Rectangle( 225, 118, 5 , 8 ),
|
||||
ray.Rectangle( 238, 118, 5 , 5 ),
|
||||
ray.Rectangle( 4, 137, 5 , 8 ),
|
||||
ray.Rectangle( 17, 137, 5 , 5 ),
|
||||
ray.Rectangle( 30, 137, 8 , 8 ),
|
||||
ray.Rectangle( 46, 137, 5 , 6 ),
|
||||
ray.Rectangle( 59, 137, 5 , 8 ),
|
||||
ray.Rectangle( 72, 137, 5 , 6 ),
|
||||
ray.Rectangle( 85, 137, 5 , 8 ),
|
||||
ray.Rectangle( 98, 137, 5 , 6 ),
|
||||
ray.Rectangle( 111, 137, 5 , 8 ),
|
||||
ray.Rectangle( 124, 137, 5 , 5 ),
|
||||
ray.Rectangle( 137, 137, 1 , 2 ),
|
||||
ray.Rectangle( 146, 137, 1 , 2 ),
|
||||
ray.Rectangle( 155, 137, 1 , 2 ),
|
||||
ray.Rectangle( 164, 137, 1 , 6 ),
|
||||
ray.Rectangle( 173, 137, 1 , 2 ),
|
||||
ray.Rectangle( 182, 137, 5 , 2 ),
|
||||
ray.Rectangle( 195, 137, 1 , 1 ),
|
||||
ray.Rectangle( 204, 137, 5 , 8 ),
|
||||
ray.Rectangle( 217, 137, 6 , 8 ),
|
||||
ray.Rectangle( 231, 137, 6 , 8 ),
|
||||
ray.Rectangle( 4, 156, 4 , 8 ),
|
||||
ray.Rectangle( 16, 156, 6 , 8 ),
|
||||
ray.Rectangle( 30, 156, 6 , 8 ),
|
||||
ray.Rectangle( 44, 156, 6 , 8 ),
|
||||
ray.Rectangle( 58, 156, 5 , 8 ),
|
||||
ray.Rectangle( 71, 156, 3 , 9 ),
|
||||
ray.Rectangle( 82, 156, 5 , 9 ),
|
||||
ray.Rectangle( 95, 156, 5 , 8 ),
|
||||
ray.Rectangle( 108, 156, 4 , 8 ),
|
||||
ray.Rectangle( 120, 156, 5 , 9 ),
|
||||
ray.Rectangle( 133, 156, 1 , 8 ),
|
||||
ray.Rectangle( 142, 156, 5 , 8 ),
|
||||
ray.Rectangle( 155, 156, 3 , 8 ),
|
||||
ray.Rectangle( 166, 156, 5 , 8 ),
|
||||
ray.Rectangle( 179, 156, 5 , 8 ),
|
||||
ray.Rectangle( 192, 156, 5 , 8 ),
|
||||
ray.Rectangle( 205, 156, 5 , 8 ),
|
||||
ray.Rectangle( 218, 156, 5 , 8 ),
|
||||
];
|
||||
|
||||
/// Font glyphs info data.
|
||||
/// NOTE: No glyphs.image data provided.
|
||||
immutable ray.GlyphInfo[176] pixeloidFontGlyphs = [
|
||||
ray.GlyphInfo( 32, 0, 9, 3, ray.Image() ),
|
||||
ray.GlyphInfo( 33, 0, 1, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 34, 0, 1, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 35, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 36, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 37, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 38, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 39, 0, 1, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 40, 0, 1, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 41, 0, 1, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 42, 0, 1, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 43, 0, 4, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 44, 0, 8, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 45, 0, 5, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 46, 0, 8, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 47, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 48, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 49, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 50, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 51, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 52, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 53, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 54, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 55, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 56, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 57, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 58, 0, 4, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 59, 0, 4, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 60, 0, 3, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 61, 0, 4, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 62, 0, 3, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 63, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 64, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 65, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 66, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 67, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 68, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 69, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 70, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 71, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 72, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 73, 0, 1, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 74, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 75, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 76, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 77, 0, 1, 8, ray.Image() ),
|
||||
ray.GlyphInfo( 78, 0, 1, 7, ray.Image() ),
|
||||
ray.GlyphInfo( 79, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 80, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 81, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 82, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 83, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 84, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 85, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 86, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 87, 0, 1, 8, ray.Image() ),
|
||||
ray.GlyphInfo( 88, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 89, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 90, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 91, 0, 1, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 92, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 93, 0, 1, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 94, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 95, 0, 9, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 96, 1, 0, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 97, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 98, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 99, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 100, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 101, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 102, 0, 1, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 103, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 104, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 105, 0, 1, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 106, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 107, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 108, 0, 1, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 109, 0, 4, 8, ray.Image() ),
|
||||
ray.GlyphInfo( 110, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 111, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 112, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 113, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 114, 0, 4, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 115, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 116, 0, 1, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 117, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 118, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 119, 0, 4, 8, ray.Image() ),
|
||||
ray.GlyphInfo( 120, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 121, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 122, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 123, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 124, 0, 1, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 125, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 126, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 228, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 246, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 220, 0, 0, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 223, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 913, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 945, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 914, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 946, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 915, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 947, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 916, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 948, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 917, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 949, 0, 4, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 918, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 950, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 919, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 951, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 920, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 952, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 921, 0, 1, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 953, 0, 4, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 922, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 954, 0, 4, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 923, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 955, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 924, 0, 1, 8, ray.Image() ),
|
||||
ray.GlyphInfo( 956, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 925, 0, 1, 7, ray.Image() ),
|
||||
ray.GlyphInfo( 957, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 926, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 958, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 927, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 959, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 928, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 960, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 929, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 961, 0, 4, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 931, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 963, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 962, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 932, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 964, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 933, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 965, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 934, 0, 1, 8, ray.Image() ),
|
||||
ray.GlyphInfo( 966, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 935, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 967, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 936, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 968, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 937, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 969, 0, 4, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 884, 0, 1, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 885, 0, 8, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 890, 0, 7, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 894, 0, 4, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 900, 0, 1, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 901, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 903, 0, 4, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 902, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 904, 0, 1, 7, ray.Image() ),
|
||||
ray.GlyphInfo( 905, 0, 1, 7, ray.Image() ),
|
||||
ray.GlyphInfo( 906, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 908, 0, 1, 7, ray.Image() ),
|
||||
ray.GlyphInfo( 910, 0, 1, 7, ray.Image() ),
|
||||
ray.GlyphInfo( 911, 0, 1, 7, ray.Image() ),
|
||||
ray.GlyphInfo( 912, -2, 1, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 938, 0, 0, 4, ray.Image() ),
|
||||
ray.GlyphInfo( 939, 0, 0, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 940, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 941, 0, 1, 5, ray.Image() ),
|
||||
ray.GlyphInfo( 942, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 943, 0, 1, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 944, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 970, -1, 1, 2, ray.Image() ),
|
||||
ray.GlyphInfo( 971, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 972, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 973, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 974, 0, 1, 6, ray.Image() ),
|
||||
ray.GlyphInfo( 980, 0, 1, 6, ray.Image() ),
|
||||
];
|
||||
|
||||
/// Font loading function.
|
||||
/// WARNING: This font data must not be unloaded.
|
||||
@trusted
|
||||
Font loadPixeloidFont() {
|
||||
Font result;
|
||||
ray.Font font = ray.Font();
|
||||
font.baseSize = 11;
|
||||
font.glyphCount = 176;
|
||||
font.glyphPadding = 4;
|
||||
// Custom font loading.
|
||||
// NOTE: Compressed font image data (DEFLATE), it requires DecompressData() function.
|
||||
int pixeloidFontDataSize = 0;
|
||||
ubyte* data = ray.DecompressData(cast(ubyte*) &pixeloidFontData, pixeloidFontCompressedDataSize, &pixeloidFontDataSize);
|
||||
ray.Image image = ray.Image( data, 256, 256, 1, 2 );
|
||||
// Load texture from image.
|
||||
font.texture = ray.LoadTextureFromImage(image);
|
||||
ray.UnloadImage(image); // Uncompressed data can be unloaded from memory.
|
||||
// Assign glyph recs and info data directly.
|
||||
// WARNING: This font data must not be unloaded.
|
||||
font.recs = cast(ray.Rectangle*) &pixeloidFontRects;
|
||||
font.glyphs = cast(ray.GlyphInfo*) &pixeloidFontGlyphs;
|
||||
result = toPopka(font);
|
||||
result.spacing = Vec2(1.0f, 14.0f);
|
||||
return result;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue