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,39 +1,27 @@
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")
if (DEFINED PLATFORMNAME)
SET(CURRPLATFORM ${PLATFORMNAME})
else ()
SET(CURRPLATFORM "linux-64")
endif (DEFINED PLATFORMNAME)
file(GLOB_RECURSE ENGINE_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/force_rebuild"
COMMAND rm -f "${CMAKE_SOURCE_DIR}/link/libenginend.so"
COMMAND rm -rf "${CMAKE_SOURCE_DIR}/include/enginend"
)
add_library(enginend SHARED ${ENGINE_SOURCES} "${CMAKE_BINARY_DIR}/force_rebuild"
../include/json.h)
add_library(enginend SHARED ${ENGINE_SOURCES} )
target_link_directories(
enginend PUBLIC
"${CMAKE_SOURCE_DIR}/link")
"${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}")
set(ENGINE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(ENGINE_EXPORT_DIR "${CMAKE_SOURCE_DIR}/include/enginend")
set_target_properties(enginend PROPERTIES
CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link"
CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}"
)
file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS "${ENGINE_SRC_DIR}/*.h" "${ENGINE_SRC_DIR}/*.hpp")
foreach(HEADER ${HEADER_FILES})
file(RELATIVE_PATH REL_PATH "${ENGINE_SRC_DIR}" "${HEADER}")
set(DEST "${ENGINE_EXPORT_DIR}/${REL_PATH}")
get_filename_component(DEST_DIR "${DEST}" DIRECTORY)
add_custom_command(
TARGET enginend PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${DEST_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HEADER}" "${DEST}"
)
endforeach()
add_executable(test test.cpp)
@ -43,9 +31,10 @@ set_target_properties(test PROPERTIES
)
target_link_directories(
test PUBLIC
"${CMAKE_SOURCE_DIR}/link")
"${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}")
target_link_libraries(test PRIVATE
"${CMAKE_SOURCE_DIR}/link/libenginend.so"
#"${CMAKE_SOURCE_DIR}/link/${CURRPLATFORM}/libenginend.so"
enginend
)
target_include_directories(test PUBLIC
${CMAKE_SOURCE_DIR}/include

0
engine/src/aud.h Normal file
View file

1
engine/src/engine.cpp Normal file
View file

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

14
engine/src/engine.h Normal file
View file

@ -0,0 +1,14 @@
#pragma once
#include "net.h"
#include "gr.h"
#include "aud.h"
#include "program.h"
#include "scenes/scene.h"
enum PLATFORM {
WINDOWS,LINUX,MACOS,
ANDROID,IOS
};
extern PLATFORM platform;
extern std::string androidpackage;
#include "resmgr.h"

2
engine/src/gr.h Normal file
View file

@ -0,0 +1,2 @@
#include "graph/window.h"

View file

@ -0,0 +1 @@
#include <raylib/raylib.h>

0
engine/src/net.h Normal file
View file

17
engine/src/program.cpp Normal file
View file

@ -0,0 +1,17 @@
#include "program.h"
long long calibrate() {
unsigned long long start = __rdtsc();
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 100000000L; // 0.1 seconds
nanosleep(&ts, NULL);
return (__rdtsc() - start) * 10;
}
const long long enginend::CPUCLOCK=calibrate();
void enginend::program::changescene(scene *scn) {
this->currentscene->exit();
delete this->currentscene;
this->currentscene = scn;
this->currentscene->boot();
}

46
engine/src/program.h Normal file
View file

@ -0,0 +1,46 @@
#pragma once
#define CFG this->CONF()
#include <immintrin.h>
#include <time.h>
#include "scenes/scene.h"
namespace enginend{
extern const long long CPUCLOCK;
inline const char* COMMONCONFIG();
class program {
unsigned long long currenttick = __rdtsc();
unsigned long long currentframe = __rdtsc();
public:
scene *currentscene;
int tickrate;
int framerate;
void changescene(scene*scn);
program():client(false){}
program(bool isclient):client(isclient){}
virtual const char* CONF()=0;
const bool client;
virtual void boot()=0;
virtual void tick()=0;
virtual void draw()=0;
virtual void exit()=0;
bool shouldtick() {
unsigned long long now = __rdtsc();
unsigned long long interval = CPUCLOCK / tickrate;
if (now - currenttick >= interval) {
currenttick = now;
return true;
}
return false;
}
bool shoulddraw() {
unsigned long long now = __rdtsc();
unsigned long long interval = CPUCLOCK / framerate;
if (now - currentframe >= interval) {
currentframe = now;
return true;
}
return false;
}
};}

12
engine/src/resmgr.h Normal file
View file

@ -0,0 +1,12 @@
#pragma once
#include <string>
#include "engine.h"
inline const char *AT(std::string path) {
if (platform==LINUX || platform==WINDOWS || platform==MACOS) {
return path.c_str();
}else {
if (platform==ANDROID) {
return ("/data/data/"+androidpackage+"/files/"+path).c_str();
}
}
}

View file

@ -1,6 +1,6 @@
#pragma once
#include <string>
#include <functional>
#include "nodes.h"
namespace enginend {
@ -25,7 +25,7 @@ namespace enginend {
}
void boot()override{}
void tick()override{}
void draw()override{if(texture!=nullptr)DrawTexture(*texture,pos.x,pos.y,WHITE);}
void draw()override{if(texture!=nullptr)DrawTexture(*texture,pos.x,pos.y,rl::WHITE);}
void exit()override{delete texture;}
};
struct animated : virtual public textured {
@ -153,7 +153,7 @@ namespace enginend {
std::function<void()> func;
bool pressed;
bool hover;
final bool isboolean;
const bool isboolean;
button():pressed(false),isboolean(false){}
button(Texture2D* texture,Color color,float x,float y,float w,float h,std::function<void()> f):func(f),pressed(false),isboolean(false){
this->pos=Vector2{x,y};this->size=Vector2{w,h};this->texture=texture;this->c=color;
@ -227,7 +227,7 @@ namespace enginend {
}
}
void draw()override{
DrawRectangle(pos.x,pos.y,size.x,size.y,DARKGRAY);
DrawRectangle(pos.x,pos.y,size.x,size.y,rl::DARKGRAY);
float t=(val-minv)/(maxv-minv);
DrawRectangle(pos.x,pos.y,size.x*t,size.y,c);
}
@ -333,7 +333,7 @@ namespace enginend {
line+=ch;
}
}
DrawRectangle(p.x+MeasureText(line.c_str(),fs),p.y,2,fs,BLACK);
DrawRectangle(p.x+MeasureText(line.c_str(),fs),p.y,2,fs,rl::BLACK);
}
}
void exit()override{this->textfield::exit();}

