ajout texture

This commit is contained in:
Frederic Leger 2023-10-30 14:32:20 -04:00
parent a82f994d49
commit 559a8efc19
3 changed files with 12 additions and 1 deletions

View File

@ -37,7 +37,7 @@
typedef uint8_t BlockType;
typedef uint8_t BoostType;
enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_LAST };
enum BOOST_TYPE { BTYPE_SPEED, BTYPE_HEAL, BTYPE_DAMAGE, BTYPE_INVINCIBLE };
enum BOOST_TYPE { BTYPE_SPEED, BTYPE_HEAL, BTYPE_DAMAGE, BTYPE_INVINCIBLE, BTYPE_BOOST_LAST };
typedef uint64_t Timestamp;
#ifdef _WIN32

View File

@ -378,6 +378,15 @@ void Engine::LoadResource() {
m_blockinfo[BTYPE_METAL] = new BlockInfo(BTYPE_METAL, "Metal", u, v, s, 1);
m_textureAtlas.TextureIndexToCoord(texIceIndex, u, v, s, s);
m_blockinfo[BTYPE_ICE] = new BlockInfo(BTYPE_ICE, "Ice", u, v, s, 1);
m_textureAtlas.TextureIndexToCoord(texBoostHeal, u, v, s, s);
m_boostinfo[BTYPE_HEAL] = new BoostInfo(BTYPE_HEAL, "Heal", u, v, s, 1);
m_textureAtlas.TextureIndexToCoord(texBoostDmg, u, v, s, s);
m_boostinfo[BTYPE_DAMAGE] = new BoostInfo(BTYPE_DAMAGE, "Dmg", u, v, s, 1);
m_textureAtlas.TextureIndexToCoord(texBoostSpd, u, v, s, s);
m_boostinfo[BTYPE_SPEED] = new BoostInfo(BTYPE_SPEED, "Spd", u, v, s, 1);
m_textureAtlas.TextureIndexToCoord(texIceIndex, u, v, s, s);
m_boostinfo[BTYPE_INVINCIBLE] = new BoostInfo(BTYPE_INVINCIBLE, "Inv", u, v, s, 1);
std::cout << " Loading and compiling shaders ..." << std::endl;
if (!m_shader01.Load(SHADER_PATH "shader01.vert", SHADER_PATH "shader01.frag", true)) {

View File

@ -5,6 +5,7 @@
#include <cmath>
#include "../SQCSim-common/array2d.h"
#include "../SQCSim-common/blockinfo.h"
#include "../SQCSim-common/boostinfo.h"
#include "../SQCSim-common/bullet.h"
#include "../SQCSim-common/chunk.h"
#include "../SQCSim-common/world.h"
@ -61,6 +62,7 @@ private:
Connector m_conn;
Shader m_shader01;
BlockInfo* m_blockinfo[BTYPE_LAST];
BoostInfo* m_boostinfo[BTYPE_BOOST_LAST];
TextureAtlas m_textureAtlas = TextureAtlas(BTYPE_LAST);
World m_world = World();