Note
Note
#include <cstdlib>
#include <vector>
#include <iostream>
#include <string>
#include "G2D.h"
struct _Heros
{
string texture =
"[RRR ]"
"[RRWR ]"
"[RRR ]"
"[YY ]"
"[YYY ]"
"[YY YG]"
"[GG ]"
"[CC ]"
"[CC ]"
"[C C ]"
"[C C ]";
V2 Size;
int IdTex;
V2 Pos = V2(0,0);
void hero_deplacement()
{
};
struct _Key
{
string texture =
"[ ]"
"[ W W WWWW ]"
"[ W W W W]"
"[ WWWWWWWWWWWWWW W]"
"[ W W]"
"[ WWWW ]";
V2 Size;
int IdTex;
V2 Pos = V2(440, 450);
};
struct GameData
{
string Map =
"MMMMMMMMMMMMMMM"
"M M M"
"M M M MMM MMM M"
"M M M M"
"MMM M M MMM M M"
"M M M M M"
"M MMM MMM MMMMM"
"M M M M"
"M M M M M MM M"
"M M M M M M M"
"M M M MM M MMMM"
"M M M M M"
"M M M MMMMMMM M"
"M M M M"
"MMMMMMMMMMMMMMM";
GameData() {}
};
GameData G;
void render()
{
G2D::ClearScreen(Color::Black);
// affichage de la clef
G2D::DrawRectWithTexture(G.Key.IdTex, G.Key.Pos, G.Key.Size);
G2D::Show();
}
void Logic()
{
G.Heros.hero_deplacement();
void AssetsInit()
{
// Size passé en ref et texture en param
G.Heros.IdTex = G2D::InitTextureFromString(G.Heros.Size, G.Heros.texture);
G.Heros.Size = G.Heros.Size * 2; // on peut zoomer la taille du sprite
AssetsInit();
G2D::Run(Logic,render);