View file

@ -0,0 +1,423 @@
#pragma once
#include <string>
#include "nodes.h"
#include <raylib/raylib.h>
namespace enginend{
namespace nodes{
namespace relative {
struct node2d :public node {
double x;
double y;
double w;
double h;
node2d(){x=0;y=0;w=0;h=0;}
node2d(double x,double y,double w=0,double h=0):x(x),y(y),w(w),h(h){}
};
struct rect :virtual public node2d{
rect(){}
rect(double x,double y,double w,double h):node2d(x,y,w,h){}
};
struct textured :virtual public rect{
Texture2D* texture;
textured(){texture=nullptr;}
textured(Texture2D* texture,double x,double y,double w,double h):texture(texture),rect(x,y,w,h){}
void boot() override{}
void tick() override{}
void draw()override{
if(texture==nullptr)return;
float sw=GetScreenWidth();
float sh=GetScreenHeight();
float ax=x*sw;
float ay=y*sh;
float aw=w*sw;
float ah=h*sh;
tiny::echo("og: %f %f %f %f", x,y,w,h);
tiny::echo("transformed: %f %f %f %f", ax, ay, aw, ah);
DrawTexturePro(*texture,{0,0,(float)texture->width,(float)texture->height},{ax,ay,aw,ah},{0,0},0,rl::WHITE);
}
void exit()override {
if(texture){
UnloadTexture(*texture);
delete texture;
texture=nullptr;
}
}
};
struct animated :virtual public textured{
Image animimage;
int frames;
int currentframe;
int framedelay;
int framecounter;
int prevframe;
unsigned int nextframeoffset;
animated():frames(0),currentframe(1),framedelay(6),framecounter(0),nextframeoffset(0){
animimage.data=nullptr;
prevframe=currentframe;
}
animated(const char* gifpath,double x,double y,double w,double h,int delay=6):
textured(nullptr,x,y,w,h),framedelay(delay),currentframe(1),framecounter(0),frames(0),nextframeoffset(0)
{
prevframe=currentframe;
this->x=x; this->y=y; this->w=w; this->h=h;
animimage=LoadImageAnim(gifpath,&frames);
if(frames>0){
texture=new Texture2D(LoadTextureFromImage(animimage));
}
}
void tick()override{
if(frames<=1)return;
framecounter++;
if(framecounter>=framedelay){
framecounter=0;
currentframe++;
if(currentframe>=frames)currentframe=0;
nextframeoffset=animimage.width*animimage.height*4*currentframe;
tiny::echo("updating node\nframes: %i\n current frame: %i",frames,currentframe);
tiny::echo("%i",nextframeoffset);
}
}
void draw()override {
if (prevframe!=currentframe){
prevframe=currentframe;
UpdateTexture(*this->texture,((unsigned char*)animimage.data)+nextframeoffset);
}
textured::draw();
}
void exit()override{
if(animimage.data)UnloadImage(animimage);
textured::exit();
}
};
struct colored :virtual public rect{
Color c;
colored(){}
colored(Color color,double x,double y,double w,double h):c(color),rect(x,y,w,h){}
void boot()override{}
void tick()override{}
void draw()override{
float sw=GetScreenWidth();
float sh=GetScreenHeight();
float ax=x*sw;
float ay=y*sh;
float aw=w*sw;
float ah=h*sh;
DrawRectangle(ax,ay,aw,ah,c);
}
void exit()override{}
};
struct tinted :virtual public colored,virtual public textured{
tinted(){}
tinted(Texture2D* texture,Color color,double x,double y,double w,double h):
node2d(x,y,w,h),
rect(x,y,w,h),
colored(color,x,y,w,h),
textured(texture,x,y,w,h)
{}
void boot()override{}
void tick()override{}
void draw()override{
if(texture==nullptr)return;
float sw=GetScreenWidth();
float sh=GetScreenHeight();
float ax=x*sw;
float ay=y*sh;
float aw=w*sw;
float ah=h*sh;
DrawTexturePro(*texture,{0,0,(float)texture->width,(float)texture->height},{ax,ay,aw,ah},{0,0},0,c);
}
void exit()override{
textured::exit();
}
};
struct text :public tinted {
protected:
std::string result;
public:
Font font;
float fs;
Color txc;
std::string content;
text(){fs=20;}
text(Texture2D* texture,Color txcol,Color color,double x,double y,double w,double h,Font f,float fsize,std::string txt):
//tinted(texture,color,x,y,w,h),
font(f),fs(fsize),content(txt),txc(txcol)
{
this->x=x;this->y=y;this->w=w;this->h=h;
this->texture=texture;this->c=color;
result=content;
size_t initp=0;
while((initp=result.find("\n",initp))!=std::string::npos){
result.replace(initp,1,"\\n");
initp+=2;
}
}
void boot()override{}
void tick()override {
if(result!=content){
result=content;
size_t initp=0;
while((initp=result.find("\n",initp))!=std::string::npos){
result.replace(initp,1,"\\n");
initp+=2;
}
}
}
void draw()override {
float sw=GetScreenWidth();
float sh=GetScreenHeight();
float ax=x*sw;
float ay=y*sh;
float aw=w*sw;
float ah=h*sh;
tiny::echo("og: %f %f %f %f", x,y,w,h);
tiny::echo("drawing text: %s", content.c_str());
tiny::echo("transformed: %f %f %f %f", ax, ay, aw, ah);
Vector2 minsize=MeasureTextEx(font,content.c_str(),fs,1);
Vector2 charsize=MeasureTextEx(font," ",fs,1);
float p=charsize.x>charsize.y?charsize.x/minsize.x:charsize.y/minsize.y;
p=p*2;
int minh=(minsize.y>ah)?minsize.y:ah;
int minw=(minsize.x>aw)?minsize.x:aw;
DrawRectangle(ax-charsize.x,ay-charsize.y,minw+p,minh+p,c);
DrawTextEx(font,content.c_str(),{ax,ay},fs,1,txc);
}
void exit()override{
tinted::exit();
}
};
struct button :virtual public tinted{
void(*func)();
bool pressed;
bool hover;
button():func(nullptr),pressed(false),hover(false){}
button(Texture2D* texture,Color color,double x,double y,double w,double h,void(*f)()):func(f),pressed(false),hover(false),tinted(texture,color,x,y,w,h){}
void boot()override{}
void tick()override{
Vector2 mouse=GetMousePosition();
float sw=GetScreenWidth();
float sh=GetScreenHeight();
Rectangle r={float(x*sw),float(y*sh),float(w*sw),float(h*sh)};
if(CheckCollisionPointRec(mouse,r)){hover=true;
if(IsMouseButtonPressed(MOUSE_LEFT_BUTTON)){
pressed=true;
if(func)func();
}else{
pressed=false;
}
}else{
hover=false;
pressed=false;
}
}
void draw()override {
tinted::draw();
}
void exit()override{
tinted::exit();
}
};
struct labeledbutton :virtual public button {
std::string label;
Font font;
int fs;
Color txc;
labeledbutton(std::string name,Texture2D* texture,Color color,Color text,
double x,double y,double w,double h,void(*f)(),
Font fnt,int size):font(fnt),fs(size),txc(text),label(name),
button(texture,color,x,y,w,h,f)
{}
void boot()override{}
void tick()override{
button::tick();
}
void draw()override{
button::draw();
float sw=GetScreenWidth();
float sh=GetScreenHeight();
float ax=x*sw;
float ay=y*sh;
float aw=w*sw;
float ah=h*sh;
Vector2 tsize=MeasureTextEx(font,label.c_str(),fs,1);
Vector2 tpos={
ax+(aw-tsize.x)/2,
ay+(ah-tsize.y)/2
};
DrawTextEx(font,label.c_str(),tpos,fs,1,txc);
}
void exit()override{
button::exit();
}
};
struct slider :virtual public tinted{
float val;
float minv;
float maxv;
slider():val(0),minv(0),maxv(1){}
slider(Texture2D* texture,Color color,double x,double y,double w,double h,float min,float max,float v):val(v),minv(min),maxv(max),tinted(texture,color,x,y,w,h){}
void boot()override{}
void tick()override{
Vector2 mouse=GetMousePosition();
float sw=GetScreenWidth();
float sh=GetScreenHeight();
Rectangle r={float(x*sw),float(y*sh),float(w*sw),float(h*sh)};
if(CheckCollisionPointRec(mouse,r)&&IsMouseButtonDown(MOUSE_LEFT_BUTTON)){
float t=(mouse.x-(x*sw))/(w*sw);
val=minv+t*(maxv-minv);
if(val<minv)val=minv;
if(val>maxv)val=maxv;
}
}
void draw()override{
float sw=GetScreenWidth();
float sh=GetScreenHeight();
float ax=x*sw;
float ay=y*sh;
float aw=w*sw;
float ah=h*sh;
DrawRectangle(ax,ay,aw,ah,rl::DARKGRAY);
float t=(val-minv)/(maxv-minv);
DrawRectangle(ax,ay,aw*t,ah,c);
}
void exit()override{
tinted::exit();
}
};
struct textfield :public text{
textfield(){}
textfield(Texture2D* texture,Color txcol,Color color,double x,double y,double w,double h,Font f,float fsize,std::string txt):
text(texture,txcol,color,x,y,w,h,f,fsize,txt){}
void boot()override{}
void tick()override{
text::tick();
}
void draw()override{
float sw=GetScreenWidth();
float sh=GetScreenHeight();
float ax=x*sw;
float ay=y*sh;
float aw=w*sw;
float ah=h*sh;
Vector2 charsize=MeasureTextEx(font," ",fs,0);
Vector2 minsize=MeasureTextEx(font,content.c_str(),fs,charsize.x/2);
float po=charsize.x>charsize.y?charsize.x/charsize.y:charsize.y/charsize.x;po=po*5;
int minh=(minsize.y>ah)?minsize.y:ah;
int minw=(minsize.x>aw)?minsize.x:aw;
DrawRectangle(ax-(po/2),ay-(po/2),minw+(po*1.1),minh+(po*1.1),c);
DrawTextEx(font,content.c_str(),{ax,ay},fs,charsize.x/2,txc);
}
void exit()override{
text::exit();
}
};
struct textinput :public text{
bool active;
int cpos;
textinput():active(false),cpos(0){}
textinput(Texture2D* texture,Color txcol,Color color,double x,double y,double w,double h,Font f,float fsize):active(false),cpos(0),
text(texture,txcol,color,x,y,w,h,f,fsize,""){}
void boot()override{}
void tick()override{
text::tick();
Vector2 mouse=GetMousePosition();
float sw=GetScreenWidth();
float sh=GetScreenHeight();
Rectangle r={float(x*sw),float(y*sh),float(w*sw),float(h*sh)};
if(IsMouseButtonPressed(MOUSE_LEFT_BUTTON)){
active=CheckCollisionPointRec(mouse,r);
}
if(active){
int key=GetCharPressed();
while(key>0){
if(key>=32&&key<=125){
content+=static_cast<char>(key);
cpos++;
}
key=GetCharPressed();
}
if(IsKeyPressed(KEY_BACKSPACE)&&content.length()>0){
content.pop_back();
cpos--;
}
}
}
void draw()override{
text::draw();
if(active){
float sw=GetScreenWidth();
float sh=GetScreenHeight();
float ax=x*sw;
float ay=y*sh;
DrawRectangle(ax+MeasureTextEx(font,content.c_str(),fs,1).x,ay,2,fs,{0,0,0,127});
}
}
void exit()override{
text::exit();
}
};
struct textinputfield :public textfield{
bool active;
int cpos;
textinputfield():active(false),cpos(0){}
textinputfield(Texture2D* texture,Color txcol,Color color,double x,double y,double w,double h,Font f,float fsize):active(false),cpos(0),
textfield(texture,txcol,color,x,y,w,h,f,fsize,""){}
void boot()override{}
void tick()override{
textfield::tick();
Vector2 mouse=GetMousePosition();
float sw=GetScreenWidth();
float sh=GetScreenHeight();
Rectangle r={float(x*sw),float(y*sh),float(w*sw),float(h*sh)};
if(IsMouseButtonPressed(MOUSE_LEFT_BUTTON)){
active=CheckCollisionPointRec(mouse,r);
}
if(active){
int key=GetCharPressed();
while(key>0){
if(key>=32&&key<=125){
content+=static_cast<char>(key);
cpos++;
}
key=GetCharPressed();
}
if(IsKeyPressed(KEY_BACKSPACE)&&content.length()>0){
content.pop_back();
cpos--;
}
if(IsKeyPressed(KEY_ENTER)){
content+='\n';
cpos++;
}
}
}
void draw()override{
textfield::draw();
if(active){
float sw=GetScreenWidth();
float sh=GetScreenHeight();
float ax=x*sw;
float ay=y*sh;
float lh=fs+2;
Vector2 p={ax,ay};
std::string line="";
for(char ch:content){
if(ch=='\n'){
p.y+=lh;
line="";
}else{
line+=ch;
}
}
DrawRectangle(p.x+MeasureTextEx(font,line.c_str(),fs,1).x,p.y,2,fs,rl::BLACK);
}
}
void exit()override{
textfield::exit();
}
};
}
}
}

