Browse Source

core: more vec?i -> ?veci renames.

legacy
Sam Hocevar sam 14 years ago
parent
commit
2b9d64f7a8
16 changed files with 27 additions and 29 deletions
  1. +2
    -2
      src/debug/fps.cpp
  2. +1
    -1
      src/font.cpp
  3. +1
    -1
      src/font.h
  4. +3
    -3
      src/input.cpp
  5. +1
    -1
      src/input.h
  6. +1
    -1
      src/layer.cpp
  7. +3
    -3
      src/matrix.h
  8. +2
    -2
      src/platform/ps3/ps3input.cpp
  9. +2
    -2
      src/scene.cpp
  10. +1
    -1
      src/scene.h
  11. +1
    -3
      src/sprite.cpp
  12. +4
    -4
      src/text.cpp
  13. +1
    -1
      src/text.h
  14. +1
    -1
      src/tileset.cpp
  15. +1
    -1
      src/tileset.h
  16. +2
    -2
      src/worldentity.h

+ 2
- 2
src/debug/fps.cpp View File

@@ -45,12 +45,12 @@ DebugFps::DebugFps(int x, int y)
for (int i = 0; i < 5; i ++) for (int i = 0; i < 5; i ++)
{ {
data->lines[i] = new Text(NULL, "gfx/font/ascii.png"); data->lines[i] = new Text(NULL, "gfx/font/ascii.png");
data->lines[i]->SetPos(vec3i(x, y + (i ? 8 : 0) + 16 * i, 0));
data->lines[i]->SetPos(ivec3(x, y + (i ? 8 : 0) + 16 * i, 0));
Ticker::Ref(data->lines[i]); Ticker::Ref(data->lines[i]);
} }
#else #else
data->lines[0] = new Text(NULL, "gfx/font/ascii.png"); data->lines[0] = new Text(NULL, "gfx/font/ascii.png");
data->lines[0]->SetPos(vec3i(x, y, 100));
data->lines[0]->SetPos(ivec3(x, y, 100));
Ticker::Ref(data->lines[0]); Ticker::Ref(data->lines[0]);
#endif #endif
} }


+ 1
- 1
src/font.cpp View File

@@ -69,7 +69,7 @@ char const *Font::GetName()
return data->name; return data->name;
} }


void Font::Print(vec3i pos, char const *str)
void Font::Print(vec3 pos, char const *str)
{ {
Scene *scene = Scene::GetDefault(); Scene *scene = Scene::GetDefault();




+ 1
- 1
src/font.h View File

@@ -36,7 +36,7 @@ protected:


public: public:
/* New methods */ /* New methods */
void Print(vec3i pos, char const *str);
void Print(vec3 pos, char const *str);
ivec2 GetSize() const; ivec2 GetSize() const;


private: private:


+ 3
- 3
src/input.cpp View File

@@ -42,7 +42,7 @@ public:


private: private:
ivec2 mouse; ivec2 mouse;
vec3i buttons;
ivec3 buttons;


static int const MAX_ENTITIES = 100; static int const MAX_ENTITIES = 100;
WorldEntity *entities[MAX_ENTITIES]; WorldEntity *entities[MAX_ENTITIES];
@@ -82,7 +82,7 @@ ivec2 Input::GetMousePos()
return data->mouse; return data->mouse;
} }


