Freeciv21
Develop your civilization from humble roots to a global empire
layer_special.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_special : public layer {
26 public:
27  explicit layer_special(struct tileset *ts, mapview_layer layer);
28  virtual ~layer_special() = default;
29 
30  void initialize_extra(const extra_type *extra, const QString &tag,
31  extrastyle_id style) override;
32 
33  void set_sprite(const extra_type *extra, const QString &tag,
34  const QPoint &offset = QPoint());
35 
36  std::vector<drawn_sprite>
37  fill_sprite_array(const tile *ptile, const tile_edge *pedge,
38  const tile_corner *pcorner,
39  const unit *punit) const override;
40 
41  void reset_ruleset() override;
42 
43 private:
44  std::array<std::unique_ptr<drawn_sprite>, MAX_EXTRA_TYPES> m_sprites;
45 };
46 
47 } // namespace freeciv
void initialize_extra(const extra_type *extra, const QString &tag, extrastyle_id style) override
Loads sprites for the extra if it has ESTYLE_SINGLE1/2 or ESTYLE_3LAYER.
void set_sprite(const extra_type *extra, const QString &tag, const QPoint &offset=QPoint())
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 reset_ruleset() override
Resets cached data that depends on the ruleset.
layer_special(struct tileset *ts, mapview_layer layer)
virtual ~layer_special()=default
std::array< std::unique_ptr< drawn_sprite >, MAX_EXTRA_TYPES > m_sprites
Definition: layer_special.h:44
A layer when drawing the map.
Definition: layer.h:153
#define MAX_EXTRA_TYPES
Definition: fc_types.h:42
Definition: path.cpp:10
Definition: tile.h:42
Definition: unit.h:134