Freeciv21
Develop your civilization from humble roots to a global empire
drawn_sprite.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Freeciv21 contributors
3  * SPDX-FileCopyrightText: Louis Moureaux <m_louis30@yahoo.com>
4  *
5  * SPDX-License-Identifier: GPLv3-or-later
6  */
7 
8 #pragma once
9 
10 #include <QPoint>
11 
12 #include <vector>
13 
14 class QPixmap;
15 class QRect;
16 
17 struct tileset;
18 
19 struct drawn_sprite {
20  explicit drawn_sprite(const struct tileset *ts, const QPixmap *sprite,
21  bool foggable = true, int offset_x = 0,
22  int offset_y = 0);
23  explicit drawn_sprite(const struct tileset *ts, const QPixmap *sprite,
24  bool foggable, const QPoint &offset);
25  drawn_sprite(const drawn_sprite &other) = default;
26  drawn_sprite(drawn_sprite &&other) = default;
27  drawn_sprite &operator=(const drawn_sprite &other) = default;
28  drawn_sprite &operator=(drawn_sprite &&other) = default;
29 
30  const QPixmap *sprite;
31  bool foggable;
32  QPoint offset;
33 };
34 
35 QRect sprite_array_bounds(const std::vector<drawn_sprite> &sprs);
QRect sprite_array_bounds(const std::vector< drawn_sprite > &sprs)
Calculates the bounding rectangle of the given sprite array.
drawn_sprite(const struct tileset *ts, const QPixmap *sprite, bool foggable=true, int offset_x=0, int offset_y=0)
Instantiates a drawn sprite, ensuring that it's never null.
drawn_sprite & operator=(drawn_sprite &&other)=default
drawn_sprite(const drawn_sprite &other)=default
QPoint offset
offset from tile origin
Definition: drawn_sprite.h:32
drawn_sprite & operator=(const drawn_sprite &other)=default
const QPixmap * sprite
Definition: drawn_sprite.h:30
drawn_sprite(drawn_sprite &&other)=default
bool foggable
Set to FALSE for sprites that are never fogged.
Definition: drawn_sprite.h:31