wooo stuff yay

This commit is contained in:
kin fuyuki 2026-02-20 02:29:05 -03:00
commit d1bb9d8c67
No known key found for this signature in database
GPG key ID: 0E4E8E519FB71401
91 changed files with 17403 additions and 42 deletions

View file

@ -1,6 +1,13 @@
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_FLAGS "-std=c++17 -g -Wno-error -O0")
if (DEFINED PLATFORMNAME)
SET(CURRPLATFORM ${PLATFORMNAME})
else ()
SET(CURRPLATFORM "linux-64")
endif (DEFINED PLATFORMNAME)
set(CMAKE_CXX_FLAGS "-std=c++26 -w -g -Wno-error -O0")
file(GLOB_RECURSE ENDLAUNCHER "src/*.cpp")
add_executable(endlauncher ${ENDLAUNCHER})
@ -9,9 +16,9 @@ set_target_properties(endlauncher PROPERTIES
)
target_link_directories(
endlauncher PUBLIC
"${CMAKE_SOURCE_DIR}/link")
"${CMAKE_SOURCE_DIR}/link/${PLATFORMNAME}")
target_link_libraries(endlauncher PRIVATE
"${CMAKE_SOURCE_DIR}/link/libenginend.so"
"${CMAKE_SOURCE_DIR}/link/${PLATFORMNAME}/libenginend.so"
curl zip
)
target_include_directories(endlauncher PUBLIC

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,020 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_FLAGS "-std=c++17 -Wno-error")
set(CMAKE_CXX_FLAGS "-std=c++26 -Wno-error -w")
file(GLOB_RECURSE FORESPEND_SOURCES CONFIGURE_DEPENDS "src/*.cpp")
add_executable(forespend ${FORESPEND_SOURCES})
if(NOT DEFINED ${ARCH})
@ -14,8 +14,8 @@ target_link_directories(
forespend PUBLIC
"${CMAKE_SOURCE_DIR}/link")
target_link_libraries(forespend PRIVATE
"${CMAKE_SOURCE_DIR}/link/libenginend.so"
"${CMAKE_SOURCE_DIR}/lib/raylib/${ARCH}/raylib/libraylib.a"
"${CMAKE_SOURCE_DIR}/link/${PLATFORMNAME}/libenginend.so"
"${CMAKE_SOURCE_DIR}/link/${PLATFORMNAME}/libraylib.a"
)
target_include_directories(forespend PUBLIC
${CMAKE_SOURCE_DIR}/include

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View file

@ -0,0 +1,18 @@
" name default player
S description
just a boring ass rectangle that does nothing special lmao
\
i spritew 16
i spriteh 32
f width 1.0
f height 2.0
f speed 1.0
f health 1.0
f radiores 1.0
f exhaustres 1.0
B singlesprite T
B 3dprerendered F
# 0 = 1 side 1 = 4 sides 2 = 8 sides (diagonal axes)
# 3 = 10 sides (top and down)
i directions 0
# defines

View file

@ -0,0 +1,31 @@
#comment
{ class
i id 1234
{ object
{ attributes
itemwithoutvalue
i number 1
h hex FF
b bin 1010
B booltrue T
B boolfalse F
f float 3.14
" text example
' character x
S textblock
line 1
line2
\
@ pointer class.id
}
#attributes
}
#object
}
#class

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
games/forespend/res/fonts/dos.ttf Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

View file

@ -0,0 +1,3 @@
o terrain
s 0

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
" type canidmonster
{ proccol
i r 255
i g 0
i b 255
}

View file

@ -0,0 +1,83 @@
#version 330
in vec2 fragTexCoord;
in vec4 fragColor;
out vec4 finalColor;
uniform sampler2D texture0;
uniform vec4 colDiffuse;
const float BITS=8.0;
uniform bool DITHER=false;
uniform bool DEPTH=true;
uniform bool BLOOM=true;
uniform bool BLUR=false;
uniform float redbits=4.;
uniform float greenbits=4.;
uniform float bluebits=3.;
uniform int bloomquality=3;
const mat4 ditherTable=mat4(-4.0,0.0,-3.0,1.0,2.0,-2.0,3.0,-1.0,-3.0,1.0,-4.0,0.0,3.0,-1.0,2.0,-2.0);
vec3 depth( vec3 col){
col.r+=0.01;
col.g-=0.02;
col.b+=0.01;
float r=exp2(redbits)-1.0;
float g=exp2(greenbits)-1.0;
float b=exp2(bluebits)-1.0;
col.r=mix(col.r+0.5/r,col.r*(1.0+0.5/r),0.0);
col.g=mix(col.g+0.5/g,col.g*(1.0+0.5/g),0.0);
col.b=mix(col.b+0.5/b,col.b*(1.0+0.5/b),0.0);
col=min(col,1.0);
col.r=floor(col.r*r)/r;
col.g=floor(col.g*g)/g;
col.b=floor(col.b*b)/b;
col.r-=0.01;
col.g+=0.02;
col.b-=0.01;
return col;
}
vec3 dither( vec3 col , vec2 coor){
col+=ditherTable[int(coor.x)%4][int(coor.y)%4]*0.005;
return col;
}
vec3 blur(vec3 col){
vec3 result=vec3(0.0);
float kernel[9]=float[](1.0,2.0,1.0,2.0,4.0,2.0,1.0,2.0,1.0);
int index=0;
vec2 texelSize=1.0/vec2(textureSize(texture0,0));
for(int y=-1;y<=1;y++){
for(int x=-1;x<=1;x++){
vec2 offset=vec2(float(x),float(y))*texelSize;
result+=texture(texture0,fragTexCoord+offset).rgb*(kernel[index]/2.);
index++;
}
}
return result/8.0;
}
vec3 bloom(vec3 col){
vec3 result=vec3(0.0);
vec2 texelSize=1.0/vec2(textureSize(texture0,0));
float threshold=0.8;
float kernel[9]=float[](1.0,2.0,1.0,2.0,4.0,2.0,1.0,2.0,1.0);
for(int y=-bloomquality;y<=bloomquality;y++){
for(int x=-bloomquality;x<=bloomquality;x++){
vec2 offset=vec2(float(x),float(y))*texelSize*2.0;
vec3 sample=texture(texture0,fragTexCoord+offset).rgb;
float brightness=dot(sample,vec3(0.299,0.587,0.114));
if(brightness>threshold){
float dist=length(vec2(x,y));
result+=sample*exp(-dist*0.5);
}
}
}
return col+result*0.05;
}
void main(){
vec2 coor=gl_FragCoord.xy;
vec3 c=texture(texture0,fragTexCoord).rgb;
if (DITHER) c=dither(c,coor);
if (DEPTH) c=depth(c);
if (BLUR) c=blur(c);
if (BLOOM) c=bloom(c);
finalColor.rgb=c;
finalColor.a=1.0;
}

View file

@ -0,0 +1,15 @@
#version 330
attribute vec3 vertexPosition;
attribute vec2 vertexTexCoord;
attribute vec4 vertexColor;
uniform mat4 mvp;
out vec2 fragTexCoord;
out vec4 fragColor;
void main()
{
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;
gl_Position = mvp * vec4(vertexPosition, 1.0);
}

View file

@ -0,0 +1,26 @@
#version 330 core
uniform int size; // 1024 for example
// Youll need a function that returns tile ID at (x, z)
int tileAt(int x, int z) {
// Your procedural logic here, e.g.:
// return (x + z) % 256;
// Replace with your actual tilegen
return (x + z) % 256;
}
out vec4 FragColor;
void main() {
ivec2 pix = ivec2(gl_FragCoord.xy) - ivec2(0, 0); // pixel coords
int x = pix.x;
int zBase = pix.y * 4;
int t0 = tileAt(x, zBase);
int t1 = tileAt(x, zBase + 1);
int t2 = tileAt(x, zBase + 2);
int t3 = tileAt(x, zBase + 3);
FragColor = vec4(t0, t1, t2, t3) / 255.0;
}

View file

@ -0,0 +1,128 @@
#version 330 core
in vec2 fragTexCoord;
in vec3 normal;
in vec3 pos;
uniform vec3 campos;
uniform sampler2D tilemap;
uniform sampler2D tilesheet;
uniform vec2 size;
uniform int cols;
uniform vec4 fragColor;
out vec4 FragColor;
float dist;
vec3 n=normalize(normal);
bool lava=false;
vec4 directional(vec4 c){
float mult;
if ((pos.y>=0.98))return c;
float fac=pos.y/2+0.5;
if(abs(n.y)>abs(n.x)&&abs(n.y)>abs(n.z)){
mult=(n.y>0.0)?1.0:pos.y;
}else if(abs(n.x)>abs(n.y)&&abs(n.x)>abs(n.z)){
mult=(n.x>0.0)?fac+.2:fac+0.3;
}else{
mult=(n.z>0.0)?fac+.45:fac+0.1;
}
vec3 c2=c.rgb;
return vec4(c2*mult,c.a);
}
vec4 white(){
return vec4(1.0,1.0,1.0,1.0);
}
vec4 textured(){
float minus=1./1024;
float tile = texture(tilemap, fragTexCoord).r;
int idx = int(tile * 255.0);
bool terrain=idx<=250;
if (pos.y>1.0){ //top
if (!terrain){
discard;
return vec4(0.0,0.0,0.0,0.0);
}
}
else if (pos.y>0.0){ //walls
float previousx=texture(tilemap, vec2(fragTexCoord.x-minus,fragTexCoord.y)).r;
float previousz=texture(tilemap, vec2(fragTexCoord.x,fragTexCoord.y-minus)).r;
int previousxidx = int(previousx * 255.0);
int previouszidx = int(previousz * 255.0);
bool prevxidx=previousxidx<245;
bool prevzidx=previouszidx<245;
bool isterrain=1!=1;
bool negx=abs(n.x) > abs(n.y) && abs(n.x) > abs(n.z);
bool negz=abs(n.z) > abs(n.x) && abs(n.z) > abs(n.y);
if (prevxidx&&negx&&!(idx<245)) { // forces outer on -x
isterrain=prevxidx;
idx=previousxidx;
}else if (prevzidx&&negz&&!(idx<245)) { // forces outer on -z
isterrain=prevzidx;
idx=previouszidx;
}
if (!isterrain){
if (
(negx&&!prevxidx)
|| (negz&&!prevzidx)
)
isterrain=(idx<245);
if (!isterrain){
discard;}
}
}
if (pos.y<=0.0){
if (idx<=250&&idx>245){
idx+=5;
}else{
}
}
int x = idx % cols;
int y = idx / cols;
float tsize = 1.0 / float(cols);
vec2 tuv = fract(fragTexCoord * size) / float(cols);
return pos.y>0.0
?directional(texture(tilesheet, vec2(float(x) * tsize, float(y) * tsize) + tuv))
:texture(tilesheet, vec2(float(x) * tsize, float(y) * tsize) + tuv);
}
vec4 triplanar(){
vec3 weight = abs(n);
weight = weight / (weight.x + weight.y + weight.z);
vec4 x = texture(tilemap, pos.yz * 0.1);
vec4 y = texture(tilemap, pos.xz * 0.1);
vec4 z = texture(tilemap, pos.xy * 0.1);
vec4 triplanarColor = x * weight.x + y * weight.y + z * weight.z;
return directional(triplanarColor);
}
int rendermode=3;
void main(){
vec3 cpos=vec3(campos.x,0,campos.z);
vec3 wpos=pos*4;
float dist = length(cpos - wpos);
if (fragColor.r==1. && fragColor.b==1.){
FragColor=white();
return;
}
if(rendermode==3){
FragColor=textured()*fragColor*1.4;
}else if(rendermode==2){
FragColor=triplanar();
}else if(rendermode==1){
FragColor=directional(fragColor);
}else{
FragColor=white();
}
// float fogFactor = 1.0 / exp( (dist * 1) * (dist * 1));
FragColor.a=1/exp((dist*0.0008)*(dist*0.0008));
}

View file

@ -0,0 +1,36 @@
#version 330 core
attribute vec3 vertexPosition;
attribute vec2 vertexTexCoord;
attribute vec4 vertexColor;
attribute vec3 vertexNormal;
out vec2 fragTexCoord;
out vec3 fragWorldPos;
out vec3 normal;
out vec3 pos;
out int level;
uniform mat4 mvp;
uniform mat4 modelmat;
void main() {
fragTexCoord = vertexTexCoord;
vec3 vpos=vertexPosition;
if (vpos.y>1.0) vpos.y=0.99;
else if (vpos.y<0.0) vpos.y=0.01;
vpos.x*=4.0;vpos.z*=4.0;
gl_Position = mvp * vec4(vpos, 1.0);
normal = mat3(modelmat) * vertexNormal;
pos = (modelmat * vec4(vertexPosition, 1.0)).xyz;
if (pos.y>=-0.01&&pos.y<=1.01){
vec3 n = normalize(normal);
if(abs(n.x)>abs(n.y)&&abs(n.x)>abs(n.z))
fragTexCoord.y=-fragTexCoord.y;
else{
if (n.z > 0.5)
fragTexCoord.y -= 0.1; // Positive Z
fragTexCoord.y-=0.00002;
}
}
}

View file

@ -0,0 +1,216 @@
#version 330
in vec2 fragTexCoord;
in vec4 fragColor;
out vec4 finalColor;
uniform sampler2D texture0;
uniform vec4 colDiffuse;
uniform float time;
uniform float health;
uniform float stamina;
uniform float mana;
uniform float energy;
uniform float fatigue;
uniform float radioactivity;
uniform float xp;
#define NUM_BUBBLES 7.0
const float n = 5.1;
const float s = 7.3;
float random(vec2 st) {
return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);
}
float Hack( vec2 p, in float s)
{
vec3 p2 = vec3(p.xy,17.3 * abs(sin(s)));
return fract(sin(dot(p2,vec3(17.3,61.7, 12.4)))*173713.1);
}
float noise(vec2 vn) {
const vec2 d = vec2(0.0, 1.0);
vec2 b = floor(vn), f = smoothstep(vec2(0.0), vec2(1.0), fract(vn));
return mix(mix(random(b), random(b + d.yx), f.x), mix(random(b + d.xy), random(b + d.yy), f.x), f.y);
}
float fbm(vec2 n) {
float total = 0.0, amplitude = 1.0;
for (int i = 0; i <5; i++) {
total += noise(n) * amplitude;
n += n*1.7;
amplitude *= 0.47;
}
return total;
}
float HackNoise(in vec2 p, in float s)
{
vec2 i = floor(p);
vec2 f = fract(p);
f *= f * (3.0-2.0*f);
return mix(mix(Hack(i + vec2(0.,0.), s), Hack(i + vec2(1.,0.), s),f.x),
mix(Hack(i + vec2(0.,1.), s), Hack(i + vec2(1.,1.), s),f.x),
f.y) * s;
}
float Thunder(vec2 p, vec3 spec)
{
vec2 verticalP = vec2(p.y, p.x);
float v = - HackNoise(verticalP * 2.0, 0.25);
v += HackNoise(verticalP * 1.1, 0.5) - HackNoise(verticalP * 1.1, 0.25);
v += HackNoise(verticalP * 2.1, 0.25) - HackNoise(verticalP * 2.1, 0.125);
v += HackNoise(verticalP * 4.1, 0.125)*spec.x*1.0 - HackNoise(verticalP * 8.1, 0.0625);
v += HackNoise(verticalP * 8.1, 0.0625) - HackNoise(verticalP * 16.0, 0.03125)*spec.y*1.0;
v += HackNoise(verticalP * 16.1, 0.03125);
return v * 1.2;
}
// Generate bubbles in a 0..1 UV space for health bar
float bubble(vec2 uv, float t){
uv.y = 1.0 - uv.y; // optional, depending on your UV orientation
float col = 0.0;
for(float i = 0.0; i < NUM_BUBBLES; i++){
float randX = random(vec2(i, 1.24));
float randY = random(vec2(i, 1.678));
float speed = random(vec2(i, 3.456)) * 1.12;
float size = mix(0.05, 0.25, random(vec2(i, 2.012)));
// bubble position with horizontal oscillation
float x = randX + sin(t + randX * 8.28) * 0.1;
float y = randY + t * speed;
vec2 pos = vec2(x, mod(y, 1.0)); // wrap vertical
float d = length(uv - pos);
// --- adjustable parameters ---
float wallThickness = 0.2; // thickness of bubble border (0..1)
float borderSoftness = 0.02; // softness of outer edge
float centerSmoothness = 0.55; // how soft the center glow is
// outer edge (border)
float edge = smoothstep(size + borderSoftness, size - wallThickness, d);
// center glow
float inner = smoothstep(size*centerSmoothness, 0.0, d);
// subtle rim for more volume
float rim = smoothstep(size + wallThickness*0.5, size - wallThickness*0.25, d);
col += edge * 0.3 + rim * 0.2 + inner * 0.4; // adjust contributions for appearance
}
return clamp(col, 0.0, 1.0);
}
float gaussian(float x, float sigma){
return exp(-0.5 * (x*x) / (sigma*sigma));
}
float heartbeat(float t, float bpm){
float T = 60.0 / bpm;
float phase = mod(t, T); // 0..T
// params
float A1 = 1.0;
float A2 = 0.6;
float sigma1 = 0.04;
float sigma2 = 0.06;
float delta = 0.34; // seconds between lub and dub
float v1 = A1 * gaussian(phase, sigma1);
float v2 = A2 * gaussian(phase - delta, sigma2);
return v1 + v2; // 0..~1.6 depending on A
}
void main()
{
/*
xp bar is at x62 y 40
to x197 y45
texture size is x240 y55
62/240=0.18
40/55=0.72722727
197/240=0.82083333
45/55=0.81818181
*/
vec4 c = texture(texture0, fragTexCoord);
if (c.a==0.){
discard;
}
if (c.a<1.0 && c.b > c.r)
{//xp
if (fragTexCoord.x>0.173 && fragTexCoord.x<(0.173+(0.687*xp))
){
float wave=sin((-time*2.0)+(fragTexCoord.x*10))*0.5+0.8;
vec4 bg=vec4(0.0,wave,wave,1.0);
// cool idea to animate when gain xp
//c.b*=100.0;
//c.g*=100.0;
c = c.a * c + (1.0 - c.a) * bg;
}
}
if (c.r>c.g && c.r>c.b)
{//health
if (fragTexCoord.y>0.18+(0.74*(1-health)) && fragTexCoord.y<0.92
)
{
c.r=(c.r*1.8)-bubble(vec2(fragTexCoord.x*2,fragTexCoord.y), time)/2.;
}
}else if (c.g>c.r && c.g>c.b
&& c.r>c.b
){//stamina
if (fragTexCoord.y>0.18+(0.74*(1-stamina)) && fragTexCoord.y<0.92){
float fac=heartbeat(time, 60.0*stamina)/2;
c.g*=1.6+fac;
c.r*=1.6+fac;
}
}else if (c.b>c.r && c.g>c.b && c.g>c.r)
{//radioactivity
if (fragTexCoord.y>0.51+(0.44*(1-radioactivity)) && fragTexCoord.y<0.94)
{
float fac=2*random(fragTexCoord*vec2(100.0,100.0)+time*10.0);
c.b*=fac+0.2;
c.g*=fac+0.2;
}
}else if (c.g > c.r && c.g > c.b)
{//fatigue
if (fragTexCoord.y>0.51+(0.44*(1-fatigue)) && fragTexCoord.y<0.94){
float fact= sin(-time*3.0+fragTexCoord.y*20)*0.5+1.0;
fact*=cos(-time*2.0+fragTexCoord.x*20)*0.5+1.0;
c.g*=1.0+fact;
}
}else if (c.b > c.r && c.b > c.g && c.r < 0.1 && c.a>=0.8)
{//energy
if (fragTexCoord.y>0.18+(0.74*(1-energy)) && fragTexCoord.y<0.92){
float WhoMadeWho = (time * s) + 1000.0;
vec2 uv = fragTexCoord * vec2(2.0,1.0);
uv.y-=0.8;
float wave=sin((-time*2.0)+(uv.x*10))*0.5+0.8;
vec3 spec = vec3(wave/1.0);
for( float i = 1.0; i < 2; i++ )
{
float t = abs(4.0 / ((uv.y + Thunder( vec2(uv.x,uv.y+0.8)*5 + WhoMadeWho / i , spec)) * (i * 100.0)));
c.rgb += t * vec3( i * 0.1*spec.x*2., 0.2, 1.30 );
}
float fac=2*random(fragTexCoord*vec2(2.0,1.0)+time*10.0)*2;}
}else if (c.r > c.g && c.b > c.g && c.g < 0.1)
{//mana
if (fragTexCoord.y>0.18+(0.74*(1-mana)) && fragTexCoord.y<0.92){
float fac=noise(fragTexCoord*vec2(50.0,30.0+time*10.0))*2;
c.r*=1.0+fac;
c.b*=1.0+fac;}
}
finalColor = c * colDiffuse * fragColor;
}

