Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #ifndef __ACTOR_HPP__
- #define __ACTOR_HPP__
- #include "core/Level.hpp"
- #include "script/Common.hpp"
- #include "video/Surface.hpp"
- namespace Core {
- class Level;
- class ActorBase {
- private:
- int mId;
- float x;
- float y;
- int layer;
- Video::Surface * mSurf;
- Level * mLevel;
- public:
- ActorBase(Level * lvl, int id) { mLevel = lvl; mId = id; }
- ~ActorBase() { delete mSurf; }
- int GetID() { return mId; }
- virtual float GetX() { return x; }
- virtual void SetX(float nx) { x = nx; }
- virtual float GetY() { return y; }
- virtual void SetY(float ny) { y = ny; }
- virtual int GetLayer() { return layer; }
- virtual void SetLayer(int l) { layer = l; }
- virtual Video::Surface* GetSprite() { return mSurf; }
- virtual void SetSprite(Video::Surface* surf) { mSurf = surf; }
- virtual void OnInit();
- virtual void OnTick(int ticks);
- virtual void OnKeyDown(int key);
- virtual void OnKeyUp(int key);
- virtual void OnMouseButtonDown(const char* button, int mx, int my);
- virtual void OnMouseButtonUp(const char* button, int mx, int my);
- virtual void OnMouseMotion(int x, int y, int relx, int rely);
- virtual void OnTouched(ActorBase* actor);
- virtual void OnExit();
- virtual void OnDraw() { mSurf->Blit((int)x * mLevel->GetTileWidth(), (int)y * mLevel->GetTileHeight()); }
- };
- class Actor: public ActorBase {
- private:
- v8::Persistent<v8::Context> context;
- v8::Handle<v8::ObjectTemplate> global;
- v8::Handle<v8::ObjectTemplate> CreateTemplate();
- public:
- v8::Persistent<v8::Object> self;
- Actor();
- ~Actor();
- v8::Persistent<v8::Object> Wrap();
- };
- } // namespace Core
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement