Freeciv21
Develop your civilization from humble roots to a global empire
layer_background.h
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 2021-2023 Freeciv21 contributors.
3 \_ \ / __/ This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 #pragma once
14 
15 #include "fc_types.h"
16 #include "layer.h"
17 
18 #include <QPixmap>
19 
20 #include <array>
21 #include <memory>
22 
23 namespace freeciv {
24 
25 class layer_background : public layer {
26 public:
27  explicit layer_background(struct tileset *ts);
28  virtual ~layer_background() = default;
29 
30  std::vector<drawn_sprite>
31  fill_sprite_array(const tile *ptile, const tile_edge *pedge,
32  const tile_corner *pcorner,
33  const unit *punit) const override;
34 
35  void initialize_player(const player *player) override;
36  void free_player(int player_id) override;
37 
38 private:
39  std::unique_ptr<QPixmap> create_player_sprite(const QColor &pcolor) const;
40 
41  std::array<std::unique_ptr<QPixmap>, MAX_NUM_PLAYER_SLOTS>
43 };
44 
45 } // namespace freeciv
virtual ~layer_background()=default
layer_background(struct tileset *ts)
std::vector< drawn_sprite > fill_sprite_array(const tile *ptile, const tile_edge *pedge, const tile_corner *pcorner, const unit *punit) const override
Returns the list of sprites drawn by this layer somewhere on the map.
void free_player(int player_id) override
Frees data initialized by initialize_player.
std::unique_ptr< QPixmap > create_player_sprite(const QColor &pcolor) const
Create a sprite with the given color.
std::array< std::unique_ptr< QPixmap >, MAX_NUM_PLAYER_SLOTS > m_player_background
void initialize_player(const player *player) override
Initializes data specific to one player.
A layer when drawing the map.
Definition: layer.h:153
#define MAX_NUM_PLAYER_SLOTS
Definition: fc_types.h:24
Definition: path.cpp:10
Definition: player.h:231
Definition: tile.h:42
Definition: unit.h:134