File: gameobj.h

package info (click to toggle)
angelscript 2.35.1%2Bds-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,388 kB
  • sloc: cpp: 71,969; asm: 1,558; makefile: 665; xml: 214; javascript: 42; ansic: 22; python: 22; sh: 7
file content (44 lines) | stat: -rw-r--r-- 970 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef GAMEOBJ_H
#define GAMEOBJ_H

#include <string>
#include <angelscript.h>
#include "../../../add_on/scripthandle/scripthandle.h"

class CGameObj
{
public:
	CGameObj(char dispChar, int x, int y);
	int AddRef();
	int Release();
	asILockableSharedBool *GetWeakRefFlag();

	// This method is used by the application 
	// when the object should be destroyed
	void DestroyAndRelease();

	// This event handler is called by the game manager each frame
	void OnThink();

	bool Move(int dx, int dy);
	void Send(CScriptHandle msg, CGameObj *other);
	void Kill();

	// The script shouldn't be allowed to update the position directly 
	// so we won't provide direct access to the position
	int GetX() const;
	int GetY() const;

	std::string name;
	char displayCharacter;
	bool isDead;
	asIScriptObject *controller;
	int x, y;

protected:
	~CGameObj();
	int                    refCount;
	asILockableSharedBool *weakRefFlag;
};

#endif