Use custom native-run icons for Android and HTML5
This commit is contained in:
parent
90592ccf03
commit
92367968e7
|
@ -197,6 +197,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) { return OK; }
|
virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) { return OK; }
|
||||||
|
virtual Ref<Texture> get_run_icon() const { return get_logo(); }
|
||||||
|
|
||||||
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const = 0;
|
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const = 0;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ void EditorRunNative::_notification(int p_what) {
|
||||||
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(i);
|
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(i);
|
||||||
if (eep.is_null())
|
if (eep.is_null())
|
||||||
continue;
|
continue;
|
||||||
Ref<ImageTexture> icon = eep->get_logo();
|
Ref<ImageTexture> icon = eep->get_run_icon();
|
||||||
if (!icon.is_null()) {
|
if (!icon.is_null()) {
|
||||||
Ref<Image> im = icon->get_data();
|
Ref<Image> im = icon->get_data();
|
||||||
im = im->duplicate();
|
im = im->duplicate();
|
||||||
|
|
31
methods.py
31
methods.py
|
@ -1513,23 +1513,26 @@ def split_lib(self, libname):
|
||||||
def save_active_platforms(apnames, ap):
|
def save_active_platforms(apnames, ap):
|
||||||
|
|
||||||
for x in ap:
|
for x in ap:
|
||||||
pth = x + "/logo.png"
|
names = ['logo']
|
||||||
# print("open path: "+pth)
|
if os.path.isfile(x + "/run_icon.png"):
|
||||||
pngf = open(pth, "rb")
|
names.append('run_icon')
|
||||||
b = pngf.read(1)
|
|
||||||
str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
|
for name in names:
|
||||||
str += " static const unsigned char _" + x[9:] + "_logo[]={"
|
pngf = open(x + "/" + name + ".png", "rb")
|
||||||
while(len(b) == 1):
|
|
||||||
str += hex(ord(b))
|
|
||||||
b = pngf.read(1)
|
b = pngf.read(1)
|
||||||
if (len(b) == 1):
|
str = " /* AUTOGENERATED FILE, DO NOT EDIT */ \n"
|
||||||
str += ","
|
str += " static const unsigned char _" + x[9:] + "_" + name + "[]={"
|
||||||
|
while(len(b) == 1):
|
||||||
|
str += hex(ord(b))
|
||||||
|
b = pngf.read(1)
|
||||||
|
if (len(b) == 1):
|
||||||
|
str += ","
|
||||||
|
|
||||||
str += "};\n"
|
str += "};\n"
|
||||||
|
|
||||||
wf = x + "/logo.gen.h"
|
wf = x + "/" + name + ".gen.h"
|
||||||
logow = open(wf, "wb")
|
pngw = open(wf, "wb")
|
||||||
logow.write(str)
|
pngw.write(str)
|
||||||
|
|
||||||
|
|
||||||
def no_verbose(sys, env):
|
def no_verbose(sys, env):
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "os/file_access.h"
|
#include "os/file_access.h"
|
||||||
#include "os/os.h"
|
#include "os/os.h"
|
||||||
#include "platform/android/logo.gen.h"
|
#include "platform/android/logo.gen.h"
|
||||||
|
#include "platform/android/run_icon.gen.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -2042,6 +2043,7 @@ class EditorExportAndroid : public EditorExportPlatform {
|
||||||
GDCLASS(EditorExportAndroid, EditorExportPlatform)
|
GDCLASS(EditorExportAndroid, EditorExportPlatform)
|
||||||
|
|
||||||
Ref<ImageTexture> logo;
|
Ref<ImageTexture> logo;
|
||||||
|
Ref<ImageTexture> run_icon;
|
||||||
|
|
||||||
struct Device {
|
struct Device {
|
||||||
|
|
||||||
|
@ -3036,6 +3038,10 @@ public:
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual Ref<Texture> get_run_icon() const {
|
||||||
|
return run_icon;
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
|
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
|
||||||
|
|
||||||
r_missing_templates = find_export_template("android_debug.apk") == String() || find_export_template("android_release.apk") == String();
|
r_missing_templates = find_export_template("android_debug.apk") == String() || find_export_template("android_release.apk") == String();
|
||||||
|
@ -3524,9 +3530,13 @@ public:
|
||||||
EditorExportAndroid() {
|
EditorExportAndroid() {
|
||||||
|
|
||||||
Ref<Image> img = memnew(Image(_android_logo));
|
Ref<Image> img = memnew(Image(_android_logo));
|
||||||
logo = Ref<ImageTexture>(memnew(ImageTexture));
|
logo.instance();
|
||||||
logo->create_from_image(img);
|
logo->create_from_image(img);
|
||||||
|
|
||||||
|
img = Ref<Image>(memnew(Image(_android_run_icon)));
|
||||||
|
run_icon.instance();
|
||||||
|
run_icon->create_from_image(img);
|
||||||
|
|
||||||
device_lock = Mutex::create();
|
device_lock = Mutex::create();
|
||||||
device_thread = Thread::create(_device_poll_thread, this);
|
device_thread = Thread::create(_device_poll_thread, this);
|
||||||
devices_changed = true;
|
devices_changed = true;
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 636 B |
|
@ -31,6 +31,7 @@
|
||||||
#include "editor_export.h"
|
#include "editor_export.h"
|
||||||
#include "io/zip_io.h"
|
#include "io/zip_io.h"
|
||||||
#include "platform/javascript/logo.gen.h"
|
#include "platform/javascript/logo.gen.h"
|
||||||
|
#include "platform/javascript/run_icon.gen.h"
|
||||||
|
|
||||||
#define EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE "webassembly_release.zip"
|
#define EXPORT_TEMPLATE_WEBASSEMBLY_RELEASE "webassembly_release.zip"
|
||||||
#define EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG "webassembly_debug.zip"
|
#define EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG "webassembly_debug.zip"
|
||||||
|
@ -42,6 +43,7 @@ class EditorExportPlatformJavaScript : public EditorExportPlatform {
|
||||||
GDCLASS(EditorExportPlatformJavaScript, EditorExportPlatform)
|
GDCLASS(EditorExportPlatformJavaScript, EditorExportPlatform)
|
||||||
|
|
||||||
Ref<ImageTexture> logo;
|
Ref<ImageTexture> logo;
|
||||||
|
Ref<ImageTexture> run_icon;
|
||||||
|
|
||||||
void _fix_html(Vector<uint8_t> &p_html, const Ref<EditorExportPreset> &p_preset, const String &p_name, bool p_debug);
|
void _fix_html(Vector<uint8_t> &p_html, const Ref<EditorExportPreset> &p_preset, const String &p_name, bool p_debug);
|
||||||
void _fix_fsloader_js(Vector<uint8_t> &p_js, const String &p_pack_name, uint64_t p_pack_size);
|
void _fix_fsloader_js(Vector<uint8_t> &p_js, const String &p_pack_name, uint64_t p_pack_size);
|
||||||
|
@ -68,6 +70,7 @@ public:
|
||||||
virtual String get_device_name(int p_device) const { return TTR("Run in Browser"); }
|
virtual String get_device_name(int p_device) const { return TTR("Run in Browser"); }
|
||||||
virtual String get_device_info(int p_device) const { return TTR("Run exported HTML in the system's default browser."); }
|
virtual String get_device_info(int p_device) const { return TTR("Run exported HTML in the system's default browser."); }
|
||||||
virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags);
|
virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags);
|
||||||
|
virtual Ref<Texture> get_run_icon() const;
|
||||||
|
|
||||||
EditorExportPlatformJavaScript();
|
EditorExportPlatformJavaScript();
|
||||||
};
|
};
|
||||||
|
@ -314,11 +317,20 @@ Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_prese
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref<Texture> EditorExportPlatformJavaScript::get_run_icon() const {
|
||||||
|
|
||||||
|
return run_icon;
|
||||||
|
}
|
||||||
|
|
||||||
EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() {
|
EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() {
|
||||||
|
|
||||||
Ref<Image> img = memnew(Image(_javascript_logo));
|
Ref<Image> img = memnew(Image(_javascript_logo));
|
||||||
logo.instance();
|
logo.instance();
|
||||||
logo->create_from_image(img);
|
logo->create_from_image(img);
|
||||||
|
|
||||||
|
img = Ref<Image>(memnew(Image(_javascript_run_icon)));
|
||||||
|
run_icon.instance();
|
||||||
|
run_icon->create_from_image(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_javascript_exporter() {
|
void register_javascript_exporter() {
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 471 B |
Loading…
Reference in New Issue