symlinking library headers for better portability
This commit is contained in:
parent
d04b700809
commit
55b9b9d4fa
28 changed files with 645 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ else()
|
||||||
set(PLATFORM_DIR "linux")
|
set(PLATFORM_DIR "linux")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(engine)
|
add_subdirectory(engine)
|
||||||
add_subdirectory(games/forespend)
|
add_subdirectory(games/forespend)
|
||||||
add_subdirectory(games/endlauncher)
|
add_subdirectory(games/endlauncher)
|
||||||
|
|
|
||||||
56
engine/CMakeLists.txt
Normal file
56
engine/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
target_include_directories(test PUBLIC
|
||||||
|
${CMAKE_SOURCE_DIR}/include
|
||||||
|
)
|
||||||
|
target_include_directories(enginend PUBLIC
|
||||||
|
${CMAKE_SOURCE_DIR}/include
|
||||||
|
|
||||||
|
)
|
||||||
342
engine/src/scenes/node2d.h
Normal file
342
engine/src/scenes/node2d.h
Normal file
|
|
@ -0,0 +1,342 @@
|
||||||
|
#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;
|
||||||
|
final bool isboolean;
|
||||||
|
button():pressed(false),isboolean(false){}
|
||||||
|
button(Texture2D* texture,Color color,float x,float y,float w,float h,std::function<void()> f):func(f),pressed(false),isboolean(false){
|
||||||
|
this->pos=Vector2{x,y};this->size=Vector2{w,h};this->texture=texture;this->c=color;
|
||||||
|
}
|
||||||
|
button(Texture2D* texture,Color color,float x,float y,float w,float h,std::function<void()> f,bool isboolean):func(f),pressed(false),isboolean(true){
|
||||||
|
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();}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
40
engine/src/scenes/nodes.h
Normal file
40
engine/src/scenes/nodes.h
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#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;
|
||||||
|
|
||||||
|
explicit group(std::vector<enginend::nodes::node *> nodes):children(nodes){};
|
||||||
|
|
||||||
|
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();}}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct theme {
|
||||||
|
// in case if its a boolean button, it will use booleanbutton
|
||||||
|
Color booleanbutton[3],button[3],booleantext[3],buttontext[3],text,buttonborder[3],booleanborder[3],border;
|
||||||
|
|
||||||
|
Font font;
|
||||||
|
|
||||||
|
Image slider,handle, checkbox,checkboxchecked;
|
||||||
|
|
||||||
|
Color tint;
|
||||||
|
};
|
||||||
|
}
|
||||||
19
games/endlauncher/CMakeLists.txt
Normal file
19
games/endlauncher/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
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"
|
||||||
|
curl zip
|
||||||
|
)
|
||||||
|
target_include_directories(endlauncher PUBLIC
|
||||||
|
${CMAKE_SOURCE_DIR}/include
|
||||||
|
)
|
||||||
22
games/forespend/CMakeLists.txt
Normal file
22
games/forespend/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
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})
|
||||||
|
if(NOT DEFINED ${ARCH})
|
||||||
|
set(ARCH "linux-64")
|
||||||
|
endif(NOT DEFINED ${ARCH})
|
||||||
|
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}/lib/raylib/${ARCH}/raylib/libraylib.a"
|
||||||
|
)
|
||||||
|
target_include_directories(forespend PUBLIC
|
||||||
|
${CMAKE_SOURCE_DIR}/include
|
||||||
|
)
|
||||||
33
games/forespend/src/client/client.cpp
Normal file
33
games/forespend/src/client/client.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
#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(rl::WHITE);
|
||||||
|
this->currentscene->draw();
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
|
void client::exit() {
|
||||||
|
this->currentscene->exit();
|
||||||
|
delete this->currentscene;
|
||||||
|
}
|
||||||
|
void client::tick() {
|
||||||
|
this->currentscene->tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
40
games/forespend/src/client/scenes/configmenu.cpp
Normal file
40
games/forespend/src/client/scenes/configmenu.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#include "configmenu.h"
|
||||||
|
|
||||||
|
#include <enginend/scenes/node2d.h>
|
||||||
|
Font forefont;
|
||||||
|
int configmenupage=0; // 0 is before the mainpage is showing. aka pause menu/main menu when start game
|
||||||
|
enginend::group mainpage= enginend::group(
|
||||||
|
{
|
||||||
|
new enginend::nodes::labeledbutton("video",nullptr,{255,127,0,255},{0,0,0,0},100,100,0,0,std::function<void()>([]() {
|
||||||
|
|
||||||
|
}),forefont,32),
|
||||||
|
new enginend::nodes::labeledbutton("sound",nullptr,{255,127,0,255},{0,0,0,0},100,100,0,0,std::function<void()>([]() {
|
||||||
|
|
||||||
|
}),forefont,32),
|
||||||
|
new enginend::nodes::labeledbutton("input",nullptr,{255,127,0,255},{0,0,0,0},100,100,0,0,std::function<void()>([]() {
|
||||||
|
|
||||||
|
}),forefont,32),
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
enginend::group graphics= enginend::group(
|
||||||
|
{
|
||||||
|
new enginend::nodes::labeledbutton("fullscreen",nullptr,{255,127,0,255},{0,0,0,0},100,100,0,0,std::function<void()>([]() {
|
||||||
|
|
||||||
|
}),forefont,32),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
enginend::group sound= enginend::group(
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
enginend::group controls= enginend::group(
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
void initconfigmenu() {
|
||||||
|
forefont=LoadFont(AT("res/fonts/dos.fnt"));
|
||||||
|
}
|
||||||
11
games/forespend/src/client/scenes/configmenu.h
Normal file
11
games/forespend/src/client/scenes/configmenu.h
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#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;
|
||||||
|
extern int configmenupage;
|
||||||
|
void initconfigmenu();
|
||||||
4
games/forespend/src/common/themes.cpp
Normal file
4
games/forespend/src/common/themes.cpp
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#include "themes.h"
|
||||||
|
|
||||||
|
enginend::theme clienttheme;
|
||||||
|
enginend::theme servertheme;
|
||||||
5
games/forespend/src/common/themes.h
Normal file
5
games/forespend/src/common/themes.h
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#pragma once
|
||||||
|
#include <enginend/scenes/nodes.h>
|
||||||
|
|
||||||
|
extern enginend::theme clienttheme;
|
||||||
|
extern enginend::theme servertheme;
|
||||||
1
include/enginend/aud.h
Symbolic link
1
include/enginend/aud.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../engine/src/aud.h
|
||||||
1
include/enginend/engine.h
Symbolic link
1
include/enginend/engine.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../engine/src/engine.h
|
||||||
1
include/enginend/gr.h
Symbolic link
1
include/enginend/gr.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../engine/src/gr.h
|
||||||
1
include/enginend/graph/window.h
Symbolic link
1
include/enginend/graph/window.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../../engine/src/graph/window.h
|
||||||
1
include/enginend/net.h
Symbolic link
1
include/enginend/net.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../engine/src/net.h
|
||||||
1
include/enginend/program.h
Symbolic link
1
include/enginend/program.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../engine/src/program.h
|
||||||
1
include/enginend/resmgr.h
Symbolic link
1
include/enginend/resmgr.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../engine/src/resmgr.h
|
||||||
1
include/enginend/scenes/node2d.h
Symbolic link
1
include/enginend/scenes/node2d.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../../engine/src/scenes/node2d.h
|
||||||
1
include/enginend/scenes/node2drelative.h
Symbolic link
1
include/enginend/scenes/node2drelative.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../../engine/src/scenes/node2drelative.h
|
||||||
1
include/enginend/scenes/nodes.h
Symbolic link
1
include/enginend/scenes/nodes.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../../engine/src/scenes/nodes.h
|
||||||
1
include/enginend/scenes/scene.h
Symbolic link
1
include/enginend/scenes/scene.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../../engine/src/scenes/scene.h
|
||||||
1
include/raylib/raylib.h
Symbolic link
1
include/raylib/raylib.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../lib/raylib/include/raylib.h
|
||||||
1
include/raylib/raymath.h
Symbolic link
1
include/raylib/raymath.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../lib/raylib/include/raymath.h
|
||||||
1
include/raylib/rcamera.h
Symbolic link
1
include/raylib/rcamera.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../lib/raylib/include/rcamera.h
|
||||||
1
include/raylib/rlgl.h
Symbolic link
1
include/raylib/rlgl.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../lib/raylib/include/rlgl.h
|
||||||
1
lib/raylib
Submodule
1
lib/raylib
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit c8cc2ba6e94f82ec12d12f4764a07231269409f1
|
||||||
56
updatesymlinks.sh
Executable file
56
updatesymlinks.sh
Executable file
|
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
folders=("engine/src" "lib/raylib/include")
|
||||||
|
names=("enginend" "raylib")
|
||||||
|
outdir="include"
|
||||||
|
types=("h" "hpp")
|
||||||
|
|
||||||
|
mkdir -p "$outdir"
|
||||||
|
|
||||||
|
|
||||||
|
create_symlinks() {
|
||||||
|
local src="$1"
|
||||||
|
local outnam="$2"
|
||||||
|
local currout="$outdir/$outnam"
|
||||||
|
|
||||||
|
mkdir -p "$currout"
|
||||||
|
|
||||||
|
find "$src" -mindepth 1 -print0 | while IFS= read -r -d '' item; do
|
||||||
|
rl="${item#$src/}"
|
||||||
|
outpath="$currout/$rl"
|
||||||
|
mkdir -p "$(dirname "$outpath")"
|
||||||
|
|
||||||
|
if [ -f "$item" ]; then
|
||||||
|
nam=$(basename "$item")
|
||||||
|
ftype="${nam##*.}"
|
||||||
|
|
||||||
|
skip=true
|
||||||
|
for type in "${types[@]}"; do
|
||||||
|
if [ "$ftype" = "$type" ]; then
|
||||||
|
skip=false
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$skip" = false ]; then
|
||||||
|
ln -sf "$(realpath --relative-to="$(dirname "$outpath")" "$item")" "$outpath"
|
||||||
|
fi
|
||||||
|
elif [ -d "$item" ]; then
|
||||||
|
mkdir -p "$outpath"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
for i in "${!folders[@]}"; do
|
||||||
|
if [ $i -lt ${#names[@]} ]; then
|
||||||
|
src="${folders[$i]}"
|
||||||
|
outnam="${names[$i]}"
|
||||||
|
|
||||||
|
if [ -d "$src" ]; then
|
||||||
|
create_symlinks "$src" "$outnam"
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "'$src' not exist"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
Loading…
Add table
Add a link
Reference in a new issue