almost finishing theming support

This commit is contained in:
kin fuyuki 2026-02-20 07:55:55 -03:00
commit 3932589790
No known key found for this signature in database
GPG key ID: 0E4E8E519FB71401
8 changed files with 181 additions and 61 deletions

View file

@ -5,6 +5,9 @@
#include <atomic>
#include <chrono>
#include "../../../engine/src/scenes/nodes.h"
#include "../../../engine/src/scenes/nodes.h"
#include"themes.h"
using namespace enginend;
using namespace enginend::nodes;
netio nete{};
@ -60,10 +63,9 @@ private:
};
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;
logi(Texture2D* texture,enginend::theme* theme,float x,float y,float w,float h,float fs,std::string txt) {
this->pos=Vector2{x,y};this->size=Vector2{w,h};this->content=txt;this->theme=theme;
this->texture=texture;
this->fs=fs;
}
void draw() override {
@ -83,11 +85,11 @@ struct logi: public virtual textfield {
fc=Color{255,255,0,255};
}
DrawTextEx(font, str, charPos, (float)fs, spacing, fc);
charPos.x+=MeasureTextEx(font, str, (float)fs, spacing).x;
DrawTextEx(this->theme->font, str, charPos, (float)fs, spacing, fc);
charPos.x+=MeasureTextEx(this->theme->font, str, (float)fs, spacing).x;
}
} else {
DrawTextEx(font, line.c_str(), p, (float)fs, spacing, Color{0,255,255,255});
DrawTextEx(this->theme->font, line.c_str(), p, (float)fs, spacing, Color{0,255,255,255});
}
p.y+=(fs+2);
@ -138,44 +140,47 @@ public:
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);
enginend::DEFAULT->font=information;
GAMENAME.font=gamename;
CHANGELOG.font=changelog;
version= text (nullptr,enginend::DEFAULT,96,16*17,1,1,20,"version: "+selectedversion);
SetTraceLogLevel(LOG_ERROR);
buttons[0]=new button(&menubtn[0], {255,255,255,255},468,58,96,16,nullptr);
buttons[0]=new button(&menubtn[0], enginend::DEFAULT,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()>([]() {
buttons[1]=new button(&menubtn[0], enginend::DEFAULT,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()>([]() {
buttons[2]=new button(&menubtn[0], enginend::DEFAULT,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()>([]() {
buttons[3]=new button(&menubtn[0], enginend::DEFAULT,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()>([]() {
buttons[4]=new button(&menubtn[0], enginend::DEFAULT,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);
buttons[5]=new button(&menubtn[0], enginend::DEFAULT,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);
buttons[6]=new button(&menubtn[0], enginend::DEFAULT,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()>([]() {
buttons[7]=new button(&menubtn[0], enginend::DEFAULT,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));
playbutton= new button(&playbtn[0], enginend::DEFAULT,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"),
new text(nullptr,&GAMENAME,232,19,1,1,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),
@ -185,8 +190,8 @@ public:
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"),
new logi(nullptr,&CHANGELOG,90,58,466,159,8,nete.changelog),
new text(nullptr,enginend::DEFAULT,96+16,(16*14)-3,1,1,20,"downloaded verified"),
&version,
};
currentscene->boot();