40
engine/src/scenes/scene.h Normal file
View file

@ -0,0 +1,40 @@
#pragma once
#include "nodes.h"
#include "node2d.h"
#include "node2drelative.h"
#include <list>
namespace enginend {
struct scene{
std::list<enginend::nodes::node*> nodes;
virtual void boot() {
int i=0;
tiny::echo((char*)"initializing scene");
for (enginend::nodes::node* n : nodes) {
tiny::echo((char*)"initializing object of ID: %i",i++);
n->boot();
}
}
virtual void draw() {
ClearBackground(rl::BLANK);
BeginDrawing();
for (enginend::nodes::node* n : nodes) {
n->draw();
}
EndDrawing();
}
virtual void tick() {
for (enginend::nodes::node* n : nodes) {
n->tick();
}
}
virtual void exit() {
for (enginend::nodes::node* n : nodes) {
n->exit();
}
}
};
}

52
engine/test.cpp Normal file
View file

@ -0,0 +1,52 @@
#include <enginend/engine.h>
using namespace enginend;
class launcher:public program {
public:
bool vsync = true;
scene s;
const char* CONF() final{return "test.tdf";}
launcher(){};
void boot() override {
SetConfigFlags(FLAG_VSYNC_HINT);
InitWindow(500,500,"test");
SetTargetFPS(GetMonitorRefreshRate(GetCurrentMonitor()));
this->tickrate=GetMonitorRefreshRate(GetCurrentMonitor());
s.nodes=std::list<nodes::node*>{
new nodes::colored(Color{255,255,255,255},0,0,500,500),
new nodes::textfield(nullptr,Color{255,127,127,255},Color{127,127,127,255}
,100,100,220,32,GetFontDefault(),32,
"welcome to enginend!\n"
"hehe"
)
};
s.boot();
}
void tick() override {
if (shouldtick()) {
s.tick();
}
}
void draw() override {
s.draw();
}
void exit() override {
s.exit();
}
};
tiny::ErrorLevel tiny::level{6};
int main(int argc, char *argv[]) {
tiny::startup((char*)"enginend test",(char*)"1.0");
launcher e;
e.boot();
while (!WindowShouldClose()) {
e.tick();
e.draw();
}
e.exit();
return 0;
}

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