View file

@ -0,0 +1,15 @@
#version 330
attribute vec3 vertexPosition;
attribute vec2 vertexTexCoord;
attribute vec4 vertexColor;
uniform mat4 mvp;
out vec2 fragTexCoord;
out vec4 fragColor;
void main()
{
fragTexCoord = vertexTexCoord;
fragColor = vertexColor;
gl_Position = mvp * vec4(vertexPosition, 1.0);
}

View file

@ -0,0 +1,16 @@
#pragma once
#include <enginend/engine.h>
class client :public enginend::program{
public:
RenderTexture2D target;
const char* CONF() final{return "client.tdf";}
client();
void boot() override;
void tick() override;
void draw() override;
void exit() override;
};

View file

@ -1,6 +1,7 @@
#pragma once
#include <vector>
#include <incmgr.h>
#include <enginend/engine.h>
extern Font forefont;
extern enginend::group maincfgpage;

View file

@ -0,0 +1 @@
#include "game.h"

View file

@ -0,0 +1,7 @@
#pragma once
#include <enginend/engine.h>
class game :public virtual enginend::scene {
};

View file

@ -0,0 +1 @@
#include "mainmenu.h"

View file

@ -0,0 +1,31 @@
#pragma once
#include <enginend/engine.h>
#include "configmenu.h"
class mainmenu :public virtual enginend::scene{
private:
Texture2D bg= LoadTexture(AT("res/images/tilesheet.png"));
public:
void boot() override {
this->nodes=std::list<enginend::nodes::node*>{
new enginend::nodes::relative::animated(AT("res/images/sky.gif"),0,0,1,1,2),
new enginend::nodes::relative::text(nullptr,{255,127,0,255},{0,0,0,0},0.25,0.05,0.8,0.1,forefont,32,"FORESPEND"),
};
enginend::scene::boot();
}
void tick() override {
for (enginend::nodes::node* n : this->nodes) {
n->tick();
}
}
void draw() override {
for (enginend::nodes::node* n : this->nodes) {
n->draw();
}
}
void exit() override {
enginend::scene::exit();
}
};

