doin main menu. loading menu will come out today!
This commit is contained in:
parent
38ea792ee7
commit
b07bb475a7
232 changed files with 99 additions and 7 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "scenes/game.h"
|
||||
#include "scenes/mainmenu.h"
|
||||
tiny::ErrorLevel tiny::level{9};
|
||||
PLATFORM platform=LINUX;
|
||||
std::string androidpackage="kn.kinfuyuki.animatronical-q1a1";
|
||||
|
|
@ -6,10 +7,11 @@ class anim: public enginend::program {
|
|||
public:
|
||||
const char *CONF() override{return "SAVEFILE.TDF";}
|
||||
void boot() override {
|
||||
this->currentscene=new game;
|
||||
this->currentscene=new mainmenu;
|
||||
|
||||
SetConfigFlags(FLAG_VSYNC_HINT|FLAG_WINDOW_RESIZABLE);
|
||||
InitWindow(380,240,"ani1");
|
||||
InitAudioDevice();
|
||||
currentscene->boot();
|
||||
}
|
||||
void tick() override {
|
||||
|
|
@ -24,7 +26,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
char changeto=-1;
|
||||
int main() {
|
||||
anim dagame;
|
||||
dagame.boot();
|
||||
|
|
@ -33,6 +35,7 @@ int main() {
|
|||
while (!dagame.shouldclose) {
|
||||
dagame.tick();
|
||||
dagame.draw();
|
||||
|
||||
}
|
||||
dagame.exit();
|
||||
}
|
||||
|
|
@ -1 +1,2 @@
|
|||
#pragma once
|
||||
#pragma once
|
||||
#include "shared.h"
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include "shared.h"
|
||||
#include <enginend/engine.h>
|
||||
#include "cheats.h"
|
||||
enum CURSORMODES {
|
||||
|
|
@ -20,6 +21,7 @@ extern std::vector<char> opposites;
|
|||
char moveentity(char pos,char dir,bool backwards);
|
||||
char rotateentity(char pos,char dir, bool clockwise);
|
||||
bool ifforward();bool ifbackward();bool ifleft();bool ifright();
|
||||
bool ifinteract();bool ifflashlight();
|
||||
bool cansee(char dest,char pos, char dir);
|
||||
extern std::vector<char> sides;
|
||||
extern std::vector<std::string> lightlevel;
|
||||
|
|
@ -38,13 +40,14 @@ struct game:public enginend::scene {
|
|||
Texture2D current;
|
||||
bool canseeuycatroz=false;
|
||||
bool canseeskaile=false;
|
||||
float crystallyprogress=1.;
|
||||
void boot() final {
|
||||
mappath=AT("res/map");
|
||||
this->nodes={
|
||||
new enginend::nodes::twod::relative::textured()
|
||||
};
|
||||
std::string newpath=AT((mappath+"/"+lightlevel[lightmode]+"/"+sides[player.dir]+"/"+std::to_string(player.pos)+".jpg"));
|
||||
|
||||
|
||||
current=LOADMAP
|
||||
}
|
||||
void tick() final {
|
||||
|
|
@ -66,6 +69,10 @@ struct game:public enginend::scene {
|
|||
canseeuycatroz=cansee(uycatroz.pos,player.pos,player.dir);
|
||||
canseeskaile=cansee(skaile.pos,player.pos,player.dir);
|
||||
}
|
||||
if (ifinteract()) {
|
||||
if (player.pos==0&&player.dir==0)changeto=0;
|
||||
|
||||
}
|
||||
}else stamina+=.01;
|
||||
|
||||
|
||||
|
|
@ -80,6 +87,11 @@ struct game:public enginend::scene {
|
|||
if (canseeskaile)DrawRectangle(
|
||||
screenw/2.,screenh/10.,screenw/12,screenh/1.5,rl::RED);
|
||||
DrawText(("pos: "+std::to_string(player.pos)+" dir:"+std::to_string(player.dir)).c_str(),0,0,64,rl::WHITE);
|
||||
DrawText(("uypos: "+std::to_string(uycatroz.pos)+" uydir:"+std::to_string(uycatroz.dir)).c_str(),0,64,64,rl::SKYBLUE);
|
||||
DrawText(("skpos: "+std::to_string(skaile.pos)+" skdir:"+std::to_string(skaile.dir)).c_str(),0,128,64,rl::RED);
|
||||
DrawText(("crystally: "+std::to_string(crystallyprogress)).c_str(),0,196,64,rl::LIME);
|
||||
|
||||
|
||||
EndDrawing();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,62 @@
|
|||
#pragma once
|
||||
#pragma once
|
||||
#include <enginend/engine.h>
|
||||
#include "shared.h"
|
||||
|
||||
|
||||
class mainmenu:public enginend::scene {
|
||||
public:
|
||||
Texture2D bg;
|
||||
Texture2D title;
|
||||
Music bgm;
|
||||
Shader bzzzz;
|
||||
int wins:3=0b111;
|
||||
mainmenu() {
|
||||
|
||||
}
|
||||
void boot() override {
|
||||
std::string modifier=".png";
|
||||
bg=LoadTexture(AT("res/menu/"+
|
||||
std::to_string(wins>>2&1)+std::to_string(wins>>1&1)+std::to_string(wins&1)
|
||||
+modifier));
|
||||
bgm=LoadMusicStream(AT("res/snd/song.mp3"));
|
||||
title=LoadTexture(AT("res/menu/title.png"));
|
||||
bgm.looping=true;
|
||||
PlayMusicStream(bgm);
|
||||
bzzzz=LoadShaderFromMemory(
|
||||
"attribute vec2 vertexPosition;attribute vec2 vertexTexCoord;attribute vec4 vertexColor;"
|
||||
"varying vec2 fragTexCoord;varying vec4 fragColor;varying float randf;"
|
||||
"uniform mat4 mvp;uniform float t;"
|
||||
"float rand(vec2 co){return fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453);}"
|
||||
"void main(){fragTexCoord=vertexTexCoord;fragColor=vertexColor;"
|
||||
"gl_Position=mvp*vec4(vertexPosition,0.,1.);"
|
||||
"randf=rand(vec2(gl_Position.x+t,gl_Position.y+t));}",
|
||||
"varying vec2 fragTexCoord;varying vec4 fragColor;varying float randf;"
|
||||
"uniform sampler2D texture0;"
|
||||
"void main(){"
|
||||
"vec4 texel=texture2D(texture0,fragTexCoord)*fragColor;"
|
||||
"float idx=(texel.r+texel.g+texel.b);"
|
||||
"if(idx<0.7||idx>0.9){idx*=randf;}"
|
||||
"gl_FragColor=vec4(texel.rgb,texel.a*idx);}"
|
||||
);
|
||||
}
|
||||
void tick() override {
|
||||
|
||||
}
|
||||
void draw() override {
|
||||
float screenw=(float)GetScreenWidth();float screenh=(float)GetScreenHeight();
|
||||
UpdateMusicStream(bgm);
|
||||
BeginDrawing();
|
||||
ClearBackground(rl::BLACK);
|
||||
DrawTexturePro(bg,{0,0,320,240},{0,0,screenw,screenh},{0,0},0,rl::WHITE);
|
||||
float t=GetTime()/200000;
|
||||
SetShaderValue(bzzzz,GetShaderLocation(bzzzz,"t"),&t,SHADER_UNIFORM_FLOAT);
|
||||
BeginShaderMode(bzzzz);
|
||||
DrawTexturePro(title,{0,0,1065,194},{0,0,screenw,(screenh/4)},{0,0},0,rl::WHITE);
|
||||
EndShaderMode();
|
||||
EndDrawing();
|
||||
|
||||
}
|
||||
void exit() override {
|
||||
|
||||
}
|
||||
};
|
||||
|
|
@ -85,7 +85,7 @@ bool ifforward() {
|
|||
bool ifbackward() {
|
||||
if (IsKeyPressed(KEY_S))return true;
|
||||
if (IsKeyPressed(KEY_DOWN))return true;
|
||||
if (IsKeyPressed(KEY_KP_2))return true;
|
||||
if (IsKeyPressed(KEY_KP_5))return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +103,19 @@ bool ifright(){
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool ifinteract() {
|
||||
if (IsKeyPressed(KEY_RIGHT_CONTROL))return true;
|
||||
if (IsKeyPressed(KEY_KP_7))return true;
|
||||
if (IsKeyPressed(KEY_SPACE))return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ifflashlight() {
|
||||
if (IsKeyPressed(KEY_E))return true;
|
||||
if (IsKeyPressed(KEY_KP_9))return true;
|
||||
if (IsKeyPressed(KEY_RIGHT_SHIFT))return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
2
games/animatronical/q1/a1/src/scenes/shared.h
Normal file
2
games/animatronical/q1/a1/src/scenes/shared.h
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#pragma once
|
||||
extern char changeto;
|
||||
Loading…
Add table
Add a link
Reference in a new issue