From 1997e82ee14565b22d52dfd27653cd5fe03493d9 Mon Sep 17 00:00:00 2001 From: Rtch90 Date: Thu, 12 Apr 2012 19:14:47 +0100 Subject: [PATCH] [Add] Adding some more method declarations to Actor.* --- src/Actor/Actor.cpp | 12 ++++++++++++ src/Actor/Actor.h | 21 ++++++++++++++++++++- src/Actor/Player.h | 17 ----------------- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/Actor/Actor.cpp b/src/Actor/Actor.cpp index e5b79b5..c5467e9 100644 --- a/src/Actor/Actor.cpp +++ b/src/Actor/Actor.cpp @@ -7,3 +7,15 @@ Actor::Actor(void) : VELOCITY(10.0f) { Actor::~Actor(void) { } + +void Actor::LoadSprite(const char* filename, float w, float h) { + +} + +void Actor::Update(void) { + +} + +void Actor::Render(void) { + _actor->Draw(); +} diff --git a/src/Actor/Actor.h b/src/Actor/Actor.h index 30bc2e9..7c0b82b 100644 --- a/src/Actor/Actor.h +++ b/src/Actor/Actor.h @@ -1,4 +1,5 @@ #pragma once +#include "../Sprite/Sprite.h" class Actor { public: @@ -18,6 +19,10 @@ public: Actor(void); ~Actor(void); + void LoadSprite(const char* filename, float w, float h); + void Update(void); + void Render(void); + float GetX(void) { return x; } float GetY(void) { return y; } float GetWidth(void) { return w; } @@ -25,10 +30,24 @@ public: void SetXY(float xArg, float yArg) { x = xArg; y = yArg; } -private: + int GetDirection(void) { return _direction; } + void SetDirection(int direction) { _direction = direction; } + +protected: const float VELOCITY; + + int _direction; + + static const int ANIM_LEFT_FOOT = 0; + static const int ANIM_NO_FOOT = 1; + static const int ANIM_RIGHT_FOOT = 2; + static const int ANIM_ATTACK = 3; + +private: float x; float y; float w; float h; + + Sprite* _actor; }; diff --git a/src/Actor/Player.h b/src/Actor/Player.h index 6b86ba0..0054e4e 100644 --- a/src/Actor/Player.h +++ b/src/Actor/Player.h @@ -10,21 +10,6 @@ class SoundEffect; // We will derive from an Actor class at some point. class Player { public: - // Facing enum controls which spritr to render. - enum Facing { - LEFT, - RIGHT, - NONE - }; - - // Control the current state the character is in. - enum Status { - STANDING = 0, - WALKING, - HURT, - DEAD, - }; - Player(void); ~Player(void); @@ -47,8 +32,6 @@ private: Sprite* _player; float _rotationAngle; - Facing _preventMovement; - SoundEffect* _stepSFX[4]; int _lastStepSFXPlayed; };