View file

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 159 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 165 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 754 B

After

Width:  |  Height:  |  Size: 754 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Before After
Before After

View file

Before

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

After

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

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 794 B

After

Width:  |  Height:  |  Size: 794 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 965 B

After

Width:  |  Height:  |  Size: 965 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

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;
};

@ -1 +1 @@
Subproject commit c8cc2ba6e94f82ec12d12f4764a07231269409f1
Subproject commit db04719973c67d943a41e35f8e6ec0e34dddfc7b

@ -1 +1 @@
Subproject commit e4887c7fa646bd318c87c3d18626ff8333da96df
Subproject commit 2707a41755ffdecbde19775c84ea4097bb72b587

1
link/android/libraylib.a Symbolic link
View file

@ -0,0 +1 @@
../../lib/raylib/android/raylib/libraylib.a

1
link/linux-64/libraylib.a Symbolic link
View file

@ -0,0 +1 @@
../../lib/raylib/linux-64/raylib/libraylib.a

1
link/linux-i686/libraylib.a Symbolic link
View file

@ -0,0 +1 @@
../../lib/raylib/linux-i686/raylib/libraylib.a

1
link/w1x-64/libraylib.a Symbolic link
View file

@ -0,0 +1 @@
../../lib/raylib/w1x-64/raylib/libraylib.a

1
link/w7-32/libraylib.a Symbolic link
View file

@ -0,0 +1 @@
../../lib/raylib/w7-32/raylib/libraylib.a

1
link/w7-64/libraylib.a Symbolic link
View file

@ -0,0 +1 @@
../../lib/raylib/w7-64/raylib/libraylib.a

1
link/wxp/libraylib.a Symbolic link
View file

@ -0,0 +1 @@
../../lib/raylib/wxp/raylib/libraylib.a