The Battle for Wesnoth  1.19.0+dev
overlay.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2024
3  by Fabian Mueller <fabianmueller5@gmx.de>
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 #pragma once
17 
18 #include "halo.hpp"
19 
20 struct overlay
21 {
22 
23  overlay(const std::string& img,
24  const std::string& halo_img,
26  const std::string& overlay_team_name,
27  const std::string& item_id,
28  const bool fogged,
29  float submerge,
30  float item_z_order = 0)
31  : image(img)
32  , halo(halo_img)
33  , team_name(overlay_team_name)
34  , id(item_id)
36  , visible_in_fog(fogged)
38  , z_order(item_z_order)
39  {}
40 
41 
42  overlay(const config& cfg)
43  : image(cfg["image"])
44  , halo(cfg["halo"])
45  , team_name(cfg["team_name"])
46  , name(cfg["name"].t_str())
47  , id(cfg["id"])
48  , halo_handle()
49  , visible_in_fog(cfg["visible_in_fog"].to_bool())
50  , submerge(cfg["submerge"].to_double(0))
51  , z_order(cfg["z_order"].to_double(0))
52  {
53  }
54 
55  std::string image;
56  std::string halo;
57  std::string team_name;
59  std::string id;
60 
63  float submerge;
64  float z_order;
65 
66 };
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:159
Definition: halo.cpp:39
std::shared_ptr< halo_record > handle
Definition: halo.hpp:31
Functions to load and save images from/to disk.
std::string image
Definition: overlay.hpp:55
std::string team_name
Definition: overlay.hpp:57
float submerge
Definition: overlay.hpp:63
halo::handle halo_handle
Definition: overlay.hpp:61
float z_order
Definition: overlay.hpp:64
t_string name
Definition: overlay.hpp:58
overlay(const config &cfg)
Definition: overlay.hpp:42
overlay(const std::string &img, const std::string &halo_img, halo::handle handle, const std::string &overlay_team_name, const std::string &item_id, const bool fogged, float submerge, float item_z_order=0)
Definition: overlay.hpp:23
std::string id
Definition: overlay.hpp:59
std::string halo
Definition: overlay.hpp:56
bool visible_in_fog
Definition: overlay.hpp:62