movind stuf around
This commit is contained in:
parent
c0ac94529d
commit
d04b700809
75 changed files with 22 additions and 28494 deletions
|
|
@ -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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue