movind stuf around
15
.gitmodules
vendored
|
|
@ -4,3 +4,18 @@
|
|||
[submodule "lib/tiny"]
|
||||
path = lib/tiny
|
||||
url = https://github.com/kin-fuyuki/tiny-cpp.git
|
||||
[submodule "lib/boost"]
|
||||
path = lib/boost
|
||||
url = https://github.com/boostorg/boost.git
|
||||
[submodule "lib/sdl2"]
|
||||
path = lib/sdl2
|
||||
url = https://github.com/libsdl-org/SDL.git
|
||||
[submodule "lib/enginend"]
|
||||
path = lib/enginend
|
||||
url = https://github.com/kin-fuyuki/enginend-cpp.git
|
||||
[submodule "lib/sdl3"]
|
||||
path = lib/sdl3
|
||||
url = https://github.com/kin-fuyuki/SDL.git
|
||||
[submodule "lib/tiny-lua"]
|
||||
path = lib/tiny-lua
|
||||
url = https://github.com/kin-fuyuki/tiny-lua.git
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 159 B |
|
Before Width: | Height: | Size: 166 B |
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 754 B |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 1,020 B |
|
Before Width: | Height: | Size: 794 B |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 965 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
|
@ -1,59 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
set(CMAKE_CXX_FLAGS "-std=c++17 -Wno-error")
|
||||
|
||||
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)
|
||||
target_link_directories(
|
||||
enginend PUBLIC
|
||||
"${CMAKE_SOURCE_DIR}/link")
|
||||
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"
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
set_target_properties(test PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/engine/test"
|
||||
)
|
||||
target_link_directories(
|
||||
test PUBLIC
|
||||
"${CMAKE_SOURCE_DIR}/link")
|
||||
target_link_libraries(test PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/link/libenginend.so"
|
||||
"${CMAKE_SOURCE_DIR}/link/libdesktopraylib.so"
|
||||
)
|
||||
target_include_directories(test PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/lib/raylib/linux-64/raylib/include
|
||||
)
|
||||
target_include_directories(enginend PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/lib/raylib/linux-64/raylib/include
|
||||
|
||||
)
|
||||
|
|
@ -1 +0,0 @@
|
|||
#include "engine.h"
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#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"
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
#include "graph/window.h"
|
||||
|
|
@ -1 +0,0 @@
|
|||
#include <raylib.h>
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#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();
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
#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;
|
||||
}
|
||||
};}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,338 +0,0 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#include "nodes.h"
|
||||
|
||||
namespace enginend {
|
||||
namespace nodes {
|
||||
struct node2d :public node {
|
||||
Vector2 pos;
|
||||
node2d(){}
|
||||
node2d(float x,float y):pos(Vector2{x,y}){}
|
||||
};
|
||||
struct rect :virtual public node2d{
|
||||
Vector2 size;
|
||||
rect(){}
|
||||
rect(float x,float y,float w,float h):size(Vector2{w,h}){
|
||||
this->pos=Vector2{x,y};
|
||||
}
|
||||
};
|
||||
struct textured :virtual public rect{
|
||||
Texture2D* texture;
|
||||
textured(){}
|
||||
textured(Texture2D* texture,float x,float y,float w,float h):texture(texture){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};
|
||||
}
|
||||
void boot()override{}
|
||||
void tick()override{}
|
||||
void draw()override{if(texture!=nullptr)DrawTexture(*texture,pos.x,pos.y,WHITE);}
|
||||
void exit()override{delete texture;}
|
||||
};
|
||||
struct animated : virtual public textured {
|
||||
Image animimage;
|
||||
int frames;
|
||||
int currentframe;
|
||||
int framedelay;
|
||||
int framecounter;
|
||||
unsigned int nextframeoffset;
|
||||
int prevframe;
|
||||
|
||||
animated() : frames(0), currentframe(0), framedelay(6), framecounter(0), nextframeoffset(0) {
|
||||
animimage.data = nullptr;
|
||||
}
|
||||
|
||||
animated(const char* gifpath, Vector2 position, Vector2 size, int delay = 6)
|
||||
: textured(nullptr, position.x, position.y, size.x, size.y),
|
||||
framedelay(delay), currentframe(0), framecounter(0), frames(0), nextframeoffset(0)
|
||||
{
|
||||
animimage = LoadImageAnim(gifpath, &frames);
|
||||
if (frames > 0) {
|
||||
texture = new Texture2D(LoadTextureFromImage(animimage));
|
||||
}
|
||||
}
|
||||
|
||||
void tick() override {
|
||||
textured::tick();
|
||||
if (frames <= 1) return;
|
||||
|
||||
framecounter++;
|
||||
if (framecounter >= framedelay) {
|
||||
framecounter = 0;
|
||||
currentframe++;
|
||||
if (currentframe >= frames) currentframe = 0;
|
||||
nextframeoffset = animimage.width * animimage.height * 4 * currentframe;
|
||||
}
|
||||
}
|
||||
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);
|
||||
if (texture) {
|
||||
UnloadTexture(*texture);
|
||||
delete texture;
|
||||
texture = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
struct colored :virtual public rect{
|
||||
Color c;
|
||||
colored(){}
|
||||
colored(Color color,float x,float y,float w,float h):c(color){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};
|
||||
}
|
||||
void boot()override{}
|
||||
void tick()override{}
|
||||
void draw()override{DrawRectangle(pos.x,pos.y,size.x,size.y,c);}
|
||||
void exit()override{}
|
||||
};
|
||||
struct tinted :virtual public colored,virtual public textured{
|
||||
tinted(){}
|
||||
tinted(Texture2D* texture,Color color,float x,float y,float w,float h):
|
||||
node2d(x,y),
|
||||
rect(x,y,w,h),
|
||||
colored(color,x,y,w,h),
|
||||
textured(texture,x,y,w,h)
|
||||
{}
|
||||
void boot()override{this->colored::boot();this->textured::boot();}
|
||||
void tick()override{this->colored::tick();this->textured::tick();}
|
||||
void draw()override{if(texture!=nullptr)DrawTexture(*texture,pos.x,pos.y,c);}
|
||||
void exit()override{this->colored::exit();this->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,float x,float y,float w,float h,Font f,float fsize,std::string txt):
|
||||
font(f),fs(fsize),content(txt)
|
||||
{
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};this->texture=texture;this->c=color;this->txc=txcol;
|
||||
|
||||
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{this->tinted::boot();}
|
||||
void tick()override {
|
||||
this->tinted::tick();
|
||||
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 {
|
||||
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>size.y)?minsize.y:size.y;
|
||||
int minw=(minsize.x>size.x)?minsize.x:size.x;
|
||||
DrawRectangle(pos.x-charsize.x,pos.y-charsize.y,minw+p,minh+p,c);
|
||||
DrawTextEx(font,content.c_str(),pos,fs,1,txc);
|
||||
}
|
||||
void exit()override{this->tinted::exit();}
|
||||
};
|
||||
struct button :virtual public tinted{
|
||||
std::function<void()> func;
|
||||
bool pressed;
|
||||
bool hover;
|
||||
button():pressed(false){}
|
||||
button(Texture2D* texture,Color color,float x,float y,float w,float h,std::function<void()> f):func(f),pressed(false){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};this->texture=texture;this->c=color;
|
||||
}
|
||||
void boot()override{this->tinted::boot();}
|
||||
void tick()override{
|
||||
this->tinted::tick();
|
||||
Vector2 mouse=GetMousePosition();
|
||||
if(CheckCollisionPointRec(mouse,{pos.x,pos.y,size.x,size.y})){hover=true;
|
||||
if(IsMouseButtonPressed(MOUSE_LEFT_BUTTON)){
|
||||
pressed=true;
|
||||
if(func)func();
|
||||
}else{
|
||||
pressed=false;
|
||||
}
|
||||
}else{
|
||||
hover=false;
|
||||
}
|
||||
}
|
||||
void draw()override {
|
||||
if(this->texture!=nullptr)DrawTexture(*texture,pos.x,pos.y,c);
|
||||
else DrawRectangle(pos.x,pos.y,size.x,size.y,c);
|
||||
}
|
||||
void exit()override{this->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,
|
||||
float x,float y,float w,float h,std::function<void()> f,
|
||||
Font fnt,int size):font(fnt),fs(size),txc(text){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};this->texture=texture;this->c=color;
|
||||
this->func=f;this->pressed=false;
|
||||
this->label=name;
|
||||
}
|
||||
void boot()override{this->button::boot();}
|
||||
void tick()override{this->button::tick();}
|
||||
void draw()override{
|
||||
this->button::draw();
|
||||
Vector2 tsize=MeasureTextEx(font,label.c_str(),fs,1);
|
||||
Vector2 tpos={
|
||||
pos.x+(size.x-tsize.x)/2,
|
||||
pos.y+(size.y-tsize.y)/2
|
||||
};
|
||||
DrawTextEx(font,label.c_str(),tpos,fs,1,txc);
|
||||
}
|
||||
void exit()override{this->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,float x,float y,float w,float h,float min,float max,float v):val(v),minv(min),maxv(max){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{x,y};this->texture=texture;this->c=color;
|
||||
}
|
||||
void boot()override{this->tinted::boot();}
|
||||
void tick()override{
|
||||
this->tinted::tick();
|
||||
Vector2 mouse=GetMousePosition();
|
||||
if(CheckCollisionPointRec(mouse,{pos.x,pos.y,size.x,size.y})&&IsMouseButtonDown(MOUSE_LEFT_BUTTON)){
|
||||
float t=(mouse.x-pos.x)/size.x;
|
||||
val=minv+t*(maxv-minv);
|
||||
if(val<minv)val=minv;
|
||||
if(val>maxv)val=maxv;
|
||||
}
|
||||
}
|
||||
void draw()override{
|
||||
DrawRectangle(pos.x,pos.y,size.x,size.y,DARKGRAY);
|
||||
float t=(val-minv)/(maxv-minv);
|
||||
DrawRectangle(pos.x,pos.y,size.x*t,size.y,c);
|
||||
}
|
||||
void exit()override{this->tinted::exit();}
|
||||
};
|
||||
struct textfield :public text{
|
||||
textfield(){}
|
||||
textfield(Texture2D* texture,Color txcol,Color color,float x,float y,float w,float h,Font f,float fsize,std::string txt):
|
||||
text(texture,txcol,color,x,y,w,h,f,fsize,txt){}
|
||||
void boot()override{this->text::boot();}
|
||||
void tick()override{this->text::tick();}
|
||||
void draw()override{
|
||||
Vector2 p=pos;
|
||||
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>size.y)?minsize.y:size.y;
|
||||
int minw=(minsize.x>size.x)?minsize.x:size.x;
|
||||
DrawRectangle(pos.x-(po/2),pos.y-(po/2),minw+(po*1.1),minh+(po*1.1),c);
|
||||
DrawTextEx(font,content.c_str(),p,fs,charsize.x/2,this->txc);
|
||||
}
|
||||
void exit()override{this->text::exit();}
|
||||
};
|
||||
struct textinput :public text{
|
||||
bool active;
|
||||
int cpos;
|
||||
textinput():active(false),cpos(0){}
|
||||
textinput(Texture2D* texture,Color txcol,Color color,float x,float y,float w,float h,Font f,float fsize):active(false),cpos(0){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{x,y};this->texture=texture;this->c=color;this->font=f;this->content="";
|
||||
this->txc=txcol;this->fs=fsize;
|
||||
}
|
||||
void boot()override{this->text::boot();}
|
||||
void tick()override{
|
||||
this->text::tick();
|
||||
Vector2 mouse=GetMousePosition();
|
||||
if(IsMouseButtonPressed(MOUSE_LEFT_BUTTON)){
|
||||
active=CheckCollisionPointRec(mouse,{pos.x,pos.y,size.x,size.y});
|
||||
}
|
||||
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{
|
||||
this->text::draw();
|
||||
if(active)DrawRectangle(pos.x+MeasureText(content.c_str(),fs),pos.y,2,fs,{0,0,0,127});
|
||||
}
|
||||
void exit()override{this->text::exit();}
|
||||
};
|
||||
struct textinputfield :public textfield{
|
||||
bool active;
|
||||
int cpos;
|
||||
textinputfield():active(false),cpos(0){}
|
||||
textinputfield(Texture2D* texture,Color txcol,Color color,float x,float y,float w,float h,Font f,float fsize):active(false),cpos(0),
|
||||
textfield(texture,txcol,color,x,y,w,h,f,fsize,""){}
|
||||
void boot()override{this->textfield::boot();}
|
||||
void tick()override{
|
||||
this->textfield::tick();
|
||||
Vector2 mouse=GetMousePosition();
|
||||
if(IsMouseButtonPressed(MOUSE_LEFT_BUTTON)){
|
||||
active=CheckCollisionPointRec(mouse,{pos.x,pos.y,size.x,size.y});
|
||||
}
|
||||
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{
|
||||
this->textfield::draw();
|
||||
if(active){
|
||||
Vector2 p=pos;
|
||||
float lh=fs+2;
|
||||
std::string line="";
|
||||
for(char ch:content){
|
||||
if(ch=='\n'){
|
||||
p.y+=lh;
|
||||
line="";
|
||||
}else{
|
||||
line+=ch;
|
||||
}
|
||||
}
|
||||
DrawRectangle(p.x+MeasureText(line.c_str(),fs),p.y,2,fs,BLACK);
|
||||
}
|
||||
}
|
||||
void exit()override{this->textfield::exit();}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,423 +0,0 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#include "nodes.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,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,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,BLACK);
|
||||
}
|
||||
}
|
||||
void exit()override{
|
||||
textfield::exit();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include "../gr.h"
|
||||
#include "../aud.h"
|
||||
#include "../net.h"
|
||||
#include<tiny/term.h>
|
||||
|
||||
namespace enginend {
|
||||
namespace nodes {
|
||||
struct node{
|
||||
public:
|
||||
virtual void boot()=0;
|
||||
virtual void tick()=0;
|
||||
virtual void draw()=0;
|
||||
virtual void exit()=0;
|
||||
};
|
||||
}
|
||||
struct group : public virtual enginend::nodes::node {
|
||||
std::vector<node*> children;
|
||||
group(std::vector<node*>& children) : children(std::move(children)) {}
|
||||
void boot(){for (node* n: children){n->boot();}}
|
||||
void tick(){for (node* n: children){n->tick();}}
|
||||
void draw(){for (node* n: children){n->draw();}}
|
||||
void exit(){for (node* n: children){n->exit();}}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "nodes.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();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
#include <incmgr.h>
|
||||
#include <raylib.h>
|
||||
#include <enginend/scenes/node2d.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;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
link/libenginend.so
|
||||
|
|
@ -1 +0,0 @@
|
|||
libraylib.so.550
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-std=c++17 -g -Wno-error -O0")
|
||||
file(GLOB_RECURSE ENDLAUNCHER "src/*.cpp")
|
||||
add_executable(endlauncher ${ENDLAUNCHER})
|
||||
|
||||
set_target_properties(endlauncher PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/built/launcher/${PLATFORM_DIR}"
|
||||
)
|
||||
target_link_directories(
|
||||
endlauncher PUBLIC
|
||||
"${CMAKE_SOURCE_DIR}/link")
|
||||
target_link_libraries(endlauncher PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/link/libenginend.so"
|
||||
"${CMAKE_SOURCE_DIR}/link/liblinux64raylib.so"
|
||||
curl zip
|
||||
)
|
||||
target_include_directories(endlauncher PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/lib/raylib/linux-64/raylib/include
|
||||
${CMAKE_SOURCE_DIR}/engine/include
|
||||
)
|
||||
|
|
@ -1,356 +0,0 @@
|
|||
#include <incmgr.h>
|
||||
#include <raylib.h>
|
||||
#include <enginend/scenes/node2d.h>
|
||||
#include "netio.h"
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
|
||||
using namespace enginend;
|
||||
using namespace enginend::nodes;
|
||||
netio nete{};
|
||||
/*
|
||||
|
||||
*/
|
||||
struct background: public virtual textured {
|
||||
background(Texture2D* texture,float x,float y,float w, float h) {
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};
|
||||
this->texture=texture;
|
||||
this->justclicked=false;
|
||||
}
|
||||
void boot()override{
|
||||
img=LoadImageFromTexture(*this->texture);
|
||||
}
|
||||
void tick()override {
|
||||
Vector2 mp=Vector2(GetMousePositionDesktop());
|
||||
Vector2 wp=GetWindowPosition();
|
||||
Vector2 rp=Vector2{mp.x-wp.x,mp.y-wp.y};
|
||||
if (IsMouseButtonDown(0)) {
|
||||
if (rp.x>=0&&rp.y>=0&&rp.x<600&&rp.y<300) {
|
||||
Color pix=GetImageColor(img, (int)rp.x, (int)(300-rp.y));
|
||||
if (pix.a!=0) {
|
||||
if (clicked==false) {
|
||||
clicked=true;
|
||||
relmouse=rp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
clicked=false;
|
||||
}
|
||||
if (clicked) {
|
||||
Vector2 nwp{
|
||||
mp.x-relmouse.x, mp.y-relmouse.y
|
||||
};
|
||||
int cm=GetCurrentMonitor();
|
||||
Vector2 mop=GetMonitorPosition(cm);
|
||||
int newwpx=nwp.x-mop.x;
|
||||
int newwpy=nwp.y-mop.y;
|
||||
int maxwpx=GetMonitorWidth(cm)-GetScreenWidth();
|
||||
int maxwpy=GetMonitorHeight(cm)-GetScreenHeight();
|
||||
newwpx=newwpx>maxwpx?maxwpx:newwpx<0?0:newwpx;
|
||||
newwpy=newwpy>maxwpy?maxwpy:newwpy<0?0:newwpy;
|
||||
SetWindowPosition(newwpx,newwpy);
|
||||
}
|
||||
}
|
||||
void draw()override{this->textured::draw();}
|
||||
void exit()override{}
|
||||
private:
|
||||
Image img;bool justclicked;bool clicked=false;
|
||||
Vector2 relmouse;
|
||||
};
|
||||
|
||||
struct logi: public virtual textfield {
|
||||
logi(Texture2D* texture,Color textcol,Color color,float x,float y,float w,float h,Font f,float fs,std::string txt) {
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};this->content=txt;
|
||||
this->texture=texture;this->txc=textcol;this->c=color;
|
||||
this->font=f;
|
||||
this->fs=fs;
|
||||
}
|
||||
void draw() override {
|
||||
Vector2 p=pos;
|
||||
float spacing=fs/2.0f;
|
||||
std::stringstream ss(content);
|
||||
std::string line;
|
||||
int lines=0;
|
||||
|
||||
while (std::getline(ss, line)) {
|
||||
if (lines%2==0) {
|
||||
Vector2 charPos=p;
|
||||
for (char& c : line) {
|
||||
char str[2]={c, '\0'};
|
||||
Color fc=Color{255,0,255,255};
|
||||
if (c=='/'||c==':') {
|
||||
fc=Color{255,255,0,255};
|
||||
}
|
||||
|
||||
DrawTextEx(font, str, charPos, (float)fs, spacing, fc);
|
||||
charPos.x+=MeasureTextEx(font, str, (float)fs, spacing).x;
|
||||
}
|
||||
} else {
|
||||
DrawTextEx(font, line.c_str(), p, (float)fs, spacing, Color{0,255,255,255});
|
||||
}
|
||||
|
||||
p.y+=(fs+2);
|
||||
lines++;
|
||||
}
|
||||
}
|
||||
};
|
||||
void playbuttonfunc();
|
||||
void quit(){exit(0);}
|
||||
#include <boost/process.hpp>
|
||||
class launcher:public program {
|
||||
public:
|
||||
Texture2D bg;
|
||||
Texture2D buttonfore;
|
||||
Texture2D buttonlock;
|
||||
Texture2D playbtn[2];
|
||||
Texture2D menubtn[3];
|
||||
button* buttons[8];
|
||||
button* playbutton;
|
||||
Texture2D buttonslabel[8];
|
||||
Font gamename,changelog,information;
|
||||
bool vsync=true;
|
||||
RenderTexture2D target;
|
||||
text version;
|
||||
std::string selectedversion="";
|
||||
Image img;
|
||||
bool captured=true;
|
||||
const char* CONF() final{return "test.tdf";}
|
||||
launcher(){};
|
||||
void boot() override {
|
||||
tickrate=15;
|
||||
framerate=15;
|
||||
SetConfigFlags(FLAG_WINDOW_UNDECORATED|FLAG_WINDOW_TRANSPARENT|FLAG_WINDOW_TOPMOST);
|
||||
tiny::error("is transparent lol");
|
||||
InitWindow(600,300,"test");target=LoadRenderTexture(600, 300);
|
||||
img=GenImageColor(600, 300, rl::BLANK);
|
||||
SetTargetFPS(GetMonitorRefreshRate(GetCurrentMonitor()));
|
||||
this->tickrate=GetMonitorRefreshRate(GetCurrentMonitor());
|
||||
bg=LoadTexture("res/launcher.png");
|
||||
buttonfore=LoadTexture("res/forebuttonon.png");
|
||||
buttonlock=LoadTexture("res/lockbutton.png");
|
||||
gamename=LoadFont("res/showcase.ttf");
|
||||
changelog=LoadFont("res/log.ttf");
|
||||
information=LoadFont("res/info.ttf");
|
||||
menubtn[0]=LoadTexture("res/btn.png");
|
||||
menubtn[1]=LoadTexture("res/btnhover.png");
|
||||
menubtn[2]=LoadTexture("res/btnpress.png");
|
||||
selectedversion=nete.currentversion;
|
||||
version= text (nullptr,Color{255,255,255,255},Color{0,0,0,0},96,16*17,1,1,information,20,"version: "+selectedversion);
|
||||
SetTraceLogLevel(LOG_ERROR);
|
||||
buttons[0]=new button(&menubtn[0], {255,255,255,255},468,58,96,16,nullptr);
|
||||
buttonslabel[0]=LoadTexture("res/options.png");
|
||||
buttons[1]=new button(&menubtn[0], {255,255,255,255},468,58+(18*1),96,16,std::function<void()>([]() {
|
||||
OpenURL("http://kosumi.ddns.net:60000/");
|
||||
}));
|
||||
buttonslabel[1]=LoadTexture("res/website.png");
|
||||
buttons[2]=new button(&menubtn[0], {255,255,255,255},468,58+(18*2),96,16,std::function<void()>([]() {
|
||||
OpenURL("http://kosumi.ddns.net:60001/");
|
||||
}));
|
||||
buttonslabel[2]=LoadTexture("res/forums.png");
|
||||
buttons[3]=new button(&menubtn[0], {255,255,255,255},468,58+(18*3),96,16,std::function<void()>([]() {
|
||||
OpenURL("https://github.com/kin-fuyuki/allgames/issues");
|
||||
}));
|
||||
buttonslabel[3]=LoadTexture("res/help.png");
|
||||
buttons[4]=new button(&menubtn[0], {255,255,255,255},468,58+(18*4),96,16,std::function<void()>([]() {
|
||||
nete.download();
|
||||
}));
|
||||
buttonslabel[4]=LoadTexture("res/update.png");
|
||||
buttons[5]=new button(&menubtn[0], {255,255,255,255},468,58+(18*5),96,16,nullptr);
|
||||
buttonslabel[5]=LoadTexture("res/verify.png");
|
||||
buttons[6]=new button(&menubtn[0], {255,255,255,255},468,58+(18*6)+15,96,16,nullptr);
|
||||
buttonslabel[6]=LoadTexture("res/versions.png");
|
||||
buttons[7]=new button(&menubtn[0], {255,255,255,255},468,58+(18*7)+17,96,16,std::function<void()>([]() {
|
||||
quit();
|
||||
}));
|
||||
buttonslabel[7]=LoadTexture("res/exit.png");
|
||||
playbtn[0]=LoadTexture("res/playoff.png");
|
||||
playbtn[1]=LoadTexture("res/playon.png");
|
||||
playbutton= new button(&playbtn[0], {255,255,255,255},406,(18*11)+17+9,153,59,std::function<void()>(playbuttonfunc));
|
||||
currentscene->nodes=std::list<node*>{
|
||||
new background(&bg,0,0,600,300),
|
||||
new textured(&buttonfore,3,36,62,62),
|
||||
new textured(&buttonlock,3,36+((62+4)*1),62,62),
|
||||
new textured(&buttonlock,3,36+((62+4)*2),62,62),
|
||||
new textured(&buttonlock,3,36+((62+4)*3),62,62),
|
||||
new text(nullptr,Color{0,255,0,255},{0,0,0,0},232,19,1,1,gamename,16,"FORESPEND"),
|
||||
buttons[0],new textured(&buttonslabel[0],468,58,96,16),
|
||||
buttons[1],new textured(&buttonslabel[1],468,58+(18*1),96,16),
|
||||
buttons[2],new textured(&buttonslabel[2],468,58+(18*2),96,16),
|
||||
buttons[3],new textured(&buttonslabel[3],468,58+(18*3),96,16),
|
||||
buttons[4],new textured(&buttonslabel[4],468,58+(18*4),96,16),
|
||||
buttons[5],new textured(&buttonslabel[5],468,58+(18*5),96,16),
|
||||
buttons[6],new textured(&buttonslabel[6],468,58+(18*6)+15,96,16),
|
||||
buttons[7],new textured(&buttonslabel[7],468,58+(18*7)+17,96,16),
|
||||
playbutton,
|
||||
new logi(nullptr,Color{255,0,255,255},Color{0,0,0,0},90,58,466,159,changelog,8,nete.changelog),
|
||||
new text(nullptr,Color{255,255,255,255},Color{0,0,0,0},96+16,(16*14)-3,1,1,information,20,"downloaded verified"),
|
||||
&version,
|
||||
};
|
||||
currentscene->boot();
|
||||
}
|
||||
int buttondelay=0;
|
||||
void tick() override {
|
||||
if (nete.currentversion!=selectedversion) {
|
||||
selectedversion=nete.currentversion;
|
||||
this->version.content="version: "+selectedversion;
|
||||
tiny::echo("selecting version: %s",selectedversion.c_str());
|
||||
}
|
||||
{
|
||||
for (button* b : buttons) {
|
||||
if (b->hover) {
|
||||
if (b->pressed) {
|
||||
b->texture=&menubtn[2];
|
||||
buttondelay=5;
|
||||
}else {
|
||||
if (b->texture->id==menubtn[2].id) {
|
||||
if(buttondelay<0) {
|
||||
b->texture=&menubtn[1];
|
||||
}
|
||||
}else {
|
||||
b->texture=&menubtn[1];
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (b->texture->id==menubtn[2].id) {
|
||||
if(buttondelay<0) {
|
||||
b->texture=&menubtn[0];
|
||||
}
|
||||
}else {
|
||||
b->texture=&menubtn[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
if (playbutton->pressed) {
|
||||
playbutton->texture=&playbtn[1];
|
||||
buttondelay=5;
|
||||
}else {
|
||||
if(buttondelay<0) {
|
||||
playbutton->texture=&playbtn[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
currentscene->tick();
|
||||
buttondelay--;
|
||||
}
|
||||
bool changedmenu=true;
|
||||
bool itemchanged=true;
|
||||
void draw() override {
|
||||
BeginTextureMode(target);
|
||||
currentscene->draw();
|
||||
EndTextureMode();
|
||||
BeginDrawing();
|
||||
ClearBackground(rl::BLANK);
|
||||
DrawTexturePro(target.texture, {0, 0, 600, -300}, {0, 0, 600, 300}, {0, 0}, 0, rl::WHITE);
|
||||
EndDrawing();
|
||||
Vector2 mp=Vector2(GetMousePositionDesktop());
|
||||
Vector2 wp=GetWindowPosition();
|
||||
Vector2 rp=Vector2{mp.x-wp.x,mp.y-wp.y};
|
||||
if (rp.x>=0&&rp.y>=0&&rp.x<600&&rp.y<300) {
|
||||
if (changedmenu) {
|
||||
UnloadImage(img);
|
||||
img=LoadImageFromTexture(target.texture);
|
||||
changedmenu=false;
|
||||
}
|
||||
Color pix=GetImageColor(img, (int)rp.x, (int)(300-rp.y));
|
||||
if (pix.a==0) {
|
||||
SetWindowState(FLAG_WINDOW_MOUSE_PASSTHROUGH);
|
||||
captured=false;
|
||||
} else {
|
||||
ClearWindowState(FLAG_WINDOW_MOUSE_PASSTHROUGH);
|
||||
captured=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
void exit() override {
|
||||
currentscene->exit();
|
||||
}
|
||||
};
|
||||
|
||||
launcher* launch;
|
||||
tiny::ErrorLevel tiny::level{8};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
tiny::startup((char*)"enginend test",(char*)"1.0");
|
||||
tiny::echo ("checking if cfg.tdf exists, if not create");
|
||||
std::ofstream tdffile("cfg.tdf");
|
||||
tdffile.close();
|
||||
|
||||
tiny::echo ("read cfg.tdf");
|
||||
tiny::TDF_FILE config;config.filepath="cfg.tdf";config.read();
|
||||
std::string version;
|
||||
tiny::echo ("getting version");
|
||||
try {version=config.getstring({"version"});}
|
||||
catch (tiny::TDF_ERR e) {version="NULL";}
|
||||
if (version!="NULL") {
|
||||
nete.currentversion=version;
|
||||
config.setstring({"version"},nete.currentversion);
|
||||
}
|
||||
launcher e;
|
||||
launch=&e;
|
||||
tiny::echo ("starting net");
|
||||
nete.start();
|
||||
tiny::echo ("downloading github info");
|
||||
nete.github();
|
||||
tiny::echo ("starting launcher");
|
||||
e.boot();
|
||||
std::atomic<bool> running{true};
|
||||
|
||||
std::thread tickthread([&e, &running]() {
|
||||
double tickrate=1.0/e.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) {
|
||||
e.tick();
|
||||
lasttick=now;
|
||||
} else {
|
||||
std::this_thread::sleep_for(std::chrono::duration<double>(tickrate-elapsed));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
double framerate=1.0/e.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) {
|
||||
e.draw();
|
||||
lastframe=now;
|
||||
} else {
|
||||
WaitTime(framerate-elapsed);
|
||||
}
|
||||
}
|
||||
|
||||
running=false;
|
||||
tickthread.join();
|
||||
|
||||
e.exit();
|
||||
config.setstring({"version"},nete.currentversion);
|
||||
config.save();
|
||||
config.close();
|
||||
return 0;
|
||||
}
|
||||
void playbuttonfunc() {
|
||||
if (nete.currentversion!="NULL") {
|
||||
FILE* gameexe = fopen(("forespend/versions/"+nete.currentversion+"/bin/game").c_str(), "r");
|
||||
if (gameexe) {
|
||||
fclose(gameexe);
|
||||
|
||||
std::thread thread([]() {
|
||||
boost::process::system("bin/game",boost::process::start_dir=("forespend/versions/"+nete.currentversion));
|
||||
});
|
||||
exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#include "netio.h"
|
||||
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) {
|
||||
size_t written = fwrite(ptr, size, nmemb, stream);
|
||||
return written;
|
||||
};
|
||||
|
|
@ -1,229 +0,0 @@
|
|||
#pragma once
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <curl/curl.h>
|
||||
#include<zip.h>
|
||||
#include <sys/stat.h>
|
||||
#include <tiny/tdf.h>
|
||||
#include <json.h>
|
||||
#ifndef GAMEPLATFORM
|
||||
#define GAMEPLATFORM "l5.64"
|
||||
#endif
|
||||
extern size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
inline void makedirs(std::string path) {
|
||||
size_t pos = 0;
|
||||
while ((pos = path.find_first_of('/', pos)) != std::string::npos) {
|
||||
std::string dir = path.substr(0, pos);
|
||||
if (!dir.empty()) {
|
||||
#ifdef _WIN32
|
||||
mkdir(dir.c_str(), 0);
|
||||
#else
|
||||
mkdir(dir.c_str(), 0755);
|
||||
#endif
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
struct netio {
|
||||
netio()= default;
|
||||
std::string url="https://github.com/kin-fuyuki/forespend_cpp/releases/download/";
|
||||
std::vector<std::string> *versionhistory;
|
||||
std::string changelog="could not connect to github\nplease check your internet connection";
|
||||
std::string currentversion="NULL";
|
||||
std::string newestversion="";
|
||||
|
||||
void start() {
|
||||
const int MAX_RETRIES = 3;
|
||||
int attempts = 0;
|
||||
bool download_success = false;
|
||||
|
||||
while (attempts < MAX_RETRIES && !download_success) {
|
||||
CURL* curltdf = curl_easy_init();
|
||||
if (curltdf) {
|
||||
FILE* history = fopen("versions.tdf", "wb");
|
||||
if (!history) break;
|
||||
|
||||
curl_easy_setopt(curltdf, CURLOPT_URL, "https://raw.githubusercontent.com/kin-fuyuki/allgames/refs/heads/master/versions.tdf");
|
||||
curl_easy_setopt(curltdf, CURLOPT_WRITEFUNCTION, write_data);
|
||||
curl_easy_setopt(curltdf, CURLOPT_WRITEDATA, history);
|
||||
|
||||
CURLcode ret = curl_easy_perform(curltdf);
|
||||
fclose(history);
|
||||
curl_easy_cleanup(curltdf);
|
||||
|
||||
if (ret == CURLE_OK) {
|
||||
download_success = true;
|
||||
} else {
|
||||
attempts++;
|
||||
tiny::warning("Version fetch failed (Attempt %d/%d): %s", attempts, MAX_RETRIES, curl_easy_strerror(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!download_success) {
|
||||
tiny::fatal("Could not download versions.tdf after %d attempts.", MAX_RETRIES);
|
||||
return;
|
||||
}
|
||||
|
||||
// Processing the file
|
||||
tiny::TDF_FILE fetchversions;
|
||||
fetchversions.filepath = "versions.tdf";
|
||||
fetchversions.read();
|
||||
|
||||
boost::unordered_map<std::string, tiny::TDF_DATA>* foreversions = fetchversions.getclass({"forespend"});
|
||||
if (!foreversions) return;
|
||||
|
||||
std::vector<std::string> versions;
|
||||
for (auto& version : *foreversions) {
|
||||
if (version.second.type == tiny::TDF_Type::TDF_DEFINES) {
|
||||
versions = *(std::vector<std::string>*)version.second.datapointer;
|
||||
}
|
||||
}
|
||||
|
||||
if (versions.empty()) return;
|
||||
|
||||
std::sort(versions.begin(), versions.end(), [](const std::string& a, const std::string& b) {
|
||||
int ra = 0, rb = 0;
|
||||
float va = 0.0f, vb = 0.0f;
|
||||
char pa = ' ', pb = ' ';
|
||||
char rea = ' ', reb = ' ';
|
||||
sscanf(a.c_str(), "%d.%f.%c.%c", &ra, &va, &pa, &rea);
|
||||
sscanf(b.c_str(), "%d.%f.%c.%c", &rb, &vb, &pb, &reb);
|
||||
if (ra != rb) return ra > rb;
|
||||
if (va != vb) return va > vb;
|
||||
if (pa != pb) return pa > pb;
|
||||
return rea < reb;
|
||||
});
|
||||
|
||||
this->newestversion = versions[0]; // Sort is descending, index 0 is newest
|
||||
if (this->newestversion != "") {
|
||||
this->currentversion = newestversion;
|
||||
}
|
||||
|
||||
tiny::success("\n\nforespend versions found:");
|
||||
for (auto& version : versions) {
|
||||
tiny::warning("%s", version.c_str());
|
||||
}
|
||||
|
||||
// Use a member or persistent copy to avoid pointer to local variable
|
||||
static std::vector<std::string> persistent_versions;
|
||||
persistent_versions = versions;
|
||||
versionhistory = &persistent_versions;
|
||||
}
|
||||
void github() {
|
||||
CURL* curl;
|
||||
CURLcode res;
|
||||
FILE* commitsjson = fopen("commitsjson", "wb");
|
||||
curl = curl_easy_init();
|
||||
if (curl) {
|
||||
std::string u = "https://api.github.com/repos/kin-fuyuki/allgames/commits";
|
||||
struct curl_slist* headers = NULL;
|
||||
headers = curl_slist_append(headers, "User-Agent: C++-App"); // Required by GitHub
|
||||
curl_easy_setopt(curl, CURLOPT_URL, u.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, commitsjson);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10L);
|
||||
res = curl_easy_perform(curl);
|
||||
fclose(commitsjson);
|
||||
changelog="changelog download error";
|
||||
if (res == CURLE_OK) {
|
||||
try {
|
||||
changelog="json read error";
|
||||
FILE* thecommits=fopen("commitsjson","rb");
|
||||
changelog="json parse error";
|
||||
nlohmann::json commits = nlohmann::json::parse(thecommits);
|
||||
std::ostringstream oss;
|
||||
std::vector<std::string> monthNames = {
|
||||
"", "jan", "feb", "mar", "apr", "may", "jun",
|
||||
"jul", "aug", "sep", "oct", "nov", "dec"
|
||||
};
|
||||
std::string lastMonth = "";
|
||||
std::string currentYear = "";
|
||||
int limit = std::min((int)commits.size(), 8);
|
||||
for (int i = 0; i < limit; ++i) {
|
||||
auto& item = commits[i];
|
||||
std::string message = item["commit"]["message"];
|
||||
std::string date = item["commit"]["author"]["date"]; // Format: 2025-12-21T13:08:50Z
|
||||
// Extract components: YYYY-MM-DD and HH:MM:SS
|
||||
std::string y = date.substr(0, 4);
|
||||
std::string m = date.substr(5, 2);
|
||||
std::string d = date.substr(8, 2);
|
||||
std::string t = date.substr(11, 8);
|
||||
// Format: MM/DD/YYYY HH:MM:SS
|
||||
std::string first_line = message.substr(0, message.find('\n'));
|
||||
oss << m << "/" << d << "/" << y << " " << t << "\n" << " " << first_line << "\n";
|
||||
}
|
||||
changelog = oss.str();
|
||||
tiny::fatal("%s", changelog.c_str() );
|
||||
} catch (nlohmann::json::parse_error& e) {
|
||||
tiny::fatal("JSON Parse Error: %s", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void download() {
|
||||
CURLcode ret;
|
||||
std::string version=versionhistory->at(0);
|
||||
tiny::success("using version: %s\ndownloading from: %s",version.c_str(),(url+version+"/"+GAMEPLATFORM+"."+version+".zip").c_str());
|
||||
|
||||
CURL*curl = curl_easy_init();
|
||||
FILE* file = fopen(("fore."+version+".zip").c_str(), "wb");
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10L);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "https://github.com/kin-fuyuki/forespend_cpp/releases/download/0.03.a.g/l5.64.0.03.a.g.zip");
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
|
||||
ret = curl_easy_perform(curl);
|
||||
curl_easy_cleanup(curl);
|
||||
fclose(file);
|
||||
|
||||
|
||||
makedirs("forespend/versions/"+version+"/");
|
||||
int err=0;
|
||||
zip *z=zip_open("fore.0.03.a.g.zip",0,&err);
|
||||
if (z) {
|
||||
|
||||
zip_int64_t it=zip_get_num_entries(z, 0);
|
||||
for (zip_int64_t i = 0; i < it; ++i) {
|
||||
struct zip_stat st;
|
||||
zip_stat_init(&st);
|
||||
if (zip_stat_index(z, i, 0, &st) != 0) continue;
|
||||
std::string name = st.name;
|
||||
std::string full = "forespend/versions/"+version+"/" + name;
|
||||
if (name.back() == '/') {
|
||||
#ifdef _WIN32
|
||||
mkdir(full.c_str(), 0);
|
||||
#else
|
||||
mkdir(full.c_str(), 0755);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
size_t pos = full.find_last_of('/');
|
||||
if (pos != std::string::npos) {
|
||||
std::string dir = full.substr(0, pos);
|
||||
#ifdef _WIN32
|
||||
mkdir(dir.c_str(), 0);
|
||||
#else
|
||||
mkdir(dir.c_str(), 0755);
|
||||
#endif
|
||||
}
|
||||
zip_file_t *zf = zip_fopen_index(z, i, 0);
|
||||
if (zf) {
|
||||
std::ofstream ofs(full, std::ios::binary);
|
||||
char buff[1 << 16];
|
||||
zip_int64_t read;
|
||||
while ((read = zip_fread(zf, buff, sizeof(buff))) > 0) {
|
||||
ofs.write(buff, read);
|
||||
}
|
||||
ofs.close();
|
||||
zip_fclose(zf);
|
||||
}
|
||||
}
|
||||
zip_close(z);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-std=c++17 -Wno-error")
|
||||
file(GLOB_RECURSE FORESPEND_SOURCES CONFIGURE_DEPENDS "src/*.cpp")
|
||||
add_executable(forespend ${FORESPEND_SOURCES})
|
||||
|
||||
set_target_properties(forespend PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/built/forespend/${PLATFORM_DIR}/bin"
|
||||
)
|
||||
|
||||
target_link_directories(
|
||||
forespend PUBLIC
|
||||
"${CMAKE_SOURCE_DIR}/link")
|
||||
target_link_libraries(forespend PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}/link/libenginend.so"
|
||||
"${CMAKE_SOURCE_DIR}/link/libdesktopraylib.so"
|
||||
)
|
||||
target_include_directories(forespend PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/lib/raylib/build/raylib/include
|
||||
${CMAKE_SOURCE_DIR}/engine/include
|
||||
)
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#include "client.h"
|
||||
|
||||
#include "scenes/mainmenu.h"
|
||||
|
||||
client::client() {
|
||||
|
||||
}
|
||||
void client::boot() {
|
||||
this->framerate=60;
|
||||
this->tickrate=20;
|
||||
// SetConfigFlags();
|
||||
InitWindow(380,240,"forespend - 0.03h");
|
||||
initconfigmenu();
|
||||
this->currentscene=new mainmenu();
|
||||
this->currentscene->boot();
|
||||
target=LoadRenderTexture(380,240);
|
||||
}
|
||||
void client::draw() {
|
||||
BeginDrawing();
|
||||
ClearBackground(WHITE);
|
||||
this->currentscene->draw();
|
||||
EndDrawing();
|
||||
}
|
||||
void client::exit() {
|
||||
this->currentscene->exit();
|
||||
delete this->currentscene;
|
||||
}
|
||||
void client::tick() {
|
||||
this->currentscene->tick();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#pragma once
|
||||
#include <incmgr.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;
|
||||
|
||||
};
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
#include "configmenu.h"
|
||||
|
||||
#include <enginend/scenes/node2d.h>
|
||||
Font forefont;
|
||||
|
||||
enginend::group mainpage= enginend::group(
|
||||
{
|
||||
new enginend::nodes::labeledbutton("graphics",nullptr,{255,127,0,255},{0,0,0,0},100,100,0,0,std::function<void()>([]() {
|
||||
|
||||
}),forefont,32),
|
||||
|
||||
}
|
||||
);
|
||||
enginend::group graphics= enginend::group(
|
||||
{
|
||||
|
||||
}
|
||||
);
|
||||
enginend::group sound= enginend::group(
|
||||
{
|
||||
|
||||
}
|
||||
);
|
||||
enginend::group controls= enginend::group(
|
||||
{
|
||||
|
||||
}
|
||||
);
|
||||
void initconfigmenu() {
|
||||
forefont=LoadFont(AT("res/fonts/dos.fnt"));
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#pragma once
|
||||
#include <vector>
|
||||
#include <incmgr.h>
|
||||
|
||||
extern Font forefont;
|
||||
extern enginend::group maincfgpage;
|
||||
extern enginend::group graphics;
|
||||
extern enginend::group sound;
|
||||
extern enginend::group controls;
|
||||
|
||||
void initconfigmenu();
|
||||
|
|
@ -1 +0,0 @@
|
|||
#include "game.h"
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#pragma once
|
||||
#include <incmgr.h>
|
||||
|
||||
|
||||
class game :public virtual enginend::scene {
|
||||
|
||||
};
|
||||
|
|
@ -1 +0,0 @@
|
|||
#include "mainmenu.h"
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#pragma once
|
||||
#include <incmgr.h>
|
||||
#include <enginend/scenes/node2drelative.h>
|
||||
#include "configmenu.h"
|
||||
#include <enginend/scenes/node2d.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();
|
||||
}
|
||||
};
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
#include <atomic>
|
||||
#include <incmgr.h>
|
||||
#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;
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#include "server.h"
|
||||
|
||||
server::server() {}
|
||||
|
||||
void server::boot() {}
|
||||
void server::draw() {}
|
||||
void server::exit() {}
|
||||
void server::tick() {}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <incmgr.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,14 +0,0 @@
|
|||
#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"
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
#include "graph/window.h"
|
||||
|
|
@ -1 +0,0 @@
|
|||
#include <raylib.h>
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
#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;
|
||||
}
|
||||
};}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,338 +0,0 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#include "nodes.h"
|
||||
|
||||
namespace enginend {
|
||||
namespace nodes {
|
||||
struct node2d :public node {
|
||||
Vector2 pos;
|
||||
node2d(){}
|
||||
node2d(float x,float y):pos(Vector2{x,y}){}
|
||||
};
|
||||
struct rect :virtual public node2d{
|
||||
Vector2 size;
|
||||
rect(){}
|
||||
rect(float x,float y,float w,float h):size(Vector2{w,h}){
|
||||
this->pos=Vector2{x,y};
|
||||
}
|
||||
};
|
||||
struct textured :virtual public rect{
|
||||
Texture2D* texture;
|
||||
textured(){}
|
||||
textured(Texture2D* texture,float x,float y,float w,float h):texture(texture){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};
|
||||
}
|
||||
void boot()override{}
|
||||
void tick()override{}
|
||||
void draw()override{if(texture!=nullptr)DrawTexture(*texture,pos.x,pos.y,rl::WHITE);}
|
||||
void exit()override{delete texture;}
|
||||
};
|
||||
struct animated : virtual public textured {
|
||||
Image animimage;
|
||||
int frames;
|
||||
int currentframe;
|
||||
int framedelay;
|
||||
int framecounter;
|
||||
unsigned int nextframeoffset;
|
||||
int prevframe;
|
||||
|
||||
animated() : frames(0), currentframe(0), framedelay(6), framecounter(0), nextframeoffset(0) {
|
||||
animimage.data = nullptr;
|
||||
}
|
||||
|
||||
animated(const char* gifpath, Vector2 position, Vector2 size, int delay = 6)
|
||||
: textured(nullptr, position.x, position.y, size.x, size.y),
|
||||
framedelay(delay), currentframe(0), framecounter(0), frames(0), nextframeoffset(0)
|
||||
{
|
||||
animimage = LoadImageAnim(gifpath, &frames);
|
||||
if (frames > 0) {
|
||||
texture = new Texture2D(LoadTextureFromImage(animimage));
|
||||
}
|
||||
}
|
||||
|
||||
void tick() override {
|
||||
textured::tick();
|
||||
if (frames <= 1) return;
|
||||
|
||||
framecounter++;
|
||||
if (framecounter >= framedelay) {
|
||||
framecounter = 0;
|
||||
currentframe++;
|
||||
if (currentframe >= frames) currentframe = 0;
|
||||
nextframeoffset = animimage.width * animimage.height * 4 * currentframe;
|
||||
}
|
||||
}
|
||||
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);
|
||||
if (texture) {
|
||||
UnloadTexture(*texture);
|
||||
delete texture;
|
||||
texture = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
struct colored :virtual public rect{
|
||||
Color c;
|
||||
colored(){}
|
||||
colored(Color color,float x,float y,float w,float h):c(color){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};
|
||||
}
|
||||
void boot()override{}
|
||||
void tick()override{}
|
||||
void draw()override{DrawRectangle(pos.x,pos.y,size.x,size.y,c);}
|
||||
void exit()override{}
|
||||
};
|
||||
struct tinted :virtual public colored,virtual public textured{
|
||||
tinted(){}
|
||||
tinted(Texture2D* texture,Color color,float x,float y,float w,float h):
|
||||
node2d(x,y),
|
||||
rect(x,y,w,h),
|
||||
colored(color,x,y,w,h),
|
||||
textured(texture,x,y,w,h)
|
||||
{}
|
||||
void boot()override{this->colored::boot();this->textured::boot();}
|
||||
void tick()override{this->colored::tick();this->textured::tick();}
|
||||
void draw()override{if(texture!=nullptr)DrawTexture(*texture,pos.x,pos.y,c);}
|
||||
void exit()override{this->colored::exit();this->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,float x,float y,float w,float h,Font f,float fsize,std::string txt):
|
||||
font(f),fs(fsize),content(txt)
|
||||
{
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};this->texture=texture;this->c=color;this->txc=txcol;
|
||||
|
||||
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{this->tinted::boot();}
|
||||
void tick()override {
|
||||
this->tinted::tick();
|
||||
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 {
|
||||
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>size.y)?minsize.y:size.y;
|
||||
int minw=(minsize.x>size.x)?minsize.x:size.x;
|
||||
DrawRectangle(pos.x-charsize.x,pos.y-charsize.y,minw+p,minh+p,c);
|
||||
DrawTextEx(font,content.c_str(),pos,fs,1,txc);
|
||||
}
|
||||
void exit()override{this->tinted::exit();}
|
||||
};
|
||||
struct button :virtual public tinted{
|
||||
std::function<void()> func;
|
||||
bool pressed;
|
||||
bool hover;
|
||||
button():pressed(false){}
|
||||
button(Texture2D* texture,Color color,float x,float y,float w,float h,std::function<void()> f):func(f),pressed(false){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};this->texture=texture;this->c=color;
|
||||
}
|
||||
void boot()override{this->tinted::boot();}
|
||||
void tick()override{
|
||||
this->tinted::tick();
|
||||
Vector2 mouse=GetMousePosition();
|
||||
if(CheckCollisionPointRec(mouse,{pos.x,pos.y,size.x,size.y})){hover=true;
|
||||
if(IsMouseButtonPressed(MOUSE_LEFT_BUTTON)){
|
||||
pressed=true;
|
||||
if(func)func();
|
||||
}else{
|
||||
pressed=false;
|
||||
}
|
||||
}else{
|
||||
hover=false;
|
||||
}
|
||||
}
|
||||
void draw()override {
|
||||
if(this->texture!=nullptr)DrawTexture(*texture,pos.x,pos.y,c);
|
||||
else DrawRectangle(pos.x,pos.y,size.x,size.y,c);
|
||||
}
|
||||
void exit()override{this->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,
|
||||
float x,float y,float w,float h,std::function<void()> f,
|
||||
Font fnt,int size):font(fnt),fs(size),txc(text){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{w,h};this->texture=texture;this->c=color;
|
||||
this->func=f;this->pressed=false;
|
||||
this->label=name;
|
||||
}
|
||||
void boot()override{this->button::boot();}
|
||||
void tick()override{this->button::tick();}
|
||||
void draw()override{
|
||||
this->button::draw();
|
||||
Vector2 tsize=MeasureTextEx(font,label.c_str(),fs,1);
|
||||
Vector2 tpos={
|
||||
pos.x+(size.x-tsize.x)/2,
|
||||
pos.y+(size.y-tsize.y)/2
|
||||
};
|
||||
DrawTextEx(font,label.c_str(),tpos,fs,1,txc);
|
||||
}
|
||||
void exit()override{this->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,float x,float y,float w,float h,float min,float max,float v):val(v),minv(min),maxv(max){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{x,y};this->texture=texture;this->c=color;
|
||||
}
|
||||
void boot()override{this->tinted::boot();}
|
||||
void tick()override{
|
||||
this->tinted::tick();
|
||||
Vector2 mouse=GetMousePosition();
|
||||
if(CheckCollisionPointRec(mouse,{pos.x,pos.y,size.x,size.y})&&IsMouseButtonDown(MOUSE_LEFT_BUTTON)){
|
||||
float t=(mouse.x-pos.x)/size.x;
|
||||
val=minv+t*(maxv-minv);
|
||||
if(val<minv)val=minv;
|
||||
if(val>maxv)val=maxv;
|
||||
}
|
||||
}
|
||||
void draw()override{
|
||||
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);
|
||||
}
|
||||
void exit()override{this->tinted::exit();}
|
||||
};
|
||||
struct textfield :public text{
|
||||
textfield(){}
|
||||
textfield(Texture2D* texture,Color txcol,Color color,float x,float y,float w,float h,Font f,float fsize,std::string txt):
|
||||
text(texture,txcol,color,x,y,w,h,f,fsize,txt){}
|
||||
void boot()override{this->text::boot();}
|
||||
void tick()override{this->text::tick();}
|
||||
void draw()override{
|
||||
Vector2 p=pos;
|
||||
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>size.y)?minsize.y:size.y;
|
||||
int minw=(minsize.x>size.x)?minsize.x:size.x;
|
||||
DrawRectangle(pos.x-(po/2),pos.y-(po/2),minw+(po*1.1),minh+(po*1.1),c);
|
||||
DrawTextEx(font,content.c_str(),p,fs,charsize.x/2,this->txc);
|
||||
}
|
||||
void exit()override{this->text::exit();}
|
||||
};
|
||||
struct textinput :public text{
|
||||
bool active;
|
||||
int cpos;
|
||||
textinput():active(false),cpos(0){}
|
||||
textinput(Texture2D* texture,Color txcol,Color color,float x,float y,float w,float h,Font f,float fsize):active(false),cpos(0){
|
||||
this->pos=Vector2{x,y};this->size=Vector2{x,y};this->texture=texture;this->c=color;this->font=f;this->content="";
|
||||
this->txc=txcol;this->fs=fsize;
|
||||
}
|
||||
void boot()override{this->text::boot();}
|
||||
void tick()override{
|
||||
this->text::tick();
|
||||
Vector2 mouse=GetMousePosition();
|
||||
if(IsMouseButtonPressed(MOUSE_LEFT_BUTTON)){
|
||||
active=CheckCollisionPointRec(mouse,{pos.x,pos.y,size.x,size.y});
|
||||
}
|
||||
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{
|
||||
this->text::draw();
|
||||
if(active)DrawRectangle(pos.x+MeasureText(content.c_str(),fs),pos.y,2,fs,{0,0,0,127});
|
||||
}
|
||||
void exit()override{this->text::exit();}
|
||||
};
|
||||
struct textinputfield :public textfield{
|
||||
bool active;
|
||||
int cpos;
|
||||
textinputfield():active(false),cpos(0){}
|
||||
textinputfield(Texture2D* texture,Color txcol,Color color,float x,float y,float w,float h,Font f,float fsize):active(false),cpos(0),
|
||||
textfield(texture,txcol,color,x,y,w,h,f,fsize,""){}
|
||||
void boot()override{this->textfield::boot();}
|
||||
void tick()override{
|
||||
this->textfield::tick();
|
||||
Vector2 mouse=GetMousePosition();
|
||||
if(IsMouseButtonPressed(MOUSE_LEFT_BUTTON)){
|
||||
active=CheckCollisionPointRec(mouse,{pos.x,pos.y,size.x,size.y});
|
||||
}
|
||||
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{
|
||||
this->textfield::draw();
|
||||
if(active){
|
||||
Vector2 p=pos;
|
||||
float lh=fs+2;
|
||||
std::string line="";
|
||||
for(char ch:content){
|
||||
if(ch=='\n'){
|
||||
p.y+=lh;
|
||||
line="";
|
||||
}else{
|
||||
line+=ch;
|
||||
}
|
||||
}
|
||||
DrawRectangle(p.x+MeasureText(line.c_str(),fs),p.y,2,fs,rl::BLACK);
|
||||
}
|
||||
}
|
||||
void exit()override{this->textfield::exit();}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,417 +0,0 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#include "nodes.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,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)
|
||||
{
|
||||
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;
|
||||
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,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,BLACK);
|
||||
}
|
||||
}
|
||||
void exit()override{
|
||||
textfield::exit();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include "../gr.h"
|
||||
#include "../aud.h"
|
||||
#include "../net.h"
|
||||
#include<tiny/term.h>
|
||||
|
||||
namespace enginend {
|
||||
namespace nodes {
|
||||
struct node{
|
||||
public:
|
||||
virtual void boot()=0;
|
||||
virtual void tick()=0;
|
||||
virtual void draw()=0;
|
||||
virtual void exit()=0;
|
||||
};
|
||||
}
|
||||
struct group : public virtual enginend::nodes::node {
|
||||
std::vector<node*> children;
|
||||
void boot(){for (node* n: children){n->boot();}}
|
||||
void tick(){for (node* n: children){n->tick();}}
|
||||
void draw(){for (node* n: children){n->draw();}}
|
||||
void exit(){for (node* n: children){n->exit();}}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "nodes.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();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#pragma once
|
||||
#include <tiny/tdf.h>
|
||||
#include <tiny/term.h>
|
||||
#include <raylib.h>
|
||||
#include <raymath.h>
|
||||
#include <rlgl.h>
|
||||
#include <enginend/engine.h>
|
||||
25712
include/json.h
1
lib/enginend
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 394ce822eae2bc96eafb3a02f976b8f890fbe7ca
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 5e614e814bf88c22a2f3795358513a700d3a77d0
|
||||
1
lib/sdl2
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit cf5dabd6eaa1b7949b73eaf5268ae1c5e01ba3b6
|
||||
1
lib/sdl3
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 54de246b4b44610f7418495ee0485ddbc6e8cd20
|
||||
1
lib/tiny
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit e4887c7fa646bd318c87c3d18626ff8333da96df
|
||||
1
lib/tiny-lua
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit f02530e13ecde8bf0075b8f9c77372179a451245
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{ forespend
|
||||
0.03.a.g
|
||||
#0.04.a.g
|
||||
0.03.a.h
|
||||
#0.04.a.h
|
||||
#0.4.a.g
|
||||
#0.40.a.g
|
||||
#4.0.a.g
|
||||
|
|
|
|||