Browse Source

Petite maj

master
Florian 3 years ago
parent
commit
43bdf48ba1
2 changed files with 103 additions and 103 deletions
  1. 73
    73
      GUI.cpp
  2. 30
    30
      GUI.hpp

+ 73
- 73
GUI.cpp View File

@@ -1,73 +1,73 @@
#include "GUI.hpp"
extern "C"
{
#include <math.h>
}
void Script_GUI::Start()
{
vie = 3;
score = 0;
level = 1;
vulnerability = 0;
}
void Script_GUI::UpdateEverySecond()
{
if(vulnerability > 0)vulnerability --;
else vulnerability = 0;
}
void Script_GUI::Update()
{
const unsigned char svie[]={0x6d, 0x93, 0x83, 0x45, 0x29, 0x11, };
ML_rectangle(105,0,127,63,1,ML_WHITE,ML_WHITE);
ML_line(104,0,104,63,ML_BLACK);
PrintMini(107,7,"Score",0);
PrintV(107,15,score);
if(vie > 0)ML_bmp_or(svie,105,30,7,6);
if(vie > 1)ML_bmp_or(svie,113,30,7,6);
if(vie > 2)ML_bmp_or_cl(svie,121,30,7,6);
PrintMini(107,47,"Level",0);
PrintV(115,55,level);
}
void Script_GUI::DelVie(int v)
{
if(v < 0)return;
vie -= v;
if(vie <= 0)
{
ML_clear_vram();
PrintXY(25,28,"You Lose",0);
ML_display_vram();
Sleep(1500);
GetEngine()->StopGame();
}
}
void Script_GUI::AddScore(int v)
{
if(v > 0)score += v;
}
void Script_GUI::SetVulnerability(int v)
{
if( v > 0)vulnerability = v;
}
int Script_GUI::GetVulnerability()
{
return vulnerability;
}
#include "GUI.hpp"
extern "C"
{
#include <math.h>
}
void Script_GUI::Start()
{
vie = 3;
score = 0;
level = 1;
vulnerability = 0;
}
void Script_GUI::UpdateEverySecond()
{
if(vulnerability > 0)vulnerability --;
else vulnerability = 0;
}
void Script_GUI::Update()
{
const unsigned char svie[]={0x6d, 0x93, 0x83, 0x45, 0x29, 0x11, };
ML_rectangle(105,0,127,63,1,ML_WHITE,ML_WHITE);
ML_line(104,0,104,63,ML_BLACK);
PrintMini(107,7,"Score",0);
PrintV(107,15,score);
if(vie > 0)ML_bmp_or(svie,105,30,7,6);
if(vie > 1)ML_bmp_or(svie,113,30,7,6);
if(vie > 2)ML_bmp_or_cl(svie,121,30,7,6);
PrintMini(107,47,"Level",0);
PrintV(115,55,level);
}
void Script_GUI::DelVie(int v)
{
if(v < 0)return;
vie -= v;
if(vie <= 0)
{
ML_clear_vram();
PrintXY(25,28,"You Lose",0);
ML_display_vram();
Sleep(1500);
GetEngine()->StopGame();
}
}
void Script_GUI::AddScore(int v)
{
if(v > 0)score += v;
}
void Script_GUI::SetVulnerability(int v)
{
if( v > 0)vulnerability = v;
}
int Script_GUI::GetVulnerability()
{
return vulnerability;
}

+ 30
- 30
GUI.hpp View File

@@ -1,30 +1,30 @@
#ifndef GUI
#define GUI
#include "..\C-Engine\CHeader.hpp"
class Script_GUI: public Script
{
public:
void Start();
void Update();
void UpdateEverySecond();
void DelVie(int v);
void AddScore(int v);
void SetVulnerability(int v);
int GetVulnerability();
private:
int score;//Sc: 0
int vie;//Nb de vie
int level;
int vulnerability;
};
#endif
#ifndef GUI
#define GUI
#include "..\C-Engine\CHeader.hpp"
class Script_GUI: public Script
{
public:
void Start();
void Update();
void UpdateEverySecond();
void DelVie(int v);
void AddScore(int v);
void SetVulnerability(int v);
int GetVulnerability();
private:
int score;//Sc: 0
int vie;//Nb de vie
int level;
int vulnerability;
};
#endif

Loading…
Cancel
Save