vec3i Input::GetMouseButtons()
ivec3 Input::GetMouseButtons()
{ {
return data->buttons; return data->buttons;
} }
@@ -130,7 +130,7 @@ void Input::SetMousePos(ivec2 coord)
{ {
if (data->entities[n] == top) if (data->entities[n] == top)
{ {
data->entities[n]->mousepos = (ivec2)((vec3i)coord - top->bbox[0]);
data->entities[n]->mousepos = (ivec2)((ivec3)coord - top->bbox[0]);
if (top != data->lastfocus) if (top != data->lastfocus)
data->entities[n]->pressed = data->buttons; data->entities[n]->pressed = data->buttons;
else else


+ 1
- 1
src/input.h View File

@@ -29,7 +29,7 @@ public:
/* These methods are general queries */ /* These methods are general queries */
static vec2 GetAxis(int axis); static vec2 GetAxis(int axis);
static ivec2 GetMousePos(); static ivec2 GetMousePos();
static vec3i GetMouseButtons();
static ivec3 GetMouseButtons();


/* Entities can subscribe to events */ /* Entities can subscribe to events */
static void TrackMouse(WorldEntity *e); static void TrackMouse(WorldEntity *e);


+ 1
- 1
src/layer.cpp View File

@@ -56,7 +56,7 @@ void Layer::Render(int x, int y, int z)
for (int i = 0; i < width; i++) for (int i = 0; i < width; i++)
if (data[j * width + i]) if (data[j * width + i])
scene->AddTile(data[j * width + i], scene->AddTile(data[j * width + i],
vec3i(x + i * 32,
vec3(x + i * 32,
y + j * 32 - altitude, y + j * 32 - altitude,
altitude + z), altitude + z),
orientation); orientation);


+ 3
- 3
src/matrix.h View File

@@ -160,7 +160,7 @@ template <typename T> struct Vec3
}; };


typedef Vec3<float> vec3; typedef Vec3<float> vec3;
typedef Vec3<int> vec3i;
typedef Vec3<int> ivec3;


template <typename T> struct Vec4 template <typename T> struct Vec4
{ {
@@ -177,7 +177,7 @@ template <typename T> struct Vec4
}; };


typedef Vec4<float> vec4; typedef Vec4<float> vec4;
typedef Vec4<int> vec4i;
typedef Vec4<int> ivec4;


#define SCALAR_GLOBAL(elems, op, U) \ #define SCALAR_GLOBAL(elems, op, U) \
template<typename T> \ template<typename T> \
@@ -296,7 +296,7 @@ template <typename T> struct Mat4
}; };


typedef Mat4<float> mat4; typedef Mat4<float> mat4;
typedef Mat4<int> mat4i;
typedef Mat4<int> imat4;


} /* namespace lol */ } /* namespace lol */




+ 2
- 2
src/platform/ps3/ps3input.cpp View File

@@ -40,7 +40,7 @@ class Ps3InputData


#if defined __CELLOS_LV2__ #if defined __CELLOS_LV2__
vec2 mousepos; vec2 mousepos;
vec3i mousebuttons;
ivec3 mousebuttons;


CellPadData pad_data[NUM_PADS]; CellPadData pad_data[NUM_PADS];
CellPadFilterIIRSos filter_sos[NUM_PADS][4]; CellPadFilterIIRSos filter_sos[NUM_PADS][4];
@@ -75,7 +75,7 @@ Ps3Input::Ps3Input()
CELL_PADFILTER_IIR_CUTOFF_2ND_LPF_BT_010); CELL_PADFILTER_IIR_CUTOFF_2ND_LPF_BT_010);


data->mousepos = vec2(320.0f, 240.0f); data->mousepos = vec2(320.0f, 240.0f);
data->mousebuttons = vec3i(0, 0, 0);
data->mousebuttons = ivec3(0, 0, 0);


gamegroup = GAMEGROUP_BEFORE; gamegroup = GAMEGROUP_BEFORE;
#endif #endif


+ 2
- 2
src/scene.cpp View File

@@ -30,7 +30,7 @@ struct Tile
{ {
TileSet *tileset; TileSet *tileset;
uint32_t prio; uint32_t prio;
vec3i pos;
vec3 pos;
int id, o; int id, o;
}; };


@@ -117,7 +117,7 @@ void Scene::Reset()
SceneData::scene = NULL; SceneData::scene = NULL;
} }


