File: sprite.h

package info (click to toggle)
epiphany 0.5.1-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,540 kB
  • ctags: 593
  • sloc: cpp: 4,223; makefile: 80; sh: 11
file content (116 lines) | stat: -rw-r--r-- 2,478 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/***************************************************************************
                          sprite.h  -  description
                             -------------------
    begin                : Sat Sep 22 2001
    copyright            : (C) 2001 by Giuseppe D'Aqu
    email                : kumber@tiscalinet.it
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/


#include "dephine.h"


#ifndef SPRITE_H
#define SPRITE_H

enum Anim_Type{SP_STOP=0, SP_UP=k_max_anim, SP_RIGHT=k_max_anim*2, SP_DOWN=k_max_anim*3, SP_LEFT=k_max_anim*4/*, SP_EAT=k_max_anim*5*/};


class Sprite
{

private:

	CL_Surface* m_surface;
	
//	CL_Surface* m_up_anim;
	
//	CL_Surface* m_right_anim;
	
//	CL_Surface* m_down_anim;
	
//	CL_Surface* m_left_anim;
	
//	CL_Surface* m_stop_surf;
	
//	CL_Surface* m_eat_anim;
	
	unsigned int m_pos_x;
	
	unsigned int m_pos_y;
	
	unsigned int m_move_to_pos_x;
	
	unsigned int m_move_to_pos_y;
	
	unsigned int m_step_x;

	unsigned int m_step_y;

	unsigned int m_speed;
		
	int m_curr_frame;
	
	bool m_initialized;

	Anim_Type m_state;	
	
public:
	
	Sprite(){m_initialized=false;};

	Sprite(CL_Surface* surface);
	
	Sprite(const Sprite& sprite);
	
//	Sprite& operator=(const Sprite& sprite);
	
	void set_surface(Anim_Type type);
	
	~Sprite();
	
	void set_speed(unsigned int speed);
	
	CL_Surface* operator->();
	
	unsigned int get_pos_x()
  {
	  return m_pos_x;
  }
	
	unsigned int get_pos_y()
	{
	  return m_pos_y;
  }
	void set_pos_x(unsigned int x);
	
	void set_pos_y(unsigned int y);
	
	void move_to_pos(unsigned int x, unsigned int y);
	
	void move_to_pos_x(unsigned int x);
	
	void move_to_pos_y(unsigned int y);
	
	void set_curr_frame(int frame);
	
	void move(unsigned int n_pixel);
	
	int get_frame_number();
	
	void init(CL_Surface* surf);
	
	void set_state(Anim_Type state);
		
};
	
#endif //SPRITE_H