The Battle for Wesnoth
1.17.21+dev
units
drawer.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2014 - 2023
3
by Chris Beck <render787@gmail.com>
4
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY.
12
13
See the COPYING file for more details.
14
*/
15
16
/**
17
*
18
* This wrapper class should be held by the display object when it needs to draw a unit.
19
* The purpose of this is to improve encapsulation -- other parts of the engine like AI
20
* don't need to be exposed to the unit drawing code, and encapsulation like this will
21
* help us to reduce unnecessary includes.
22
*
23
**/
24
25
#pragma once
26
27
#include "
map/location.hpp
"
28
#include "
sdl/rect.hpp
"
29
#include "
utils/math.hpp
"
30
31
#include <map>
32
#include <vector>
33
34
class
display
;
35
class
display_context
;
36
class
gamemap
;
37
namespace
halo
{
class
manager; }
38
class
team
;
39
class
unit
;
40
41
struct
color_t
;
42
struct
SDL_Rect;
43
struct
point
;
44
class
surface
;
45
46
class
unit_drawer
47
{
48
public
:
49
explicit
unit_drawer
(
display
& thedisp);
50
51
private
:
52
display
&
disp
;
53
const
display_context
&
dc
;
54
const
gamemap
&
map
;
55
const
std::vector<team> &
teams
;
56
halo::manager
&
halo_man
;
57
std::size_t
viewing_team
;
58
std::size_t
playing_team
;
59
const
team
&
viewing_team_ref
;
60
const
team
&
playing_team_ref
;
61
bool
is_blindfolded
;
62
bool
show_everything
;
63
map_location
sel_hex
;
64
map_location
mouse_hex
;
65
double
zoom_factor
;
66
std::set<map_location>
units_that_can_reach_goal
;
67
68
int
hex_size
;
69
int
hex_size_by_2
;
70
71
public
:
72
/** draw a unit. */
73
void
redraw_unit
(
const
unit
& u)
const
;
74
};
display_context
Abstract class for exposing game data that doesn't depend on the GUI, however which for historical re...
Definition:
display_context.hpp:35
display
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
Definition:
display.hpp:87
gamemap
Encapsulates the map of the game.
Definition:
map.hpp:172
halo::manager
Definition:
halo.hpp:40
surface
Definition:
surface.hpp:25
team
This class stores all the data for a single 'side' (in game nomenclature).
Definition:
team.hpp:76
unit_drawer
Definition:
drawer.hpp:47
unit_drawer::viewing_team_ref
const team & viewing_team_ref
Definition:
drawer.hpp:59
unit_drawer::map
const gamemap & map
Definition:
drawer.hpp:54
unit_drawer::zoom_factor
double zoom_factor
Definition:
drawer.hpp:65
unit_drawer::redraw_unit
void redraw_unit(const unit &u) const
draw a unit.
Definition:
drawer.cpp:167
unit_drawer::teams
const std::vector< team > & teams
Definition:
drawer.hpp:55
unit_drawer::dc
const display_context & dc
Definition:
drawer.hpp:53
unit_drawer::show_everything
bool show_everything
Definition:
drawer.hpp:62
unit_drawer::playing_team_ref
const team & playing_team_ref
Definition:
drawer.hpp:60
unit_drawer::halo_man
halo::manager & halo_man
Definition:
drawer.hpp:56
unit_drawer::viewing_team
std::size_t viewing_team
Definition:
drawer.hpp:57
unit_drawer::disp
display & disp
Definition:
drawer.hpp:52
unit_drawer::units_that_can_reach_goal
std::set< map_location > units_that_can_reach_goal
Definition:
drawer.hpp:66
unit_drawer::hex_size
int hex_size
Definition:
drawer.hpp:68
unit_drawer::sel_hex
map_location sel_hex
Definition:
drawer.hpp:63
unit_drawer::hex_size_by_2
int hex_size_by_2
Definition:
drawer.hpp:69
unit_drawer::unit_drawer
unit_drawer(display &thedisp)
Definition:
drawer.cpp:139
unit_drawer::playing_team
std::size_t playing_team
Definition:
drawer.hpp:58
unit_drawer::mouse_hex
map_location mouse_hex
Definition:
drawer.hpp:64
unit_drawer::is_blindfolded
bool is_blindfolded
Definition:
drawer.hpp:61
unit
This class represents a single unit of a specific type.
Definition:
unit.hpp:134
location.hpp
math.hpp
General math utility functions.
halo
Definition:
display.hpp:45
rect.hpp
Contains the SDL_Rect helper code.
color_t
The basic class for representing 8-bit RGB or RGBA colour values.
Definition:
color.hpp:59
map_location
Encapsulates the map of the game.
Definition:
location.hpp:38
point
Holds a 2D point.
Definition:
point.hpp:25
Generated by
1.9.1