Added static prototype for GUI2 in-game theme
This commit is contained in:
parent
758ad0bf23
commit
e30a2aa520
7 changed files with 652 additions and 0 deletions
Binary file not shown.
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 30 KiB |
534
data/gui/window/game_ui.cfg
Normal file
534
data/gui/window/game_ui.cfg
Normal file
|
@ -0,0 +1,534 @@
|
|||
#textdomain wesnoth-lib
|
||||
###
|
||||
### Definition of the main game interface.
|
||||
###
|
||||
|
||||
# GUI_FORCE_WIDGET_MINIMUM_SIZE
|
||||
|
||||
#define _GUI_MENUBAR_STATUS_DISPLAY _ID _ICON _LABEL
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_grow = true
|
||||
|
||||
{GUI_FORCE_WIDGET_MINIMUM_SIZE 120 0 (
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[image]
|
||||
definition = "default"
|
||||
label = {_ICON} + ".png"
|
||||
[/image]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_grow = true
|
||||
|
||||
[label]
|
||||
id = {_ID}
|
||||
definition = "default_small"
|
||||
label = {_LABEL}
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
)}
|
||||
[/column]
|
||||
#enddef
|
||||
|
||||
#define _GUI_MENUBAR
|
||||
[stacked_widget]
|
||||
id = "menubar_stack"
|
||||
|
||||
[layer]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = true
|
||||
vertical_alignment = "top"
|
||||
|
||||
[image]
|
||||
id = "menubar_bg"
|
||||
definition = "tiled_to_size"
|
||||
label = "themes/classic/menubar.png"
|
||||
[/image]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/layer]
|
||||
|
||||
[layer]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
#
|
||||
# Menu buttons
|
||||
#
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
border = "right"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[button]
|
||||
id = "menu"
|
||||
definition = "default"
|
||||
label = "Menu"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
border = "right"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[button]
|
||||
id = "actions"
|
||||
definition = "default"
|
||||
label = "Actions"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
#
|
||||
# Status panels
|
||||
#
|
||||
|
||||
# TODO: remove hardcoded label examples
|
||||
{_GUI_MENUBAR_STATUS_DISPLAY "turns" "flags/loyalist-flag-icon" "0/00" }
|
||||
{_GUI_MENUBAR_STATUS_DISPLAY "gold" "themes/gold" "000" }
|
||||
{_GUI_MENUBAR_STATUS_DISPLAY "villages" "themes/villages" "0/00" }
|
||||
{_GUI_MENUBAR_STATUS_DISPLAY "units" "themes/units" "00" }
|
||||
{_GUI_MENUBAR_STATUS_DISPLAY "upkeep" "themes/upkeep" "00" }
|
||||
{_GUI_MENUBAR_STATUS_DISPLAY "income" "themes/income" "00" }
|
||||
{_GUI_MENUBAR_STATUS_DISPLAY "time" "themes/sand-clock" "00:00"}
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
|
||||
[spacer]
|
||||
[/spacer]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/layer]
|
||||
|
||||
[/stacked_widget]
|
||||
#enddef
|
||||
|
||||
#define _GUI_MINIMAP_PANEL
|
||||
[stacked_widget]
|
||||
id = "menubar_stack"
|
||||
|
||||
[layer]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = true
|
||||
vertical_alignment = "top"
|
||||
|
||||
[image]
|
||||
id = "minmap_panel_bg"
|
||||
definition = "default"
|
||||
label = "themes/classic/minimap.png"
|
||||
[/image]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/layer]
|
||||
|
||||
[layer]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_grow = true
|
||||
vertical_grow = true
|
||||
|
||||
[minimap]
|
||||
id = "minimap"
|
||||
definition = "default"
|
||||
[/minimap]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
horizontal_grow = true
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
|
||||
[toggle_button]
|
||||
id = ""
|
||||
definition = "icon_medium"
|
||||
icon = "icons/action/zoomdefault_25.png"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
|
||||
[toggle_button]
|
||||
id = ""
|
||||
definition = "icon_medium"
|
||||
icon = "icons/action/minimap-draw-terrain_25.png"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
|
||||
[toggle_button]
|
||||
id = ""
|
||||
definition = "icon_medium"
|
||||
icon = "icons/action/editor-tool-unit_25.png"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
|
||||
[toggle_button]
|
||||
id = ""
|
||||
definition = "icon_medium"
|
||||
icon = "icons/action/editor-tool-village_25.png"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
|
||||
[toggle_button]
|
||||
id = ""
|
||||
definition = "icon_medium"
|
||||
icon = "icons/action/minimap-unit-coding_25.png"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
|
||||
[toggle_button]
|
||||
id = ""
|
||||
definition = "icon_medium"
|
||||
icon = "icons/action/minimap-terrain-coding_25.png"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/layer]
|
||||
|
||||
[/stacked_widget]
|
||||
#enddef
|
||||
|
||||
#define _GUI_SIDEBAR_DATA_PANEL _WIDTH _HEIGHT _WML
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 10
|
||||
horizontal_grow = true
|
||||
vertical_alignment = "top"
|
||||
|
||||
{GUI_FORCE_WIDGET_SIZE {_WIDTH} {_HEIGHT} (
|
||||
[panel]
|
||||
# TODO: nicer definition
|
||||
definition = "box_display_no_blur_no_border"
|
||||
|
||||
[grid]
|
||||
{_WML}
|
||||
[/grid]
|
||||
|
||||
[/panel]
|
||||
)}
|
||||
|
||||
[/column]
|
||||
#enddef
|
||||
|
||||
#define _GUI_SIDEBAR
|
||||
[stacked_widget]
|
||||
id = "sidebar_stack"
|
||||
|
||||
[layer]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_alignment = "right"
|
||||
vertical_grow = true
|
||||
|
||||
[image]
|
||||
id = "sidebar_bg"
|
||||
definition = "tiled_to_size"
|
||||
label = "themes/classic/sidebar.png"
|
||||
[/image]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/layer]
|
||||
|
||||
[layer]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "top,bottom"
|
||||
border_size = 5
|
||||
horizontal_grow = true
|
||||
vertical_alignment = "top"
|
||||
|
||||
{_GUI_MINIMAP_PANEL}
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
{_GUI_SIDEBAR_DATA_PANEL 0 50 ()}
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
{_GUI_SIDEBAR_DATA_PANEL 0 60 (
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
horizontal_grow = true
|
||||
vertical_grow = true
|
||||
|
||||
[image]
|
||||
definition = "scaled_to_size"
|
||||
label = "misc/time-schedules/default/schedule-dawn.png"
|
||||
[/image]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
)}
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
# FIXME..
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 10
|
||||
horizontal_alignment = "left"
|
||||
vertical_alignment = "top"
|
||||
|
||||
{GUI_FORCE_WIDGET_SIZE 74 74 (
|
||||
[panel]
|
||||
definition = "box_display_no_blur_no_border"
|
||||
|
||||
[grid]
|
||||
[/grid]
|
||||
|
||||
[/panel]
|
||||
)}
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/layer]
|
||||
|
||||
[/stacked_widget]
|
||||
#enddef
|
||||
|
||||
[window_definition]
|
||||
id = "game_ui_window"
|
||||
description = "Main game UI window definition."
|
||||
|
||||
[resolution]
|
||||
|
||||
[background]
|
||||
|
||||
[draw]
|
||||
|
||||
[image]
|
||||
x = 0
|
||||
y = 0
|
||||
w = "(width)"
|
||||
h = "(height)"
|
||||
|
||||
# TODO: use WFL variable if we want to import theme.
|
||||
name = "terrain/off-map/background.png"
|
||||
resize_mode = "tile"
|
||||
[/image]
|
||||
|
||||
[/draw]
|
||||
|
||||
[/background]
|
||||
|
||||
[foreground]
|
||||
|
||||
[draw]
|
||||
|
||||
[/draw]
|
||||
|
||||
[/foreground]
|
||||
|
||||
[/resolution]
|
||||
|
||||
[/window_definition]
|
||||
|
||||
[window]
|
||||
id = "game_ui"
|
||||
description = "Main game UI."
|
||||
|
||||
[resolution]
|
||||
definition = "game_ui_window"
|
||||
|
||||
{GUI_WINDOW_FULLSCREEN}
|
||||
|
||||
[tooltip]
|
||||
id = "tooltip_large"
|
||||
[/tooltip]
|
||||
|
||||
[helptip]
|
||||
id = "tooltip_large"
|
||||
[/helptip]
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = true
|
||||
vertical_grow = true
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = true
|
||||
vertical_alignment = "top"
|
||||
|
||||
{_GUI_MENUBAR}
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
horizontal_grow = true
|
||||
vertical_grow = true
|
||||
|
||||
[viewport]
|
||||
definition = "default"
|
||||
|
||||
[widget]
|
||||
|
||||
# TODO: actual gamemap goes here.
|
||||
[spacer]
|
||||
definition = "default"
|
||||
[/spacer]
|
||||
|
||||
[/widget]
|
||||
|
||||
[/viewport]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_alignment = "right"
|
||||
vertical_grow = true
|
||||
|
||||
{_GUI_SIDEBAR}
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/resolution]
|
||||
|
||||
[/window]
|
||||
|
||||
#undef _GUI_MENUBAR
|
||||
#undef _GUI_MENUBAR_STATUS_DISPLAY
|
||||
#undef _GUI_MINIMAP_PANEL
|
||||
#undef _GUI_SIDEBAR
|
||||
#undef _GUI_SIDEBAR_DATA_PANEL
|
|
@ -590,6 +590,8 @@
|
|||
<Unit filename="../../src/gui/dialogs/game_save.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_stats.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_stats.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_ui.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_ui.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_version.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/game_version.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/gamestate_inspector.cpp" />
|
||||
|
|
|
@ -195,6 +195,7 @@ gui/dialogs/game_delete.cpp
|
|||
gui/dialogs/game_load.cpp
|
||||
gui/dialogs/game_save.cpp
|
||||
gui/dialogs/game_stats.cpp
|
||||
gui/dialogs/game_ui.cpp
|
||||
gui/dialogs/game_version.cpp
|
||||
gui/dialogs/gamestate_inspector.cpp
|
||||
gui/dialogs/help_browser.cpp
|
||||
|
|
56
src/gui/dialogs/game_ui.cpp
Normal file
56
src/gui/dialogs/game_ui.cpp
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
Copyright (C) 2017 by Charles Dang <exodia339@gmail.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#define GETTEXT_DOMAIN "wesnoth-lib"
|
||||
|
||||
#include "gui/dialogs/game_ui.hpp"
|
||||
|
||||
#include "gui/auxiliary/find_widget.hpp"
|
||||
#include "gui/widgets/label.hpp"
|
||||
#include "gui/widgets/minimap.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
|
||||
#include "display.hpp"
|
||||
#include "formula/variant.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
#include "gettext.hpp"
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
REGISTER_DIALOG(game_ui)
|
||||
|
||||
game_ui::game_ui()
|
||||
: disp_(display::get_singleton())
|
||||
, game_config_(game_config_manager::get()->game_config())
|
||||
, scenario_(game_config_.child("scenario"))
|
||||
{
|
||||
}
|
||||
|
||||
void game_ui::pre_show(window& window)
|
||||
{
|
||||
minimap& mmap = find_widget<minimap>(&window, "minimap", false);
|
||||
|
||||
mmap.set_config(&game_config_);
|
||||
mmap.set_map_data(scenario_["map_data"].str());
|
||||
}
|
||||
|
||||
void game_ui::post_show(window& /*window*/)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
54
src/gui/dialogs/game_ui.hpp
Normal file
54
src/gui/dialogs/game_ui.hpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
Copyright (C) 2017 by Charles Dang <exodia339@gmail.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gui/dialogs/modal_dialog.hpp"
|
||||
|
||||
class config;
|
||||
class CVideo;
|
||||
class display;
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
namespace dialogs
|
||||
{
|
||||
class game_ui : public modal_dialog
|
||||
{
|
||||
public:
|
||||
game_ui();
|
||||
|
||||
DEFINE_SIMPLE_DISPLAY_WRAPPER(game_ui)
|
||||
|
||||
private:
|
||||
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const override;
|
||||
|
||||
/** Inherited from modal_dialog. */
|
||||
virtual void pre_show(window& window) override;
|
||||
|
||||
/** Inherited from modal_dialog. */
|
||||
virtual void post_show(window& window) override;
|
||||
|
||||
::display* disp_; // TODO: needed?
|
||||
|
||||
/** Reference to the entire master game config object. */
|
||||
const config& game_config_;
|
||||
|
||||
/** Reference to the current scenario's config. */
|
||||
const config& scenario_;
|
||||
};
|
||||
|
||||
} // namespace dialogs
|
||||
} // namespace gui2
|
|
@ -28,6 +28,7 @@
|
|||
#include "game_events/pump.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "gui/dialogs/game_ui.hpp"
|
||||
#include "gui/dialogs/story_viewer.hpp"
|
||||
#include "gui/dialogs/transient_message.hpp"
|
||||
#include "hotkey/hotkey_handler_sp.hpp"
|
||||
|
@ -239,6 +240,10 @@ LEVEL_RESULT playsingle_controller::play_scenario(const config& level)
|
|||
gui2::dialogs::story_viewer::display(get_scenario_name(), cfg);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME
|
||||
gui2::dialogs::game_ui::display(gui_->video());
|
||||
|
||||
gui_->labels().read(level);
|
||||
|
||||
// Read sound sources
|
||||
|
|
Loading…
Add table
Reference in a new issue