void Scene::AddTile(TileSet *tileset, int id, vec3i pos, int o)
void Scene::AddTile(TileSet *tileset, int id, vec3 pos, int o)
{ {
if ((data->ntiles % 1024) == 0) if ((data->ntiles % 1024) == 0)
data->tiles = (Tile *)realloc(data->tiles, data->tiles = (Tile *)realloc(data->tiles,


+ 1
- 1
src/scene.h View File

@@ -34,7 +34,7 @@ public:
static Scene *GetDefault(); static Scene *GetDefault();
static void Reset(); static void Reset();


void AddTile(TileSet *tileset, int id, vec3i pos, int o);
void AddTile(TileSet *tileset, int id, vec3 pos, int o);
void Render(); void Render();


private: private:


+ 1
- 3
src/sprite.cpp View File

@@ -52,9 +52,7 @@ void Sprite::TickDraw(float deltams)
{ {
Entity::TickDraw(deltams); Entity::TickDraw(deltams);


vec3i pos = (vec3i)data->pos;

Scene::GetDefault()->AddTile(data->tileset, data->id, pos, 0);
Scene::GetDefault()->AddTile(data->tileset, data->id, data->pos, 0);
} }


Sprite::~Sprite() Sprite::~Sprite()


+ 4
- 4
src/text.cpp View File

@@ -34,7 +34,7 @@ class TextData
private: private:
int font, align, length; int font, align, length;
char *text; char *text;
vec3i pos;
vec3 pos;
}; };


/* /*
@@ -47,7 +47,7 @@ Text::Text(char const *text, char const *font)
data->font = Forge::Register(font); data->font = Forge::Register(font);
data->text = text ? strdup(text) : NULL; data->text = text ? strdup(text) : NULL;
data->length = text ? strlen(text) : 0; data->length = text ? strlen(text) : 0;
data->pos = vec3i(0, 0, 0);
data->pos = vec3(0, 0, 0);


drawgroup = DRAWGROUP_HUD; drawgroup = DRAWGROUP_HUD;
} }
@@ -70,7 +70,7 @@ void Text::SetInt(int val)
data->length = strlen(text); data->length = strlen(text);
} }


void Text::SetPos(vec3i pos)
void Text::SetPos(vec3 pos)
{ {
data->pos = pos; data->pos = pos;
} }
@@ -87,7 +87,7 @@ void Text::TickDraw(float deltams)
if (data->text) if (data->text)
{ {
Font *font = Forge::GetFont(data->font); Font *font = Forge::GetFont(data->font);
vec3i delta = 0;
vec3 delta = 0;
if (data->align == ALIGN_RIGHT) if (data->align == ALIGN_RIGHT)
delta.x -= data->length * font->GetSize().x; delta.x -= data->length * font->GetSize().x;
else if (data->align == ALIGN_CENTER) else if (data->align == ALIGN_CENTER)


+ 1
- 1
src/text.h View File

@@ -31,7 +31,7 @@ public:


void SetText(char const *text); void SetText(char const *text);
void SetInt(int val); void SetInt(int val);
void SetPos(vec3i pos);
void SetPos(vec3 pos);
void SetAlign(int align); void SetAlign(int align);


enum enum


+ 1
- 1
src/tileset.cpp View File

@@ -178,7 +178,7 @@ void TileSet::Bind()
} }
} }


void TileSet::BlitTile(uint32_t id, vec3i pos, int o,
void TileSet::BlitTile(uint32_t id, vec3 pos, int o,
float *vertex, float *texture) float *vertex, float *texture)
{ {
float tx = data->tx * ((id & 0xffff) % data->count.i); float tx = data->tx * ((id & 0xffff) % data->count.i);


+ 1
- 1
src/tileset.h View File

@@ -44,7 +44,7 @@ public:
ivec2 GetCount() const; ivec2 GetCount() const;
ivec2 GetSize(int tileid) const; ivec2 GetSize(int tileid) const;
void Bind(); void Bind();
void BlitTile(uint32_t id, vec3i pos, int o,
void BlitTile(uint32_t id, vec3 pos, int o,
float *vertex, float *texture); float *vertex, float *texture);


private: private:


+ 2
- 2
src/worldentity.h View File

@@ -30,8 +30,8 @@ public:
vec3 bbox[2]; vec3 bbox[2];


ivec2 mousepos; ivec2 mousepos;
vec3i mousebuttons;
vec3i pressed, clicked, released;
ivec3 mousebuttons;
ivec3 pressed, clicked, released;


protected: protected:
WorldEntity(); WorldEntity();


Loading…
Cancel
Save