Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Add icon to the console wrapper, add option to set icon for the console wrapper on export. #68699

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions platform/windows/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ void EditorExportPlatformWindows::get_export_options(List<ExportOption> *r_optio

r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "application/modify_resources"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.ico"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/console_wrapper_icon", PROPERTY_HINT_FILE, "*.ico"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/file_version", PROPERTY_HINT_PLACEHOLDER_TEXT, "1.0.0.0"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/product_version", PROPERTY_HINT_PLACEHOLDER_TEXT, "1.0.0.0"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/company_name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Company Name"), ""));
Expand All @@ -120,7 +121,7 @@ void EditorExportPlatformWindows::get_export_options(List<ExportOption> *r_optio
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/trademarks"), ""));
}

Error EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset> &p_preset, const String &p_path, bool p_set_icon) {
Error EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset> &p_preset, const String &p_path, bool p_console_icon) {
String rcedit_path = EDITOR_GET("export/windows/rcedit");

if (rcedit_path != String() && !FileAccess::exists(rcedit_path)) {
Expand All @@ -147,6 +148,12 @@ Error EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset
#endif

String icon_path = ProjectSettings::get_singleton()->globalize_path(p_preset->get("application/icon"));
if (p_console_icon) {
String console_icon_path = ProjectSettings::get_singleton()->globalize_path(p_preset->get("application/console_wrapper_icon"));
if (!console_icon_path.is_empty() && FileAccess::exists(console_icon_path)) {
icon_path = console_icon_path;
}
}
String file_verion = p_preset->get("application/file_version");
String product_version = p_preset->get("application/product_version");
String company_name = p_preset->get("application/company_name");
Expand All @@ -158,7 +165,7 @@ Error EditorExportPlatformWindows::_rcedit_add_data(const Ref<EditorExportPreset

List<String> args;
args.push_back(p_path);
if (!icon_path.is_empty() && p_set_icon) {
if (!icon_path.is_empty()) {
args.push_back("--set-icon");
args.push_back(icon_path);
}
Expand Down
2 changes: 1 addition & 1 deletion platform/windows/export/export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "platform/windows/logo.gen.h"

class EditorExportPlatformWindows : public EditorExportPlatformPC {
Error _rcedit_add_data(const Ref<EditorExportPreset> &p_preset, const String &p_path, bool p_set_icon);
Error _rcedit_add_data(const Ref<EditorExportPreset> &p_preset, const String &p_path, bool p_console_icon);
Error _code_sign(const Ref<EditorExportPreset> &p_preset, const String &p_path);

public:
Expand Down
2 changes: 2 additions & 0 deletions platform/windows/godot_res_wrap.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#define _MKSTR(m_x) _STR(m_x)
#endif

GODOT_ICON ICON platform/windows/godot.ico

1 VERSIONINFO
FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0
Expand Down