supertux
src
worldmap
tux.hpp
1
// SuperTux - A Jump'n Run
2
// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmail.com>
3
// Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
4
//
5
// This program is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
#ifndef HEADER_SUPERTUX_WORLDMAP_TUX_HPP
19
#define HEADER_SUPERTUX_WORLDMAP_TUX_HPP
20
21
#include "sprite/sprite_ptr.hpp"
22
#include "supertux/game_object.hpp"
23
#include "supertux/player_status.hpp"
24
#include "worldmap/worldmap.hpp"
25
26
class
Controller
;
27
28
namespace
worldmap
{
29
30
class
SpecialTile;
31
class
SpriteChange;
32
class
WorldMap;
33
34
class
Tux
final :
public
GameObject
35
{
36
public
:
37
Tux
(
WorldMap
*
worldmap
);
38
39
virtual
void
draw
(
DrawingContext
& context)
override
;
40
virtual
void
update
(
float
dt_sec)
override
;
41
virtual
bool
is_singleton
()
const override
{
return
true
; }
42
43
void
setup
();
45
void
set_direction(Direction dir);
46
47
void
set_ghost_mode(
bool
enabled);
48
bool
get_ghost_mode()
const
;
49
50
bool
is_moving()
const
{
return
m_moving; }
51
Vector
get_pos()
const
;
52
Vector
get_tile_pos()
const
{
return
m_tile_pos; }
53
void
set_tile_pos(
const
Vector
& p) { m_tile_pos = p; }
54
55
void
process_special_tile(
SpecialTile
* special_tile);
56
57
private
:
58
void
stop();
59
std::string get_action_prefix_for_bonus(
const
BonusType& bonus)
const
;
60
bool
can_walk(
int
tile_data, Direction dir)
const
;
61
void
update_input_direction();
62
void
try_start_walking();
63
void
try_continue_walking(
float
dt_sec);
65
void
change_sprite(
SpriteChange
* sc);
67
public
:
68
Direction m_back_direction;
69
70
private
:
71
WorldMap
* m_worldmap;
72
SpritePtr m_sprite;
73
Controller
& m_controller;
74
75
Direction m_input_direction;
76
Direction m_direction;
77
Vector
m_tile_pos;
80
float
m_offset;
81
bool
m_moving;
82
83
bool
m_ghost_mode;
84
85
private
:
86
Tux
(
const
Tux
&) =
delete
;
87
Tux
& operator=(
const
Tux
&) =
delete
;
88
};
89
90
}
// namespace worldmap
91
92
#endif
93
94
/* EOF */
Controller
Definition:
controller.hpp:56
worldmap::Tux::draw
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition:
tux.cpp:54
Vector
Simple two dimensional vector.
Definition:
vector.hpp:24
worldmap
Definition:
object_settings.hpp:28
GameObject
Base class for all the things that make up Levels' Sectors.
Definition:
game_object.hpp:46
worldmap::Tux::setup
void setup()
called prior to first update
Definition:
tux.cpp:320
worldmap::Tux
Definition:
tux.hpp:34
worldmap::Tux::update
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it's state.
Definition:
tux.cpp:308
worldmap::SpecialTile
Definition:
special_tile.hpp:31
worldmap::SpriteChange
Definition:
sprite_change.hpp:32
DrawingContext
This class provides functions for drawing things on screen.
Definition:
drawing_context.hpp:42
worldmap::Tux::is_singleton
virtual bool is_singleton() const override
If true only a single object of this type is allowed in a given GameObjectManager.
Definition:
tux.hpp:41
worldmap::WorldMap
Definition:
worldmap.hpp:50
Generated by
1.8.12