这是indexloc提供的服务,不要输入任何密码
Skip to content
7 changes: 5 additions & 2 deletions assets/qml/BindsHelp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ Column {

Text {
id: dummyText
font.pointSize: 9
}

Text {
font.pointSize: dummyText.font.pointSize + 7
font.pointSize: dummyText.font.pointSize + 3

color: "white"
text: gameControl.mode ? gameControl.mode.name : "No Mode"
Expand All @@ -23,13 +24,14 @@ Column {
model: gameControlObj.mode ? gameControlObj.mode.binds : undefined

Text {
font.pointSize: dummyText.font.pointSize
color: "white"
text: modelData
}
}

Text {
font.pointSize: dummyText.font.pointSize + 7
font.pointSize: dummyText.font.pointSize + 3

color: "white"
text: "Global Bindings"
Expand All @@ -39,6 +41,7 @@ Column {
model: OA.Engine.globalBinds

Text {
font.pointSize: dummyText.font.pointSize
color: "white"
text: modelData
}
Expand Down
136 changes: 132 additions & 4 deletions assets/qml/IngameHud.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Item {
readonly property string srcSuffix: ".slp.png"
property string hudImageSource: srcPrefix + (pad + civIndex).slice(-pad.length) + srcSuffix

readonly property string iconsPrefix: "image://by-filename/converted/interface/"
readonly property string iconsBorder: "image://by-filename/converted/interface/53003.slp.png.1"

width: 1289
height: 960

Expand Down Expand Up @@ -137,11 +140,20 @@ Item {
Layout.fillWidth: true
Layout.minimumWidth: epoch.implicitWidth

Text {
id: epoch
Rectangle {
anchors.centerIn: parent
color: "white"
text: root.playerName + (actionMode.ability.length ? (" (" + actionMode.ability + ")") : "")
width: 200
height: metricsUnit * 2.5

color: "black"

Text {
id: epoch
anchors.centerIn: parent

color: "white"
text: root.playerName
}
}
}

Expand Down Expand Up @@ -230,6 +242,122 @@ Item {
anchors.fill: parent
tornBottom: false
}

Item {
anchors.fill: parent
id: selection_single_panel
visible: root.actionMode.selection_size == 1

Image {
anchors.top: parent.top
anchors.topMargin: metricsUnit * 2
anchors.left: parent.left
anchors.leftMargin: metricsUnit * 2

width: 50
height: 50

id: selected_icon

source: root.actionMode.selection_icon ? iconsPrefix + root.actionMode.selection_icon : iconsBorder
}
Image {
anchors.centerIn: selected_icon

width: 50
height: 50

source: iconsBorder
}

Text {
anchors.top: selected_icon.top
anchors.left: selected_icon.right
anchors.leftMargin: metricsUnit * 1.2

id: selected_name

color: "black"
text: root.actionMode.selection_name
font.pointSize: 16
}

Text {
anchors.verticalCenter: selected_name.verticalCenter
anchors.left: selected_name.right
anchors.leftMargin: metricsUnit * 1.2

id: selected_type

color: "black"
opacity: 0.8
text: root.actionMode.selection_type
}

Text {
anchors.top: selected_name.bottom
anchors.left: selected_name.left
anchors.topMargin: metricsUnit

id: selected_hp

color: "black"
text: root.actionMode.selection_hp
}

Text {
anchors.top: selected_hp.bottom
anchors.left: selected_icon.left
anchors.topMargin: metricsUnit * 2

color: "black"
text: root.actionMode.selection_attrs
}

Text {
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: metricsUnit * 2
anchors.rightMargin: metricsUnit * 2

color: "black"
text: root.actionMode.selection_owner
horizontalAlignment: Text.AlignRight
}

}

Item {
anchors.fill: parent
id: selection_group_panel
visible: root.actionMode.selection_size > 1

Text {
anchors.top: parent.top
anchors.topMargin: metricsUnit * 2
anchors.left: parent.left
anchors.leftMargin: metricsUnit * 2

color: "black"
text: root.actionMode.selection_name
font.pointSize: 14
}
}

Item {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: metricsUnit * 3
visible: actionMode.ability.length

Text {
anchors.centerIn: parent

text: actionMode.ability
font.pointSize: 14
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions buildsystem/codecompliance/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014-2018 the openage authors. See copying.md for legal info.
# Copyright 2014-2019 the openage authors. See copying.md for legal info.

"""
Entry point for the code compliance checker.
Expand Down Expand Up @@ -183,7 +183,7 @@ def main(args):
if args.fix and auto_fixes:
remainfound = "remain%s" % plural
else:
remainfound = ("were" if issues_count > 1 else "was") + "found"
remainfound = ("were" if issues_count > 1 else "was") + " found"

print("==> \x1b[33;1m{num} issue{plural}\x1b[m {remainfound}."
"".format(num=issues_count,
Expand Down
27 changes: 15 additions & 12 deletions libopenage/engine.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013-2018 the openage authors. See copying.md for legal info.
// Copyright 2013-2019 the openage authors. See copying.md for legal info.

#include "engine.h"

Expand Down Expand Up @@ -43,7 +43,7 @@ Engine::Engine(const util::Path &root_dir,
:
OptionNode{"Engine"},
running{false},
drawing_debug_overlay{this, "drawing_debug_overlay", true},
drawing_debug_overlay{this, "drawing_debug_overlay", false},
drawing_huds{this, "drawing_huds", true},
root_dir{root_dir},
job_manager{SDL_GetCPUCount()},
Expand All @@ -56,15 +56,14 @@ Engine::Engine(const util::Path &root_dir,
profiler{this},
gui_link{} {


if (fps_limit > 0) {
this->ns_per_frame = 1e9 / fps_limit;
} else {
this->ns_per_frame = 0;
}

this->font_manager = std::make_unique<renderer::FontManager>();
for (uint32_t size : {12, 20}) {
for (uint32_t size : {12, 14, 20}) {
fonts[size] = this->font_manager->get_font("DejaVu Serif", "Book", size);
}

Expand Down Expand Up @@ -272,21 +271,20 @@ bool Engine::on_resize(coord::viewport_delta new_size) {
}

bool Engine::draw_debug_overlay() {
util::col {255, 255, 255, 255}.use();

// Draw FPS counter in the lower right corner
this->render_text(
{this->coord.viewport_size.x - 100, 15}, 20,
"%.1f fps", this->fps_counter.fps
{this->coord.viewport_size.x - 70, 15}, 20, renderer::Colors::WHITE,
"%.0f fps", this->fps_counter.display_fps
);

// Draw version string in the lower left corner
this->render_text(
{5, 35}, 20,
{5, 35}, 20, renderer::Colors::WHITE,
"openage %s", config::version
);
this->render_text(
{5, 15}, 12,
{5, 15}, 12, renderer::Colors::WHITE,
"%s", config::config_option_string
);

Expand Down Expand Up @@ -468,8 +466,12 @@ void Engine::register_tick_action(TickHandler *handler) {
this->on_engine_tick.push_back(handler);
}

void Engine::register_drawhud_action(HudHandler *handler) {
this->on_drawhud.push_back(handler);
void Engine::register_drawhud_action(HudHandler *handler, int order) {
if (order < 0) {
this->on_drawhud.insert(this->on_drawhud.begin(), handler);
} else {
this->on_drawhud.push_back(handler);
}
}

void Engine::register_draw_action(DrawHandler *handler) {
Expand Down Expand Up @@ -530,7 +532,7 @@ time_nsec_t Engine::lastframe_duration_nsec() const {
return this->fps_counter.nsec_lastframe;
}

void Engine::render_text(coord::viewport position, size_t size, const char *format, ...) {
void Engine::render_text(coord::viewport position, size_t size, const renderer::Color &color, const char *format, ...) {
auto it = this->fonts.find(size);
if (it == this->fonts.end()) {
throw Error(MSG(err) << "Unknown font size requested: " << size);
Expand All @@ -545,6 +547,7 @@ void Engine::render_text(coord::viewport position, size_t size, const char *form
va_end(vl);

this->text_renderer->set_font(font);
this->text_renderer->set_color(color);
this->text_renderer->draw(position.x, position.y, buf);
}

Expand Down
8 changes: 5 additions & 3 deletions libopenage/engine.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013-2018 the openage authors. See copying.md for legal info.
// Copyright 2013-2019 the openage authors. See copying.md for legal info.

#pragma once

Expand Down Expand Up @@ -44,6 +44,7 @@ namespace renderer {
class Font;
class FontManager;
class TextRenderer;
class Color;

} // openage::renderer

Expand Down Expand Up @@ -180,8 +181,9 @@ class Engine : public ResizeHandler, public options::OptionNode {

/**
* register a hud drawing handler, drawn in hud coordinates.
* order: 1 above, -1 below
*/
void register_drawhud_action(HudHandler *handler);
void register_drawhud_action(HudHandler *handler, int order = 1);

/**
* register a draw handler, run in game coordinates.
Expand Down Expand Up @@ -260,7 +262,7 @@ class Engine : public ResizeHandler, public options::OptionNode {
/**
* render text with the at a position with specified font size
*/
void render_text(coord::viewport position, size_t size, const char *format, ...) ATTRIBUTE_FORMAT(4, 5);
void render_text(coord::viewport position, size_t size, const renderer::Color &color, const char *format, ...) ATTRIBUTE_FORMAT(5, 6);

/**
* move the phys3 camera incorporated in the engine
Expand Down
Loading