View file

@ -0,0 +1,57 @@
#include <atomic>
#include <thread>
#include "server/server.h"
#include "client/client.h"
PLATFORM platform=LINUX;
std::string androidpackage="kn.kinfuyuki.forespend";
inline const char* COMMONCONFIG(){return "common.tdf";}
tiny::ErrorLevel tiny::level{4};
int main(int argc, char** argv) {
enginend::program* game;
tiny::startup("forespend","0.03g-rewrite");
bool isserver = false;
if (argc>1) {
for (int i=1;i<argc;i++) {
if (argv[i]=="server ") {
isserver = true;
}
}
}
if (isserver) game = new server();else game = new client();
game->boot();
std::atomic<bool> running{true};
std::thread tickthread([game, &running]() {
double tickrate=1.0/game->tickrate;
auto lasttick=std::chrono::high_resolution_clock::now();
while (running) {
auto now=std::chrono::high_resolution_clock::now();
double elapsed=std::chrono::duration_cast<std::chrono::duration<double>>(now-lasttick).count();
if (elapsed>=tickrate) {
game->tick();
lasttick=now;
} else {
std::this_thread::sleep_for(std::chrono::duration<double>(tickrate-elapsed));
}
}
});
double framerate=1.0/game->framerate;
auto lastframe=std::chrono::high_resolution_clock::now();
while (!WindowShouldClose()) {
auto now=std::chrono::high_resolution_clock::now();
double elapsed=std::chrono::duration_cast<std::chrono::duration<double>>(now-lastframe).count();
if (elapsed>=framerate) {
game->draw();
lastframe=now;
} else {
WaitTime(framerate-elapsed);
}
}
game->exit();
return 0;
}

View file

@ -0,0 +1,8 @@
#include "server.h"
server::server() {}
void server::boot() {}
void server::draw() {}
void server::exit() {}
void server::tick() {}

View file

@ -0,0 +1,14 @@
#pragma once
#include <enginend/engine.h>
class server : public enginend::program{
public:
server();
const char* CONF() final{return "client.tdf";}
void boot() override;
void tick() override;
void draw() override;
void exit() override;
};