The Battle for Wesnoth  1.19.5+dev
mouse_action_village.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 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 
19 
20 class CKey;
21 
22 namespace editor {
23 
24 /**
25  * Editor mouse action class.
26  * Called by the editor tool to assign village ownership to defined sides.
27  */
29 {
30 public:
32  : mouse_action(palette, key)
33  {
34  }
35 
36  /**
37  * No action.
38  */
39  std::unique_ptr<editor_action> click_left(editor_display& /*disp*/, int /*x*/, int /*y*/) override {return nullptr;}
40 
41  /**
42  * If clicked on a village hex field, assigns the ownership of it to the current side.
43  */
44  std::unique_ptr<editor_action> up_left(editor_display& disp, int x, int y) override;
45 
46  /**
47  * No action.
48  */
49  std::unique_ptr<editor_action> click_right(editor_display& /*disp*/, int /*x*/, int /*y*/) override {return nullptr;}
50 
51  /**
52  * If clicked on a village hex field, unassigns it's ownership.
53  */
54  std::unique_ptr<editor_action> up_right(editor_display& disp, int x, int y) override;
55 
56  virtual void set_mouse_overlay(editor_display& disp) override;
57 };
58 
59 
60 } //end namespace editor
Class that keeps track of all the keys on the keyboard.
Definition: key.hpp:29
Editor mouse action class.
std::unique_ptr< editor_action > up_right(editor_display &disp, int x, int y) override
If clicked on a village hex field, unassigns it's ownership.
std::unique_ptr< editor_action > up_left(editor_display &disp, int x, int y) override
If clicked on a village hex field, assigns the ownership of it to the current side.
mouse_action_village(const CKey &key, empty_palette &palette)
std::unique_ptr< editor_action > click_left(editor_display &, int, int) override
No action.
std::unique_ptr< editor_action > click_right(editor_display &, int, int) override
No action.
virtual void set_mouse_overlay(editor_display &disp) override
Set the mouse overlay for this action.
A mouse action receives events from the controller, and responds to them by creating an appropriate e...
std::vector< color_t > palette(const color_range &cr)
Creates a reference color palette from a color range.
Manage the empty-palette in the editor.
Definition: action.cpp:31