okie menus are working
This commit is contained in:
parent
3932589790
commit
05e28fe820
11 changed files with 135 additions and 55 deletions
|
|
@ -149,6 +149,7 @@ public:
|
|||
buttonslabel[0]=LoadTexture("res/options.png");
|
||||
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], enginend::DEFAULT,468,58+(18*2),96,16,std::function<void()>([]() {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ void client::boot() {
|
|||
this->tickrate=20;
|
||||
// SetConfigFlags();
|
||||
InitWindow(380,240,"forespend - 0.03h");
|
||||
initthemes();
|
||||
this->currentscene=new mainmenu();
|
||||
this->currentscene->boot();
|
||||
target=LoadRenderTexture(380,240);
|
||||
|
|
|
|||
|
|
@ -2,26 +2,32 @@
|
|||
#include "../../common/themes.h"
|
||||
#include <enginend/scenes/node2d.h>
|
||||
int configmenupage=0; // 0 is before the mainpage is showing. aka pause menu/main menu when start game
|
||||
enginend::group mainpage= enginend::group(
|
||||
enginend::group maincfgpage= enginend::group(
|
||||
{
|
||||
new enginend::nodes::labeledbutton("video",nullptr,&clienttheme,100,100,0,0,std::function<void()>([]() {
|
||||
new enginend::nodes::relative::labeledbutton("video",nullptr,clienttheme,0,0.04,1,0.2,std::function<void()>([]() {
|
||||
configmenupage=2;
|
||||
}),32),
|
||||
new enginend::nodes::relative::labeledbutton("sound",nullptr,clienttheme,0,0.27,1,0.2,std::function<void()>([]() {
|
||||
|
||||
}),forefont,32),
|
||||
new enginend::nodes::labeledbutton("sound",nullptr,&clienttheme,100,100,0,0,std::function<void()>([]() {
|
||||
}),32),
|
||||
new enginend::nodes::relative::labeledbutton("input",nullptr,clienttheme,0,0.51,1,0.2,std::function<void()>([]() {
|
||||
|
||||
}),forefont,32),
|
||||
new enginend::nodes::labeledbutton("input",nullptr,&clienttheme,100,100,0,0,std::function<void()>([]() {
|
||||
|
||||
}),forefont,32),
|
||||
}),32),
|
||||
new enginend::nodes::relative::labeledbutton("back",nullptr,clienttheme,0,0.75,1,0.2,std::function<void()>([]() {
|
||||
configmenupage=0;
|
||||
}),32),
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
enginend::group graphics= enginend::group(
|
||||
{
|
||||
new enginend::nodes::labeledbutton("fullscreen",nullptr,&clienttheme,100,100,0,0,std::function<void()>([]() {
|
||||
|
||||
}),forefont,32),
|
||||
{
|
||||
new enginend::nodes::relative::labeledbutton("fullscreen",nullptr,clienttheme,0,0.04,1,0.2,std::function<void()>([]() {
|
||||
(dynamic_cast<enginend::nodes::relative::labeledbutton*>(graphics.children[0]))->boolean^=true;
|
||||
}),32,true),
|
||||
new enginend::nodes::relative::labeledbutton("back",nullptr,clienttheme,0,0.75,1,0.2,std::function<void()>([]() {
|
||||
configmenupage=1;
|
||||
}),32),
|
||||
}
|
||||
);
|
||||
enginend::group sound= enginend::group(
|
||||
|
|
|
|||
|
|
@ -1,28 +1,72 @@
|
|||
#pragma once
|
||||
#include <enginend/engine.h>
|
||||
#include "configmenu.h"
|
||||
|
||||
#include "../../common/themes.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*>{
|
||||
this->nodes=std::vector<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"),
|
||||
new enginend::nodes::relative::text(nullptr,clienttheme,0.17,0.05,0.8,0.3,32,"FORESPEND"),
|
||||
new enginend::nodes::relative::labeledbutton("PLAY",nullptr,clienttheme,0.30,0.25,0.4,0.2,
|
||||
std::function<void()>([]{
|
||||
|
||||
}),32),
|
||||
new enginend::nodes::relative::labeledbutton("OPTIONS",nullptr,clienttheme,0.02,0.75,0.56,0.2,
|
||||
std::function<void()>([]{
|
||||
configmenupage=1;
|
||||
}),32),
|
||||
new enginend::nodes::relative::labeledbutton("EXIT",nullptr,clienttheme,0.63,0.75,0.35,0.2,
|
||||
std::function<void()>([](){
|
||||
std::exit(1);
|
||||
}),32),
|
||||
};
|
||||
enginend::scene::boot();
|
||||
}
|
||||
void tick() override {
|
||||
for (enginend::nodes::node* n : this->nodes) {
|
||||
n->tick();
|
||||
|
||||
switch (configmenupage) {
|
||||
case 0:{
|
||||
for (enginend::nodes::node* n : this->nodes) {
|
||||
n->tick();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {this->nodes[0]->tick();
|
||||
for (enginend::nodes::node* n : maincfgpage.children) {
|
||||
n->tick();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: {this->nodes[0]->tick();
|
||||
for (enginend::nodes::node* n : graphics.children) {
|
||||
n->tick();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void draw() override {
|
||||
for (enginend::nodes::node* n : this->nodes) {
|
||||
n->draw();
|
||||
switch (configmenupage) {
|
||||
case 0:{
|
||||
for (enginend::nodes::node* n : this->nodes) {
|
||||
n->draw();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {this->nodes[0]->draw();
|
||||
for (enginend::nodes::node* n : maincfgpage.children) {
|
||||
n->draw();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: {this->nodes[0]->draw();
|
||||
for (enginend::nodes::node* n : graphics.children) {
|
||||
n->draw();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void exit() override {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#include "themes.h"
|
||||
|
||||
Font forefont;
|
||||
enginend::theme clienttheme{
|
||||
|
||||
enginend::theme CLIENTTHEME{
|
||||
.textfieldbg ={127,0,0,127},
|
||||
.background = {0,0,0,0},
|
||||
.border = {0,0,0,0},
|
||||
.border = {0,255,255,0},
|
||||
.booleanbutton = {
|
||||
{0,200,0,180},
|
||||
{100,200,100,180},
|
||||
|
|
@ -14,7 +14,14 @@ enginend::theme clienttheme{
|
|||
{255,100,100,255},
|
||||
},
|
||||
.text = {255,127,0,255},
|
||||
.font = forefont,
|
||||
.booleantext = {
|
||||
{255,255,255,255},
|
||||
{255,255,255,255},
|
||||
{255,255,255,255},
|
||||
{255,255,255,255},
|
||||
{255,255,255,255},
|
||||
{255,255,255,255}
|
||||
},
|
||||
.tint = {255,255,255,255},
|
||||
.button = {
|
||||
{0,0,0,0},
|
||||
|
|
@ -28,8 +35,7 @@ enginend::theme clienttheme{
|
|||
}
|
||||
|
||||
};
|
||||
enginend::theme servertheme;
|
||||
|
||||
void initthemes() {
|
||||
forefont=LoadFont(AT("res/fonts/dos.fnt"));
|
||||
}
|
||||
enginend::theme* clienttheme=&CLIENTTHEME;
|
||||
enginend::theme* servertheme;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
#pragma once
|
||||
#include <enginend/engine.h>
|
||||
|
||||
extern Font forefont;
|
||||
extern enginend::theme clienttheme;
|
||||
extern enginend::theme servertheme;
|
||||
void initthemes();
|
||||
extern enginend::theme* clienttheme;
|
||||
extern enginend::theme* servertheme;
|
||||
inline void initthemes() {
|
||||
tiny::warning("loading font");
|
||||
clienttheme->font = LoadFont(AT("res/fonts/dos.fnt"));
|
||||
if (clienttheme->font.recs==nullptr) {
|
||||
tiny::fatal("LoadFont() failed");
|
||||
exit(404);
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,6 @@ int main(int argc, char** argv) {
|
|||
enginend::program* game;
|
||||
tiny::startup("forespend","0.03g-rewrite");
|
||||
bool isserver = false;
|
||||
initthemes();
|
||||
if (argc>1) {
|
||||
for (int i=1;i<argc;i++) {
|
||||
if (argv[i]=="server ") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue