diff options
41 files changed, 83 insertions, 2153 deletions
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index b35d4fb36a..17b474531e 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -5,8 +5,9 @@ </brief_description> <description> A color is represented by red, green, and blue [code](r, g, b)[/code] components. Additionally, [code]a[/code] represents the alpha component, often used for transparency. Values are in floating-point and usually range from 0 to 1. Some properties (such as [member CanvasItem.modulate]) may accept values greater than 1. - You can also create a color from standardized color names by using [method @GDScript.ColorN] or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url]. + You can also create a color from standardized color names by using [method @GDScript.ColorN] or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url]. If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8]. + [b]Note:[/b] In a boolean context, a Color will evaluate to [code]false[/code] if it's equal to [code]Color(0, 0, 0, 1)[/code] (opaque black). Otherwise, a Color will always evaluate to [code]true[/code]. </description> <tutorials> </tutorials> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 23473290c7..105def21ca 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -205,7 +205,7 @@ <return type="String"> </return> <description> - Returns the name of the host OS. Possible values are: [code]"Android"[/code], [code]"Haiku"[/code], [code]"iOS"[/code], [code]"HTML5"[/code], [code]"OSX"[/code], [code]"Server"[/code], [code]"Windows"[/code], [code]"UWP"[/code], [code]"X11"[/code]. + Returns the name of the host OS. Possible values are: [code]"Android"[/code], [code]"iOS"[/code], [code]"HTML5"[/code], [code]"OSX"[/code], [code]"Server"[/code], [code]"Windows"[/code], [code]"UWP"[/code], [code]"X11"[/code]. </description> </method> <method name="get_process_id" qualifiers="const"> diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 64ebc1fa09..7f4a212679 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -5,7 +5,8 @@ </brief_description> <description> 2-element structure that can be used to represent positions in 2D space or any other pair of numeric values. - It uses floating point coordinates. + It uses floating-point coordinates. See [Vector2i] for its integer counterpart. + [b]Note:[/b] In a boolean context, a Vector2 will evaluate to [code]false[/code] if it's equal to [code]Vector2(0, 0)[/code]. Otherwise, a Vector2 will always evaluate to [code]true[/code]. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml index 71c7aaa4e5..2f7ca985b2 100644 --- a/doc/classes/Vector2i.xml +++ b/doc/classes/Vector2i.xml @@ -5,7 +5,8 @@ </brief_description> <description> 2-element structure that can be used to represent positions in 2D space or any other pair of numeric values. - It uses integer coordinates. + It uses integer coordinates and is therefore preferable to [Vector2] when exact precision is required. + [b]Note:[/b] In a boolean context, a Vector2i will evaluate to [code]false[/code] if it's equal to [code]Vector2i(0, 0)[/code]. Otherwise, a Vector2i will always evaluate to [code]true[/code]. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 29222bb4d1..0c861e5ee2 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -5,7 +5,8 @@ </brief_description> <description> 3-element structure that can be used to represent positions in 3D space or any other pair of numeric values. - It uses floating point coordinates. + It uses floating-point coordinates. See [Vector3i] for its integer counterpart. + [b]Note:[/b] In a boolean context, a Vector3 will evaluate to [code]false[/code] if it's equal to [code]Vector3(0, 0, 0)[/code]. Otherwise, a Vector3 will always evaluate to [code]true[/code]. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> diff --git a/doc/classes/Vector3i.xml b/doc/classes/Vector3i.xml index c5aa3d0347..91d64ea609 100644 --- a/doc/classes/Vector3i.xml +++ b/doc/classes/Vector3i.xml @@ -5,7 +5,8 @@ </brief_description> <description> 3-element structure that can be used to represent positions in 3D space or any other pair of numeric values. - It uses integer coordinates. + It uses integer coordinates and is therefore preferable to [Vector3] when exact precision is required. + [b]Note:[/b] In a boolean context, a Vector3i will evaluate to [code]false[/code] if it's equal to [code]Vector3i(0, 0, 0)[/code]. Otherwise, a Vector3i will always evaluate to [code]true[/code]. </description> <tutorials> <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> diff --git a/doc/classes/bool.xml b/doc/classes/bool.xml index 4482a280b2..869fc14d40 100644 --- a/doc/classes/bool.xml +++ b/doc/classes/bool.xml @@ -4,14 +4,14 @@ Boolean built-in type. </brief_description> <description> - Boolean is a built-in type. It can represent any data type that is either a true or false value. You can think of it as an switch with on or off (1 or 0) setting. It's often used as part of programming logic in condition statements like [code]if[/code] statements. - [b]Note:[/b] In a code below [code]if can_shoot[/code] is equivalent of [code]if can_shoot == true[/code]. It is good practice to follow the natural spoken language structure when possible. Use [code]if can_shoot[/code] rather than [code]if can_shoot == true[/code] and use [code]if not can_shoot[/code] rather than [code]if can_shoot == false[/code]. + Boolean is a built-in type. There are two boolean values: [code]true[/code] and [code]false[/code]. You can think of it as an switch with on or off (1 or 0) setting. Booleans are used in programming for logic in condition statements, like [code]if[/code] statements. + Booleans can be directly used in [code]if[/code] statements. The code below demonstrates this on the [code]if can_shoot:[/code] line. You don't need to use [code]== true[/code], you only need [code]if can_shoot:[/code]. Similarly, use [code]if not can_shoot:[/code] rather than [code]== false[/code]. [codeblock] var can_shoot = true func shoot(): if can_shoot: - # Perform shooting actions here. + pass # Perform shooting actions here. [/codeblock] The following code will only create a bullet if both conditions are met: action "shoot" is pressed and if [code]can_shoot[/code] is [code]true[/code]. [b]Note:[/b] [code]Input.is_action_pressed("shoot")[/code] is also a boolean that is [code]true[/code] when "shoot" is pressed and [code]false[/code] when "shoot" isn't pressed. @@ -46,7 +46,7 @@ <argument index="0" name="from" type="int"> </argument> <description> - Cast an [int] value to a boolean value, this method will return [code]true[/code] if called with an integer value different to 0 and [code]false[/code] in other case. + Cast an [int] value to a boolean value, this method will return [code]false[/code] if [code]0[/code] is passed in, and [code]true[/code] for all other ints. </description> </method> <method name="bool"> @@ -55,7 +55,7 @@ <argument index="0" name="from" type="float"> </argument> <description> - Cast a [float] value to a boolean value, this method will return [code]true[/code] if called with a floating-point value different to 0 and [code]false[/code] in other case. + Cast a [float] value to a boolean value, this method will return [code]false[/code] if [code]0.0[/code] is passed in, and [code]true[/code] for all other floats. </description> </method> <method name="bool"> @@ -64,7 +64,8 @@ <argument index="0" name="from" type="String"> </argument> <description> - Cast a [String] value to a boolean value, this method will return [code]true[/code] if called with a non-empty string and [code]false[/code] in other case. Examples: [code]bool("False")[/code] returns [code]true[/code], [code]bool("")[/code] returns [code]false[/code]. + Cast a [String] value to a boolean value, this method will return [code]false[/code] if [code]""[/code] is passed in, and [code]true[/code] for all non-empty strings. + Examples: [code]bool("False")[/code] returns [code]true[/code], [code]bool("")[/code] returns [code]false[/code]. </description> </method> </methods> diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 25594bf7c8..951bec2c83 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -100,7 +100,6 @@ void EditorExportPreset::update_files_to_export() { for (int i = 0; i < to_remove.size(); ++i) { selected_files.erase(to_remove[i]); } - EditorExport::singleton->save_presets(); } Vector<String> EditorExportPreset::get_files_to_export() const { diff --git a/editor/icons/AssetLib.svg b/editor/icons/AssetLib.svg index 72b20ec047..22307efde3 100644 --- a/editor/icons/AssetLib.svg +++ b/editor/icons/AssetLib.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1c-1.6569 0-3 1.3431-3 3v2h-3c-.66446.0003505-1.1438.6366-.96094 1.2754l2 7c.12287.42881.51487.7244.96094.72461h8c.44606-.000209.83806-.2958.96094-.72461l2-7c.1829-.63879-.29648-1.275-.96094-1.2754h-3v-2c0-1.6569-1.3431-3-3-3zm0 2c.55228 0 1 .44772 1 1v2h-2v-2c0-.55228.44772-1 1-1z" fill="#e0e0e0"/></svg>
\ No newline at end of file +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#e0e0e0" stroke-linejoin="round" stroke-width="2"><path d="m8 1v9l4-4"/><path d="m8 10-4-4"/><path d="m2 10v4h12v-4" stroke-linecap="round"/></g></svg> diff --git a/editor/icons/ToolButton.svg b/editor/icons/ToolButton.svg deleted file mode 100644 index 98a41d2a08..0000000000 --- a/editor/icons/ToolButton.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m11 1.1738c-1.1979.4235-1.999 1.5557-2 2.8262.0009552 1.2705.80214 2.4027 2 2.8262v7.1738c0 .554.446 1 1 1s1-.446 1-1v-7.1758c1.1972-.4232 1.9982-1.5544 2-2.8242-.0018-1.2698-.80282-2.401-2-2.8242v2.8242c0 .5523-.44772 1-1 1s-1-.4477-1-1zm-7 1.8262v3.1328l-1.4453-.96484-1.1094 1.6641 3 2c.3359.22389.77347.22389 1.1094 0l3-2-1.1094-1.6641-1.4453.96484v-3.1328zm-.5 8c-.831 0-1.5.669-1.5 1.5v.5h-1v2h8v-2h-1v-.5c0-.831-.669-1.5-1.5-1.5z" fill="#a5efac"/></svg>
\ No newline at end of file diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 4797ae642e..bf698a5ceb 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1207,7 +1207,26 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bool p_already_accepted) { Ref<InputEventMouseButton> b = p_event; if (b.is_valid() && !p_already_accepted) { - bool pan_on_scroll = bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan")) && !b->get_control(); + const bool pan_on_scroll = bool(EditorSettings::get_singleton()->get("editors/2d/scroll_to_pan")) && !b->get_control(); + + if (pan_on_scroll) { + // Perform horizontal scrolling first so we can check for Shift being held. + if (b->is_pressed() && + (b->get_button_index() == BUTTON_WHEEL_LEFT || (b->get_shift() && b->get_button_index() == BUTTON_WHEEL_UP))) { + // Pan left + view_offset.x -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor(); + update_viewport(); + return true; + } + + if (b->is_pressed() && + (b->get_button_index() == BUTTON_WHEEL_RIGHT || (b->get_shift() && b->get_button_index() == BUTTON_WHEEL_DOWN))) { + // Pan right + view_offset.x += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor(); + update_viewport(); + return true; + } + } if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_DOWN) { // Scroll or pan down @@ -1239,24 +1258,6 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo return true; } - if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_LEFT) { - // Pan left - if (pan_on_scroll) { - view_offset.x -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor(); - update_viewport(); - return true; - } - } - - if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_RIGHT) { - // Pan right - if (pan_on_scroll) { - view_offset.x += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor(); - update_viewport(); - return true; - } - } - if (!panning) { if (b->is_pressed() && (b->get_button_index() == BUTTON_MIDDLE || diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index f2c4a533ea..a8029e1e2b 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -1865,7 +1865,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { restart_icon->set_v_size_flags(Control::SIZE_SHRINK_CENTER); restart_hb->add_child(restart_icon); restart_label = memnew(Label); - restart_label->set_text(TTR("The editor must be restarted for changes to take effect.")); + restart_label->set_text(TTR("Changed settings will be applied to the editor after restarting.")); restart_hb->add_child(restart_label); restart_hb->add_spacer(); Button *restart_button = memnew(Button); diff --git a/modules/bullet/SCsub b/modules/bullet/SCsub index b853ebfc63..21bdcca18e 100644 --- a/modules/bullet/SCsub +++ b/modules/bullet/SCsub @@ -201,8 +201,8 @@ if env["builtin_bullet"]: env_bullet.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path]) else: env_bullet.Prepend(CPPPATH=[thirdparty_dir]) - # if env['target'] == "debug" or env['target'] == "release_debug": - # env_bullet.Append(CPPDEFINES=['BT_DEBUG']) + if env["target"] == "debug" or env["target"] == "release_debug": + env_bullet.Append(CPPDEFINES=["DEBUG"]) env_bullet.Append(CPPDEFINES=["BT_USE_OLD_DAMPING_METHOD"]) diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index 99f58e7059..1b6ccbcef4 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -152,6 +152,15 @@ int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Tra } bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &r_closest_safe, float &r_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, ShapeRestInfo *r_info) { + r_closest_safe = 0.0f; + r_closest_unsafe = 0.0f; + btVector3 bt_motion; + G_TO_B(p_motion, bt_motion); + + if (bt_motion.fuzzyZero()) { + return false; + } + ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->getornull(p_shape); btCollisionShape *btShape = shape->create_bt_shape(p_xform.basis.get_scale(), p_margin); @@ -162,9 +171,6 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf } btConvexShape *bt_convex_shape = static_cast<btConvexShape *>(btShape); - btVector3 bt_motion; - G_TO_B(p_motion, bt_motion); - btTransform bt_xform_from; G_TO_B(p_xform, bt_xform_from); UNSCALE_BT_BASIS(bt_xform_from); @@ -178,9 +184,6 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf space->dynamicsWorld->convexSweepTest(bt_convex_shape, bt_xform_from, bt_xform_to, btResult, space->dynamicsWorld->getDispatchInfo().m_allowedCcdPenetration); - r_closest_unsafe = 1.0; - r_closest_safe = 1.0; - if (btResult.hasHit()) { const btScalar l = bt_motion.length(); r_closest_unsafe = btResult.m_closestHitFraction; @@ -196,6 +199,9 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf r_info->collider_id = collision_object->get_instance_id(); r_info->shape = btResult.m_shapeId; } + } else { + r_closest_safe = 1.0f; + r_closest_unsafe = 1.0f; } bulletdelete(bt_convex_shape); diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp index ded0b970dc..d0c9bf5d38 100644 --- a/modules/csg/csg.cpp +++ b/modules/csg/csg.cpp @@ -904,8 +904,12 @@ void CSGBrushOperation::Build2DFaces::_merge_faces(const Vector<int> &p_segment_ vertices[p_segment_indices[closest_idx]].point }; if (are_segements_parallel(edge1, edge2, vertex_snap2)) { - degenerate_points.push_back(outer_edge_idx[0]); - degenerate_points.push_back(outer_edge_idx[1]); + if (!degenerate_points.find(outer_edge_idx[0])) { + degenerate_points.push_back(outer_edge_idx[0]); + } + if (!degenerate_points.find(outer_edge_idx[1])) { + degenerate_points.push_back(outer_edge_idx[1]); + } continue; } diff --git a/platform/haiku/SCsub b/platform/haiku/SCsub deleted file mode 100644 index dbff6c5ae9..0000000000 --- a/platform/haiku/SCsub +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python - -Import("env") - -common_haiku = [ - "os_haiku.cpp", - "context_gl_haiku.cpp", - "haiku_application.cpp", - "haiku_direct_window.cpp", - "haiku_gl_view.cpp", - "key_mapping_haiku.cpp", - "audio_driver_media_kit.cpp", -] - -target = env.add_program("#bin/godot", ["godot_haiku.cpp"] + common_haiku) - -command = env.Command("#bin/godot.rsrc", "#platform/haiku/godot.rdef", ["rc -o $TARGET $SOURCE"]) - - -def addResourcesAction(target=None, source=None, env=None): - return env.Execute("xres -o " + File(target)[0].path + " bin/godot.rsrc") - - -env.AddPostAction(target, addResourcesAction) -env.Depends(target, command) diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp deleted file mode 100644 index 2fbbeeb176..0000000000 --- a/platform/haiku/audio_driver_media_kit.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/*************************************************************************/ -/* audio_driver_media_kit.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "audio_driver_media_kit.h" - -#ifdef MEDIA_KIT_ENABLED - -#include "core/project_settings.h" - -int32_t *AudioDriverMediaKit::samples_in = nullptr; - -Error AudioDriverMediaKit::init() { - active = false; - - mix_rate = GLOBAL_GET("audio/mix_rate"); - speaker_mode = SPEAKER_MODE_STEREO; - channels = 2; - - int latency = GLOBAL_GET("audio/output_latency"); - buffer_size = next_power_of_2(latency * mix_rate / 1000); - samples_in = memnew_arr(int32_t, buffer_size * channels); - - media_raw_audio_format format; - format = media_raw_audio_format::wildcard; - format.frame_rate = mix_rate; - format.channel_count = channels; - format.format = media_raw_audio_format::B_AUDIO_INT; - format.byte_order = B_MEDIA_LITTLE_ENDIAN; - format.buffer_size = buffer_size * sizeof(int32_t) * channels; - - player = new BSoundPlayer( - &format, - "godot_sound_server", - AudioDriverMediaKit::PlayBuffer, - nullptr, - this); - - if (player->InitCheck() != B_OK) { - fprintf(stderr, "MediaKit ERR: can not create a BSoundPlayer instance\n"); - ERR_FAIL_COND_V(player == nullptr, ERR_CANT_OPEN); - } - - player->Start(); - - return OK; -} - -void AudioDriverMediaKit::PlayBuffer(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format) { - AudioDriverMediaKit *ad = (AudioDriverMediaKit *)cookie; - int32_t *buf = (int32_t *)buffer; - - if (!ad->active) { - for (unsigned int i = 0; i < ad->buffer_size * ad->channels; i++) { - AudioDriverMediaKit::samples_in[i] = 0; - } - } else { - ad->lock(); - ad->audio_server_process(ad->buffer_size, AudioDriverMediaKit::samples_in); - ad->unlock(); - } - - for (unsigned int i = 0; i < ad->buffer_size * ad->channels; i++) { - buf[i] = AudioDriverMediaKit::samples_in[i]; - } -} - -void AudioDriverMediaKit::start() { - active = true; -} - -int AudioDriverMediaKit::get_mix_rate() const { - return mix_rate; -} - -AudioDriverMediaKit::SpeakerMode AudioDriverMediaKit::get_speaker_mode() const { - return speaker_mode; -} - -void AudioDriverMediaKit::lock() { - if (!mutex) - return; - - mutex.lock(); -} - -void AudioDriverMediaKit::unlock() { - if (!mutex) - return; - - mutex.unlock(); -} - -void AudioDriverMediaKit::finish() { - delete player; - - if (samples_in) { - memdelete_arr(samples_in); - }; -} - -AudioDriverMediaKit::AudioDriverMediaKit() { - player = nullptr; -} - -AudioDriverMediaKit::~AudioDriverMediaKit() { -} - -#endif diff --git a/platform/haiku/audio_driver_media_kit.h b/platform/haiku/audio_driver_media_kit.h deleted file mode 100644 index 8272780fa7..0000000000 --- a/platform/haiku/audio_driver_media_kit.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************/ -/* audio_driver_media_kit.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "servers/audio_server.h" - -#ifdef MEDIA_KIT_ENABLED - -#include "core/os/mutex.h" -#include "core/os/thread.h" - -#include <kernel/image.h> // needed for image_id - -#include <SoundPlayer.h> - -class AudioDriverMediaKit : public AudioDriver { - Mutex mutex; - - BSoundPlayer *player; - static int32_t *samples_in; - - static void PlayBuffer(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format); - - unsigned int mix_rate; - SpeakerMode speaker_mode; - unsigned int buffer_size; - int channels; - - bool active; - -public: - const char *get_name() const { - return "MediaKit"; - }; - - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual SpeakerMode get_speaker_mode() const; - virtual void lock(); - virtual void unlock(); - virtual void finish(); - - AudioDriverMediaKit(); - ~AudioDriverMediaKit(); -}; - -#endif diff --git a/platform/haiku/context_gl_haiku.cpp b/platform/haiku/context_gl_haiku.cpp deleted file mode 100644 index 3c4d43ff71..0000000000 --- a/platform/haiku/context_gl_haiku.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************/ -/* context_gl_haiku.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "context_gl_haiku.h" - -#if defined(OPENGL_ENABLED) - -ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow *p_window) { - window = p_window; - - uint32 type = BGL_RGB | BGL_DOUBLE | BGL_DEPTH; - view = new HaikuGLView(window->Bounds(), type); - - use_vsync = false; -} - -ContextGL_Haiku::~ContextGL_Haiku() { - delete view; -} - -Error ContextGL_Haiku::initialize() { - window->AddChild(view); - window->SetHaikuGLView(view); - - return OK; -} - -void ContextGL_Haiku::release_current() { - view->UnlockGL(); -} - -void ContextGL_Haiku::make_current() { - view->LockGL(); -} - -void ContextGL_Haiku::swap_buffers() { - view->SwapBuffers(use_vsync); -} - -int ContextGL_Haiku::get_window_width() { - return window->Bounds().IntegerWidth(); -} - -int ContextGL_Haiku::get_window_height() { - return window->Bounds().IntegerHeight(); -} - -void ContextGL_Haiku::set_use_vsync(bool p_use) { - use_vsync = p_use; -} - -bool ContextGL_Haiku::is_using_vsync() const { - return use_vsync; -} - -#endif diff --git a/platform/haiku/context_gl_haiku.h b/platform/haiku/context_gl_haiku.h deleted file mode 100644 index c5d258915d..0000000000 --- a/platform/haiku/context_gl_haiku.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************/ -/* context_gl_haiku.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef CONTEXT_GL_HAIKU_H -#define CONTEXT_GL_HAIKU_H - -#if defined(OPENGL_ENABLED) - -#include "haiku_direct_window.h" -#include "haiku_gl_view.h" - -class ContextGL_Haiku { -private: - HaikuGLView *view; - HaikuDirectWindow *window; - - bool use_vsync; - -public: - Error initialize(); - void release_current(); - void make_current(); - void swap_buffers(); - int get_window_width(); - int get_window_height(); - - void set_use_vsync(bool p_use); - bool is_using_vsync() const; - - ContextGL_Haiku(HaikuDirectWindow *p_window); - ~ContextGL_Haiku(); -}; - -#endif -#endif diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py deleted file mode 100644 index 0b84df8f9b..0000000000 --- a/platform/haiku/detect.py +++ /dev/null @@ -1,158 +0,0 @@ -import os -import sys - - -def is_active(): - return True - - -def get_name(): - return "Haiku" - - -def can_build(): - - if os.name != "posix" or sys.platform == "darwin": - return False - - return True - - -def get_opts(): - from SCons.Variables import EnumVariable - - return [ - EnumVariable("debug_symbols", "Add debugging symbols to release builds", "yes", ("yes", "no", "full")), - ] - - -def get_flags(): - - return [] - - -def configure(env): - - ## Build type - - if env["target"] == "release": - env.Prepend(CCFLAGS=["-O3"]) - if env["debug_symbols"] == "yes": - env.Prepend(CCFLAGS=["-g1"]) - if env["debug_symbols"] == "full": - env.Prepend(CCFLAGS=["-g2"]) - - elif env["target"] == "release_debug": - env.Prepend(CCFLAGS=["-O2", "-DDEBUG_ENABLED"]) - if env["debug_symbols"] == "yes": - env.Prepend(CCFLAGS=["-g1"]) - if env["debug_symbols"] == "full": - env.Prepend(CCFLAGS=["-g2"]) - - elif env["target"] == "debug": - env.Prepend(CCFLAGS=["-g3", "-DDEBUG_ENABLED", "-DDEBUG_MEMORY_ENABLED"]) - - ## Architecture - - is64 = sys.maxsize > 2 ** 32 - if env["bits"] == "default": - env["bits"] = "64" if is64 else "32" - - ## Compiler configuration - - env["CC"] = "gcc-x86" - env["CXX"] = "g++-x86" - - ## Dependencies - - if not env["builtin_libwebp"]: - env.ParseConfig("pkg-config libwebp --cflags --libs") - - # freetype depends on libpng and zlib, so bundling one of them while keeping others - # as shared libraries leads to weird issues - if env["builtin_freetype"] or env["builtin_libpng"] or env["builtin_zlib"]: - env["builtin_freetype"] = True - env["builtin_libpng"] = True - env["builtin_zlib"] = True - - if not env["builtin_freetype"]: - env.ParseConfig("pkg-config freetype2 --cflags --libs") - - if not env["builtin_libpng"]: - env.ParseConfig("pkg-config libpng16 --cflags --libs") - - if not env["builtin_bullet"]: - # We need at least version 2.88 - import subprocess - - bullet_version = subprocess.check_output(["pkg-config", "bullet", "--modversion"]).strip() - if bullet_version < "2.88": - # Abort as system bullet was requested but too old - print( - "Bullet: System version {0} does not match minimal requirements ({1}). Aborting.".format( - bullet_version, "2.88" - ) - ) - sys.exit(255) - env.ParseConfig("pkg-config bullet --cflags --libs") - - if not env["builtin_enet"]: - env.ParseConfig("pkg-config libenet --cflags --libs") - - if not env["builtin_squish"]: - env.ParseConfig("pkg-config libsquish --cflags --libs") - - if not env["builtin_zstd"]: - env.ParseConfig("pkg-config libzstd --cflags --libs") - - # Sound and video libraries - # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) - - if not env["builtin_libtheora"]: - env["builtin_libogg"] = False # Needed to link against system libtheora - env["builtin_libvorbis"] = False # Needed to link against system libtheora - env.ParseConfig("pkg-config theora theoradec --cflags --libs") - - if not env["builtin_libvpx"]: - env.ParseConfig("pkg-config vpx --cflags --libs") - - if not env["builtin_libvorbis"]: - env["builtin_libogg"] = False # Needed to link against system libvorbis - env.ParseConfig("pkg-config vorbis vorbisfile --cflags --libs") - - if not env["builtin_opus"]: - env["builtin_libogg"] = False # Needed to link against system opus - env.ParseConfig("pkg-config opus opusfile --cflags --libs") - - if not env["builtin_libogg"]: - env.ParseConfig("pkg-config ogg --cflags --libs") - - if env["builtin_libtheora"]: - list_of_x86 = ["x86_64", "x86", "i386", "i586"] - if any(platform.machine() in s for s in list_of_x86): - env["x86_libtheora_opt_gcc"] = True - - if not env["builtin_wslay"]: - env.ParseConfig("pkg-config libwslay --cflags --libs") - - if not env["builtin_mbedtls"]: - # mbedTLS does not provide a pkgconfig config yet. See https://github.com/ARMmbed/mbedtls/issues/228 - env.Append(LIBS=["mbedtls", "mbedcrypto", "mbedx509"]) - - if not env["builtin_miniupnpc"]: - # No pkgconfig file so far, hardcode default paths. - env.Prepend(CPPPATH=["/system/develop/headers/x86/miniupnpc"]) - env.Append(LIBS=["miniupnpc"]) - - # On Linux wchar_t should be 32-bits - # 16-bit library shouldn't be required due to compiler optimisations - if not env["builtin_pcre2"]: - env.ParseConfig("pkg-config libpcre2-32 --cflags --libs") - - ## Flags - - env.Prepend(CPPPATH=["#platform/haiku"]) - env.Append(CPPDEFINES=["UNIX_ENABLED", "OPENGL_ENABLED", "GLES_ENABLED"]) - env.Append(CPPDEFINES=["MEDIA_KIT_ENABLED"]) - env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"]) # TODO: enable when we have pthread_setname_np - env.Append(LIBS=["be", "game", "media", "network", "bnetapi", "z", "GL"]) diff --git a/platform/haiku/godot.rdef b/platform/haiku/godot.rdef deleted file mode 100644 index a55cddbf0d..0000000000 --- a/platform/haiku/godot.rdef +++ /dev/null @@ -1,60 +0,0 @@ -resource app_version { - major = 2, - middle = 0, - minor = 0, - - variety = B_APPV_FINAL, - internal = 0, - - short_info = "Godot Game Engine", - long_info = "An advanced, feature packed, multi-platform 2D and 3D game engine." -}; - -resource app_signature "application/x-vnd.godot"; - -resource vector_icon { - $"6E6369660403A39F9F05FF03478CBF03414042090A04B37FB379CC26B379CC26" - $"CC20B37FCC200A09B5E9C41B2AC240B8E1BDFBBFA1BDA4C6A7BDFFCA1AC45CC9" - $"7AC607C01CC75BB6F4C65A062AFE9FFF9F69FE7FFEDFCF0FC95FC3D7C95FC51E" - $"C95FC51EC95FC53EC92BC565C94AC55BC92BC565C728C60BC728C60BC712C612" - $"C6E6C600C6F9C60EC6D3C5F2C6C7C5C4C6C7C5DCC6C7C5C4C460C4E5C4BCC4E5" - $"C626C4E5C626C4E5C64BC4A5C670C4CAC66BC4A5C670C1EDC6CFC1EDC6CFC1E9" - $"C6CFC1E2C6D0C1E6C6D0C1D1C6D0C1B2C6BEC1BFC6C9C1A2C6AFC19851C198C6" - $"9BC19851C505C031C507C507C016C507BFFCC507C507BE94C505BE9451BE9451" - $"BE94C69BBE7BC6BEBE8BC6AFBE6DC6C9BE4AC6D0BE5CC6D0BE47C6D0BE40C6CF" - $"BE44C6CFBE40C6CFBB87C670BB87C670BB63C66BBB47C626BB47C64BBB47C626" - $"C4BCB965C460B965C5C4B965C5C4B965C5DCB947C600B95AC5F2B934C60EB904" - $"C60BB91BC612B904C60BB701C565B701C565B6E3C55BB6CEC51EB6CEC53EB6CE" - $"C51EC3D7B590C36CB590C36CB581C3B0B578C43AB578C3F5B578C78FBFF8CA27" - $"BA2ACA22BFF8CA27BFFABFFCCA27BFFCCA27C5CACA22CA7CC43ACA7CC78FCA7C" - $"C3FBCA67C37ECA754ACA67C37E0639F6F97FFEF8E7FFF9F6FFFFFFFFFF03B67D" - $"BDEEC31FB730C35CB730C35CB74EC3662BC3A22BC3822BC3A2C4E8B8D1C55EB8" - $"D1C406B8D1C406B8D1C3F0B8ECC3CDB8DBC3DBB8FDC3BFB929C3BDB913C3B9B9" - $"29C3BDBB9FC436BB9FC436BBC2C43CBBDCC47EBBDCC45BBBDCC47EC5E6BE00C6" - $"31BE00C4BBBE00C4BBBE00C4A7BE16C486BE08C494BE24C479BE4AC471BE37C4" - $"71BE4AC471BE4BC016C473C1E2C471C1E2C471C1F6C471C217C486C209C479C2" - $"25C494C22DC4BBC22DC4A7C22DC4BBC631C451C5E6C451C47EC451C47EC451C4" - $"5BC48DC436C46AC43CC48DC436C704C3BDC704C3BDC719C3B9C741C3CDC730C3" - $"BF53C3DBC75CC406C75CC3F0C75CC406C55EC8CAC4E8C8CAC3A2C8CAC3A2C8CA" - $"C382C8FDC35CC8DFC366C8FDC35CC977C333BDEEC97ABDEEC97ABDEEC9F1BD56" - $"CAC9BC0BCA60BCB6CA3DBB1CC8D9B981C991BA47C82FB9D7C6EDBAA0C789BA38" - $"C69FBA52C5F0B9D0C647BA12C59BB98BC4E0B91FC53BB959C4FBB855C50EB6C0" - $"C509B78FC424B64AC22DB5C4C32AB5FCC1C8B66DC11BB7D9C16BB725C0BCB7C9" - $"BFFCB7C2C05CB7C3BFFCB7C2BFFCB7C2BFFCB7C2BFFBB7C2BFFAB7C2BFFAB7C2" - $"BFF9B7C2BFF8B7C2BFF9B7C2BFF8B7C2BFF8B7C2BFF8B7C2BF98B7C3BED9B7D9" - $"BF38B7C9BE88B725BDC7B5C4BE2CB66DBCCAB5FCBAE6B6C0BBD0B64ABAEBB78F" - $"BB13B91F34B855BAB8B959BA04B9D0BA59B98BB9ADBA12B907BAA0B955BA52B8" - $"6ABA38B71AB981B7C5B9D7B663BA47B52BBC0BB5B7BB1CB594BCB6B679BDEEB6" - $"02BD56B679BDEE0005BD3EC06CBD3EC06CBD3EC197BB2147BC4C47B9F647B904" - $"C06CB904C197B904BF41BB21BE4FB9F6BE4FBC4CBE4FBD3EC06CBD3EBF41BD3E" - $"C06C0005BCBC42BCBC42BCBCC153BB55C1F3BC1BC1F3BA8EC1F3B9ED42B9EDC1" - $"53B9EDBFC6BB55BF25BA8EBF25BC1BBF25BCBC42BCBCBFC6BCBC420007C01BC2" - $"BBC01BC2BBBFBAC2BBBF6CC21CBF6CC274BF6CC21CBF6CC02ABF6CC02ABF6CBF" - $"D3C01BBF8CBFBABF8CC07BBF8CC0C9C02AC0C9BFD3C0C9C02AC0C9C21CC0C9C2" - $"1CC0C9C274C01BC2BBC07BC2BBC01BC2BB0005C2F7C06CC2F7C06CC2F7C197C5" - $"1547C3E947C64047C732C06CC732C197C732BF41C515BE4FC640BE4FC3E9BE4F" - $"C2F7C06CC2F7BF41C2F7C06C0005C37942C37942C379C153C4E1C1F3C41AC1F3" - $"C5A7C1F3C64842C648C153C648BFC6C4E1BF25C5A7BF25C41ABF25C37942C379" - $"BFC6C37942090A0000000A010101000A020102000A020103000A010104000A03" - $"0105000A010106000A010107000A03010800" -}; diff --git a/platform/haiku/godot_haiku.cpp b/platform/haiku/godot_haiku.cpp deleted file mode 100644 index 0657f4c052..0000000000 --- a/platform/haiku/godot_haiku.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************/ -/* godot_haiku.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "main/main.h" -#include "os_haiku.h" - -int main(int argc, char *argv[]) { - OS_Haiku os; - - Error error = Main::setup(argv[0], argc - 1, &argv[1]); - if (error != OK) { - return 255; - } - - if (Main::start()) { - os.run(); - } - - Main::cleanup(); - - return os.get_exit_code(); -} diff --git a/platform/haiku/haiku_application.cpp b/platform/haiku/haiku_application.cpp deleted file mode 100644 index 82d9c093e1..0000000000 --- a/platform/haiku/haiku_application.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/*************************************************************************/ -/* haiku_application.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "haiku_application.h" - -HaikuApplication::HaikuApplication() : - BApplication("application/x-vnd.godot") { -} diff --git a/platform/haiku/haiku_application.h b/platform/haiku/haiku_application.h deleted file mode 100644 index 2e04d921bf..0000000000 --- a/platform/haiku/haiku_application.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************/ -/* haiku_application.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef HAIKU_APPLICATION_H -#define HAIKU_APPLICATION_H - -#include <kernel/image.h> // needed for image_id - -#include <Application.h> - -class HaikuApplication : public BApplication { -public: - HaikuApplication(); -}; - -#endif diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp deleted file mode 100644 index 0a40f847f4..0000000000 --- a/platform/haiku/haiku_direct_window.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/*************************************************************************/ -/* haiku_direct_window.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include <UnicodeChar.h> - -#include "core/os/keyboard.h" -#include "haiku_direct_window.h" -#include "key_mapping_haiku.h" -#include "main/main.h" - -HaikuDirectWindow::HaikuDirectWindow(BRect p_frame) : - BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE) { - last_mouse_pos_valid = false; - last_buttons_state = 0; - last_button_mask = 0; - last_key_modifier_state = 0; - - view = nullptr; - update_runner = nullptr; - input = nullptr; - main_loop = nullptr; -} - -HaikuDirectWindow::~HaikuDirectWindow() { -} - -void HaikuDirectWindow::SetHaikuGLView(HaikuGLView *p_view) { - view = p_view; -} - -void HaikuDirectWindow::StartMessageRunner() { - update_runner = new BMessageRunner(BMessenger(this), - new BMessage(REDRAW_MSG), 1000000 / 60 /* 60 fps */); -} - -void HaikuDirectWindow::StopMessageRunner() { - delete update_runner; -} - -void HaikuDirectWindow::SetInput(InputDefault *p_input) { - input = p_input; -} - -void HaikuDirectWindow::SetMainLoop(MainLoop *p_main_loop) { - main_loop = p_main_loop; -} - -bool HaikuDirectWindow::QuitRequested() { - StopMessageRunner(); - main_loop->notification(NOTIFICATION_WM_CLOSE_REQUEST); - return false; -} - -void HaikuDirectWindow::DirectConnected(direct_buffer_info *info) { - view->DirectConnected(info); - view->EnableDirectMode(true); -} - -void HaikuDirectWindow::MessageReceived(BMessage *message) { - switch (message->what) { - case REDRAW_MSG: - if (Main::iteration()) { - view->EnableDirectMode(false); - Quit(); - } - break; - - default: - BDirectWindow::MessageReceived(message); - } -} - -void HaikuDirectWindow::DispatchMessage(BMessage *message, BHandler *handler) { - switch (message->what) { - case B_MOUSE_DOWN: - case B_MOUSE_UP: - HandleMouseButton(message); - break; - - case B_MOUSE_MOVED: - HandleMouseMoved(message); - break; - - case B_MOUSE_WHEEL_CHANGED: - HandleMouseWheelChanged(message); - break; - - case B_KEY_DOWN: - case B_KEY_UP: - HandleKeyboardEvent(message); - break; - - case B_MODIFIERS_CHANGED: - HandleKeyboardModifierEvent(message); - break; - - case B_WINDOW_RESIZED: - HandleWindowResized(message); - break; - - case LOCKGL_MSG: - view->LockGL(); - break; - - case UNLOCKGL_MSG: - view->UnlockGL(); - break; - - default: - BDirectWindow::DispatchMessage(message, handler); - } -} - -void HaikuDirectWindow::HandleMouseButton(BMessage *message) { - BPoint where; - if (message->FindPoint("where", &where) != B_OK) { - return; - } - - uint32 modifiers = message->FindInt32("modifiers"); - uint32 buttons = message->FindInt32("buttons"); - uint32 button = buttons ^ last_buttons_state; - last_buttons_state = buttons; - - // TODO: implement the mouse_mode checks - /* - if (mouse_mode == MOUSE_MODE_CAPTURED) { - event.xbutton.x=last_mouse_pos.x; - event.xbutton.y=last_mouse_pos.y; - } - */ - - Ref<InputEventMouseButton> mouse_event; - mouse_event.instance(); - - mouse_event->set_button_mask(GetMouseButtonState(buttons)); - mouse_event->set_position({ where.x, where.y }); - mouse_event->set_global_position({ where.x, where.y }); - GetKeyModifierState(mouse_event, modifiers); - - switch (button) { - default: - case B_PRIMARY_MOUSE_BUTTON: - mouse_event->set_button_index(1); - break; - - case B_SECONDARY_MOUSE_BUTTON: - mouse_event->set_button_index(2); - break; - - case B_TERTIARY_MOUSE_BUTTON: - mouse_event->set_button_index(3); - break; - } - - mouse_event->set_pressed(message->what == B_MOUSE_DOWN); - - if (message->what == B_MOUSE_DOWN && mouse_event->get_button_index() == 1) { - int32 clicks = message->FindInt32("clicks"); - - if (clicks > 1) { - mouse_event->set_doubleclick(true); - } - } - - input->parse_input_event(mouse_event); -} - -void HaikuDirectWindow::HandleMouseMoved(BMessage *message) { - BPoint where; - if (message->FindPoint("where", &where) != B_OK) { - return; - } - - Point2i pos(where.x, where.y); - uint32 modifiers = message->FindInt32("modifiers"); - uint32 buttons = message->FindInt32("buttons"); - - if (!last_mouse_pos_valid) { - last_mouse_position = pos; - last_mouse_pos_valid = true; - } - - Point2i rel = pos - last_mouse_position; - - Ref<InputEventMouseMotion> motion_event; - motion_event.instance(); - GetKeyModifierState(motion_event, modifiers); - - motion_event->set_button_mask(GetMouseButtonState(buttons)); - motion_event->set_position({ pos.x, pos.y }); - input->set_mouse_position(pos); - motion_event->set_global_position({ pos.x, pos.y }); - motion_event->set_speed({ input->get_last_mouse_speed().x, - input->get_last_mouse_speed().y }); - - motion_event->set_relative({ rel.x, rel.y }); - - last_mouse_position = pos; - - input->parse_input_event(motion_event); -} - -void HaikuDirectWindow::HandleMouseWheelChanged(BMessage *message) { - float wheel_delta_y = 0; - if (message->FindFloat("be:wheel_delta_y", &wheel_delta_y) != B_OK) { - return; - } - - Ref<InputEventMouseButton> mouse_event; - mouse_event.instance(); - //GetKeyModifierState(mouse_event, modifiers); - - mouse_event->set_button_index(wheel_delta_y < 0 ? 4 : 5); - mouse_event->set_button_mask(last_button_mask); - mouse_event->set_position({ last_mouse_position.x, - last_mouse_position.y }); - mouse_event->set_global_position({ last_mouse_position.x, - last_mouse_position.y }); - - mouse_event->set_pressed(true); - input->parse_input_event(mouse_event); - - mouse_event->set_pressed(false); - input->parse_input_event(mouse_event); -} - -void HaikuDirectWindow::HandleKeyboardEvent(BMessage *message) { - int32 raw_char = 0; - int32 key = 0; - int32 modifiers = 0; - - if (message->FindInt32("raw_char", &raw_char) != B_OK) { - return; - } - - if (message->FindInt32("key", &key) != B_OK) { - return; - } - - if (message->FindInt32("modifiers", &modifiers) != B_OK) { - return; - } - - Ref<InputEventKey> event; - event.instance(); - GetKeyModifierState(event, modifiers); - event->set_pressed(message->what == B_KEY_DOWN); - event->set_keycode(KeyMappingHaiku::get_keysym(raw_char, key)); - event->set_physical_keycode(KeyMappingHaiku::get_keysym(raw_char, key)); - event->set_echo(message->HasInt32("be:key_repeat")); - event->set_unicode(0); - - const char *bytes = nullptr; - if (message->FindString("bytes", &bytes) == B_OK) { - event->set_unicode(BUnicodeChar::FromUTF8(&bytes)); - } - - //make it consistent across platforms. - if (event->get_keycode() == KEY_BACKTAB) { - event->set_keycode(KEY_TAB); - event->set_physical_keycode(KEY_TAB); - event->set_shift(true); - } - - input->parse_input_event(event); -} - -void HaikuDirectWindow::HandleKeyboardModifierEvent(BMessage *message) { - int32 old_modifiers = 0; - int32 modifiers = 0; - - if (message->FindInt32("be:old_modifiers", &old_modifiers) != B_OK) { - return; - } - - if (message->FindInt32("modifiers", &modifiers) != B_OK) { - return; - } - - int32 key = old_modifiers ^ modifiers; - - Ref<InputEventWithModifiers> event; - event.instance(); - GetKeyModifierState(event, modifiers); - - event->set_shift(key & B_SHIFT_KEY); - event->set_alt(key & B_OPTION_KEY); - event->set_control(key & B_CONTROL_KEY); - event->set_command(key & B_COMMAND_KEY); - - input->parse_input_event(event); -} - -void HaikuDirectWindow::HandleWindowResized(BMessage *message) { - int32 width = 0; - int32 height = 0; - - if ((message->FindInt32("width", &width) != B_OK) || (message->FindInt32("height", &height) != B_OK)) { - return; - } - - current_video_mode->width = width; - current_video_mode->height = height; -} - -inline void HaikuDirectWindow::GetKeyModifierState(Ref<InputEventWithModifiers> event, uint32 p_state) { - last_key_modifier_state = p_state; - - event->set_shift(p_state & B_SHIFT_KEY); - event->set_control(p_state & B_CONTROL_KEY); - event->set_alt(p_state & B_OPTION_KEY); - event->set_metakey(p_state & B_COMMAND_KEY); - - return state; -} - -inline int HaikuDirectWindow::GetMouseButtonState(uint32 p_state) { - int state = 0; - - if (p_state & B_PRIMARY_MOUSE_BUTTON) { - state |= 1 << 0; - } - - if (p_state & B_SECONDARY_MOUSE_BUTTON) { - state |= 1 << 1; - } - - if (p_state & B_TERTIARY_MOUSE_BUTTON) { - state |= 1 << 2; - } - - last_button_mask = state; - - return state; -} diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h deleted file mode 100644 index 4817abbb7a..0000000000 --- a/platform/haiku/haiku_direct_window.h +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************/ -/* haiku_direct_window.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef HAIKU_DIRECT_WINDOW_H -#define HAIKU_DIRECT_WINDOW_H - -#include <kernel/image.h> // needed for image_id - -#include <DirectWindow.h> - -#include "core/input/input.h" -#include "core/os/os.h" - -#include "haiku_gl_view.h" - -#define REDRAW_MSG 'rdrw' -#define LOCKGL_MSG 'glck' -#define UNLOCKGL_MSG 'ulck' - -class HaikuDirectWindow : public BDirectWindow { -private: - Point2i last_mouse_position; - bool last_mouse_pos_valid; - uint32 last_buttons_state; - uint32 last_key_modifier_state; - int last_button_mask; - OS::VideoMode *current_video_mode; - - MainLoop *main_loop; - InputDefault *input; - HaikuGLView *view; - BMessageRunner *update_runner; - - void HandleMouseButton(BMessage *message); - void HandleMouseMoved(BMessage *message); - void HandleMouseWheelChanged(BMessage *message); - void HandleWindowResized(BMessage *message); - void HandleKeyboardEvent(BMessage *message); - void HandleKeyboardModifierEvent(BMessage *message); - inline void GetKeyModifierState(Ref<InputEventWithModifiers> event, uint32 p_state); - inline int GetMouseButtonState(uint32 p_state); - -public: - HaikuDirectWindow(BRect p_frame); - ~HaikuDirectWindow(); - - void SetHaikuGLView(HaikuGLView *p_view); - void StartMessageRunner(); - void StopMessageRunner(); - void SetInput(InputDefault *p_input); - void SetMainLoop(MainLoop *p_main_loop); - inline void SetVideoMode(OS::VideoMode *video_mode) { current_video_mode = video_mode; }; - virtual bool QuitRequested(); - virtual void DirectConnected(direct_buffer_info *info); - virtual void MessageReceived(BMessage *message); - virtual void DispatchMessage(BMessage *message, BHandler *handler); - - inline Point2i GetLastMousePosition() { return last_mouse_position; }; - inline int GetLastButtonMask() { return last_button_mask; }; -}; - -#endif diff --git a/platform/haiku/haiku_gl_view.cpp b/platform/haiku/haiku_gl_view.cpp deleted file mode 100644 index 970a1276fd..0000000000 --- a/platform/haiku/haiku_gl_view.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************/ -/* haiku_gl_view.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "haiku_gl_view.h" -#include "main/main.h" - -HaikuGLView::HaikuGLView(BRect frame, uint32 type) : - BGLView(frame, "GodotGLView", B_FOLLOW_ALL_SIDES, 0, type) { -} - -void HaikuGLView::AttachedToWindow(void) { - LockGL(); - BGLView::AttachedToWindow(); - UnlockGL(); - MakeFocus(); -} - -void HaikuGLView::Draw(BRect updateRect) { - Main::force_redraw(); -} diff --git a/platform/haiku/haiku_gl_view.h b/platform/haiku/haiku_gl_view.h deleted file mode 100644 index 59e02d2367..0000000000 --- a/platform/haiku/haiku_gl_view.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************/ -/* haiku_gl_view.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef HAIKU_GL_VIEW_H -#define HAIKU_GL_VIEW_H - -#include <kernel/image.h> // needed for image_id - -#include <GLView.h> - -class HaikuGLView : public BGLView { -public: - HaikuGLView(BRect frame, uint32 type); - virtual void AttachedToWindow(void); - virtual void Draw(BRect updateRect); -}; - -#endif diff --git a/platform/haiku/key_mapping_haiku.cpp b/platform/haiku/key_mapping_haiku.cpp deleted file mode 100644 index 692a1e5a78..0000000000 --- a/platform/haiku/key_mapping_haiku.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/*************************************************************************/ -/* key_mapping_haiku.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include <InterfaceDefs.h> - -#include "core/os/keyboard.h" -#include "key_mapping_haiku.h" - -struct _HaikuTranslatePair { - unsigned int keysym; - int32 keycode; -}; - -static _HaikuTranslatePair _mod_to_keycode[] = { - { KEY_SHIFT, B_SHIFT_KEY }, - { KEY_ALT, B_COMMAND_KEY }, - { KEY_CONTROL, B_CONTROL_KEY }, - { KEY_CAPSLOCK, B_CAPS_LOCK }, - { KEY_SCROLLLOCK, B_SCROLL_LOCK }, - { KEY_NUMLOCK, B_NUM_LOCK }, - { KEY_SUPER_L, B_OPTION_KEY }, - { KEY_MENU, B_MENU_KEY }, - { KEY_SHIFT, B_LEFT_SHIFT_KEY }, - { KEY_SHIFT, B_RIGHT_SHIFT_KEY }, - { KEY_ALT, B_LEFT_COMMAND_KEY }, - { KEY_ALT, B_RIGHT_COMMAND_KEY }, - { KEY_CONTROL, B_LEFT_CONTROL_KEY }, - { KEY_CONTROL, B_RIGHT_CONTROL_KEY }, - { KEY_SUPER_L, B_LEFT_OPTION_KEY }, - { KEY_SUPER_R, B_RIGHT_OPTION_KEY }, - { KEY_UNKNOWN, 0 } -}; - -static _HaikuTranslatePair _fn_to_keycode[] = { - { KEY_F1, B_F1_KEY }, - { KEY_F2, B_F2_KEY }, - { KEY_F3, B_F3_KEY }, - { KEY_F4, B_F4_KEY }, - { KEY_F5, B_F5_KEY }, - { KEY_F6, B_F6_KEY }, - { KEY_F7, B_F7_KEY }, - { KEY_F8, B_F8_KEY }, - { KEY_F9, B_F9_KEY }, - { KEY_F10, B_F10_KEY }, - { KEY_F11, B_F11_KEY }, - { KEY_F12, B_F12_KEY }, - //{ KEY_F13, ? }, - //{ KEY_F14, ? }, - //{ KEY_F15, ? }, - //{ KEY_F16, ? }, - { KEY_PRINT, B_PRINT_KEY }, - { KEY_SCROLLLOCK, B_SCROLL_KEY }, - { KEY_PAUSE, B_PAUSE_KEY }, - { KEY_UNKNOWN, 0 } -}; - -static _HaikuTranslatePair _hb_to_keycode[] = { - { KEY_BACKSPACE, B_BACKSPACE }, - { KEY_TAB, B_TAB }, - { KEY_ENTER, B_RETURN }, - { KEY_CAPSLOCK, B_CAPS_LOCK }, - { KEY_ESCAPE, B_ESCAPE }, - { KEY_SPACE, B_SPACE }, - { KEY_PAGEUP, B_PAGE_UP }, - { KEY_PAGEDOWN, B_PAGE_DOWN }, - { KEY_END, B_END }, - { KEY_HOME, B_HOME }, - { KEY_LEFT, B_LEFT_ARROW }, - { KEY_UP, B_UP_ARROW }, - { KEY_RIGHT, B_RIGHT_ARROW }, - { KEY_DOWN, B_DOWN_ARROW }, - { KEY_PRINT, B_PRINT_KEY }, - { KEY_INSERT, B_INSERT }, - { KEY_DELETE, B_DELETE }, - // { KEY_HELP, ??? }, - - { KEY_0, (0x30) }, - { KEY_1, (0x31) }, - { KEY_2, (0x32) }, - { KEY_3, (0x33) }, - { KEY_4, (0x34) }, - { KEY_5, (0x35) }, - { KEY_6, (0x36) }, - { KEY_7, (0x37) }, - { KEY_8, (0x38) }, - { KEY_9, (0x39) }, - { KEY_A, (0x61) }, - { KEY_B, (0x62) }, - { KEY_C, (0x63) }, - { KEY_D, (0x64) }, - { KEY_E, (0x65) }, - { KEY_F, (0x66) }, - { KEY_G, (0x67) }, - { KEY_H, (0x68) }, - { KEY_I, (0x69) }, - { KEY_J, (0x6A) }, - { KEY_K, (0x6B) }, - { KEY_L, (0x6C) }, - { KEY_M, (0x6D) }, - { KEY_N, (0x6E) }, - { KEY_O, (0x6F) }, - { KEY_P, (0x70) }, - { KEY_Q, (0x71) }, - { KEY_R, (0x72) }, - { KEY_S, (0x73) }, - { KEY_T, (0x74) }, - { KEY_U, (0x75) }, - { KEY_V, (0x76) }, - { KEY_W, (0x77) }, - { KEY_X, (0x78) }, - { KEY_Y, (0x79) }, - { KEY_Z, (0x7A) }, - - /* -{ KEY_PLAY, VK_PLAY},// (0xFA) -{ KEY_STANDBY,VK_SLEEP },//(0x5F) -{ KEY_BACK,VK_BROWSER_BACK},// (0xA6) -{ KEY_FORWARD,VK_BROWSER_FORWARD},// (0xA7) -{ KEY_REFRESH,VK_BROWSER_REFRESH},// (0xA8) -{ KEY_STOP,VK_BROWSER_STOP},// (0xA9) -{ KEY_SEARCH,VK_BROWSER_SEARCH},// (0xAA) -{ KEY_FAVORITES, VK_BROWSER_FAVORITES},// (0xAB) -{ KEY_HOMEPAGE,VK_BROWSER_HOME},// (0xAC) -{ KEY_VOLUMEMUTE,VK_VOLUME_MUTE},// (0xAD) -{ KEY_VOLUMEDOWN,VK_VOLUME_DOWN},// (0xAE) -{ KEY_VOLUMEUP,VK_VOLUME_UP},// (0xAF) -{ KEY_MEDIANEXT,VK_MEDIA_NEXT_TRACK},// (0xB0) -{ KEY_MEDIAPREVIOUS,VK_MEDIA_PREV_TRACK},// (0xB1) -{ KEY_MEDIASTOP,VK_MEDIA_STOP},// (0xB2) -{ KEY_LAUNCHMAIL, VK_LAUNCH_MAIL},// (0xB4) -{ KEY_LAUNCHMEDIA,VK_LAUNCH_MEDIA_SELECT},// (0xB5) -{ KEY_LAUNCH0,VK_LAUNCH_APP1},// (0xB6) -{ KEY_LAUNCH1,VK_LAUNCH_APP2},// (0xB7) -*/ - - { KEY_SEMICOLON, 0x3B }, - { KEY_EQUAL, 0x3D }, - { KEY_COLON, 0x2C }, - { KEY_MINUS, 0x2D }, - { KEY_PERIOD, 0x2E }, - { KEY_SLASH, 0x2F }, - { KEY_KP_MULTIPLY, 0x2A }, - { KEY_KP_ADD, 0x2B }, - - { KEY_QUOTELEFT, 0x60 }, - { KEY_BRACKETLEFT, 0x5B }, - { KEY_BACKSLASH, 0x5C }, - { KEY_BRACKETRIGHT, 0x5D }, - { KEY_APOSTROPHE, 0x27 }, - - { KEY_UNKNOWN, 0 } -}; - -unsigned int KeyMappingHaiku::get_keysym(int32 raw_char, int32 key) { - if (raw_char == B_INSERT && key == 0x64) { - return KEY_KP_0; - } - if (raw_char == B_END && key == 0x58) { - return KEY_KP_1; - } - if (raw_char == B_DOWN_ARROW && key == 0x59) { - return KEY_KP_2; - } - if (raw_char == B_PAGE_DOWN && key == 0x5A) { - return KEY_KP_3; - } - if (raw_char == B_LEFT_ARROW && key == 0x48) { - return KEY_KP_4; - } - if (raw_char == 0x35 && key == 0x49) { - return KEY_KP_5; - } - if (raw_char == B_RIGHT_ARROW && key == 0x4A) { - return KEY_KP_6; - } - if (raw_char == B_HOME && key == 0x37) { - return KEY_KP_7; - } - if (raw_char == B_UP_ARROW && key == 0x38) { - return KEY_KP_8; - } - if (raw_char == B_PAGE_UP && key == 0x39) { - return KEY_KP_9; - } - if (raw_char == 0x2F && key == 0x23) { - return KEY_KP_DIVIDE; - } - if (raw_char == 0x2D && key == 0x25) { - return KEY_KP_SUBTRACT; - } - if (raw_char == B_DELETE && key == 0x65) { - return KEY_KP_PERIOD; - } - - if (raw_char == 0x10) { - for (int i = 0; _fn_to_keycode[i].keysym != KEY_UNKNOWN; i++) { - if (_fn_to_keycode[i].keycode == key) { - return _fn_to_keycode[i].keysym; - } - } - - return KEY_UNKNOWN; - } - - for (int i = 0; _hb_to_keycode[i].keysym != KEY_UNKNOWN; i++) { - if (_hb_to_keycode[i].keycode == raw_char) { - return _hb_to_keycode[i].keysym; - } - } - - return KEY_UNKNOWN; -} - -unsigned int KeyMappingHaiku::get_modifier_keysym(int32 key) { - for (int i = 0; _mod_to_keycode[i].keysym != KEY_UNKNOWN; i++) { - if ((_mod_to_keycode[i].keycode & key) != 0) { - return _mod_to_keycode[i].keysym; - } - } - - return KEY_UNKNOWN; -} diff --git a/platform/haiku/key_mapping_haiku.h b/platform/haiku/key_mapping_haiku.h deleted file mode 100644 index e735108e44..0000000000 --- a/platform/haiku/key_mapping_haiku.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************/ -/* key_mapping_haiku.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef KEY_MAPPING_HAIKU_H -#define KEY_MAPPING_HAIKU_H - -class KeyMappingHaiku { - KeyMappingHaiku() {} - -public: - static unsigned int get_keysym(int32 raw_char, int32 key); - static unsigned int get_modifier_keysym(int32 key); -}; - -#endif diff --git a/platform/haiku/logo.png b/platform/haiku/logo.png Binary files differdeleted file mode 100644 index a2d8e242a6..0000000000 --- a/platform/haiku/logo.png +++ /dev/null diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp deleted file mode 100644 index 7a2591784f..0000000000 --- a/platform/haiku/os_haiku.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/*************************************************************************/ -/* os_haiku.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "os_haiku.h" - -#include "drivers/gles2/rasterizer_gles2.h" -#include "main/main.h" -#include "servers/physics_3d/physics_server_3d_sw.h" -#include "servers/rendering/rendering_server_raster.h" -#include "servers/rendering/rendering_server_wrap_mt.h" - -#include <Screen.h> - -OS_Haiku::OS_Haiku() { -#ifdef MEDIA_KIT_ENABLED - AudioDriverManager::add_driver(&driver_media_kit); -#endif -}; - -void OS_Haiku::run() { - if (!main_loop) { - return; - } - - main_loop->init(); - context_gl->release_current(); - - // TODO: clean up - BMessenger *bms = new BMessenger(window); - BMessage *msg = new BMessage(); - bms->SendMessage(LOCKGL_MSG, msg); - - window->StartMessageRunner(); - app->Run(); - window->StopMessageRunner(); - - delete app; - - delete bms; - delete msg; - main_loop->finish(); -} - -String OS_Haiku::get_name() const { - return "Haiku"; -} - -int OS_Haiku::get_video_driver_count() const { - return 1; -} - -const char *OS_Haiku::get_video_driver_name(int p_driver) const { - return "GLES2"; -} - -int OS_Haiku::get_current_video_driver() const { - return video_driver_index; -} - -Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { - main_loop = nullptr; - current_video_mode = p_desired; - - app = new HaikuApplication(); - - BRect frame; - frame.Set(50, 50, 50 + current_video_mode.width - 1, 50 + current_video_mode.height - 1); - - window = new HaikuDirectWindow(frame); - window->SetVideoMode(¤t_video_mode); - - if (current_video_mode.fullscreen) { - window->SetFullScreen(true); - } - - if (!current_video_mode.resizable) { - uint32 flags = window->Flags(); - flags |= B_NOT_RESIZABLE; - window->SetFlags(flags); - } - -#if defined(OPENGL_ENABLED) - context_gl = memnew(ContextGL_Haiku(window)); - context_gl->initialize(); - context_gl->make_current(); - context_gl->set_use_vsync(current_video_mode.use_vsync); - // FIXME: That's not how the rasterizer setup should happen. - RasterizerGLES2::register_config(); - RasterizerGLES2::make_current(); -#endif - - rendering_server = memnew(RenderingServerRaster); - // FIXME: Reimplement threaded rendering - if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) { - rendering_server = memnew(RenderingServerWrapMT(rendering_server, false)); - } - - ERR_FAIL_COND_V(!rendering_server, ERR_UNAVAILABLE); - - video_driver_index = p_video_driver; - - input = memnew(InputDefault); - window->SetInput(input); - - window->Show(); - rendering_server->init(); - - AudioDriverManager::initialize(p_audio_driver); - - return OK; -} - -void OS_Haiku::finalize() { - if (main_loop) { - memdelete(main_loop); - } - - main_loop = nullptr; - - rendering_server->finish(); - memdelete(rendering_server); - - memdelete(input); - -#if defined(OPENGL_ENABLED) - memdelete(context_gl); -#endif -} - -void OS_Haiku::set_main_loop(MainLoop *p_main_loop) { - main_loop = p_main_loop; - input->set_main_loop(p_main_loop); - window->SetMainLoop(p_main_loop); -} - -MainLoop *OS_Haiku::get_main_loop() const { - return main_loop; -} - -void OS_Haiku::delete_main_loop() { - if (main_loop) { - memdelete(main_loop); - } - - main_loop = nullptr; - window->SetMainLoop(nullptr); -} - -void OS_Haiku::release_rendering_thread() { - context_gl->release_current(); -} - -void OS_Haiku::make_rendering_thread() { - context_gl->make_current(); -} - -bool OS_Haiku::can_draw() const { - // TODO: implement - return true; -} - -void OS_Haiku::swap_buffers() { - context_gl->swap_buffers(); -} - -Point2 OS_Haiku::get_mouse_position() const { - return window->GetLastMousePosition(); -} - -int OS_Haiku::get_mouse_button_state() const { - return window->GetLastButtonMask(); -} - -void OS_Haiku::set_cursor_shape(CursorShape p_shape) { - //ERR_PRINT("set_cursor_shape() NOT IMPLEMENTED"); -} - -OS::CursorShape OS_Haiku::get_cursor_shape() const { - // TODO: implement get_cursor_shape -} - -void OS_Haiku::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) { - // TODO -} - -int OS_Haiku::get_screen_count() const { - // TODO: implement get_screen_count() - return 1; -} - -int OS_Haiku::get_current_screen() const { - // TODO: implement get_current_screen() - return 0; -} - -void OS_Haiku::set_current_screen(int p_screen) { - // TODO: implement set_current_screen() -} - -Point2 OS_Haiku::get_screen_position(int p_screen) const { - // TODO: make this work with the p_screen parameter - BScreen *screen = new BScreen(window); - BRect frame = screen->Frame(); - delete screen; - return Point2i(frame.left, frame.top); -} - -Size2 OS_Haiku::get_screen_size(int p_screen) const { - // TODO: make this work with the p_screen parameter - BScreen *screen = new BScreen(window); - BRect frame = screen->Frame(); - delete screen; - return Size2i(frame.IntegerWidth() + 1, frame.IntegerHeight() + 1); -} - -void OS_Haiku::set_window_title(const String &p_title) { - window->SetTitle(p_title.utf8().get_data()); -} - -Size2 OS_Haiku::get_window_size() const { - BSize size = window->Size(); - return Size2i(size.IntegerWidth() + 1, size.IntegerHeight() + 1); -} - -void OS_Haiku::set_window_size(const Size2 p_size) { - // TODO: why does it stop redrawing after this is called? - window->ResizeTo(p_size.x, p_size.y); -} - -Point2 OS_Haiku::get_window_position() const { - BPoint point(0, 0); - window->ConvertToScreen(&point); - return Point2i(point.x, point.y); -} - -void OS_Haiku::set_window_position(const Point2 &p_position) { - window->MoveTo(p_position.x, p_position.y); -} - -void OS_Haiku::set_window_fullscreen(bool p_enabled) { - window->SetFullScreen(p_enabled); - current_video_mode.fullscreen = p_enabled; - rendering_server->init(); -} - -bool OS_Haiku::is_window_fullscreen() const { - return current_video_mode.fullscreen; -} - -void OS_Haiku::set_window_resizable(bool p_enabled) { - uint32 flags = window->Flags(); - - if (p_enabled) { - flags &= ~(B_NOT_RESIZABLE); - } else { - flags |= B_NOT_RESIZABLE; - } - - window->SetFlags(flags); - current_video_mode.resizable = p_enabled; -} - -bool OS_Haiku::is_window_resizable() const { - return current_video_mode.resizable; -} - -void OS_Haiku::set_window_minimized(bool p_enabled) { - window->Minimize(p_enabled); -} - -bool OS_Haiku::is_window_minimized() const { - return window->IsMinimized(); -} - -void OS_Haiku::set_window_maximized(bool p_enabled) { - window->Minimize(!p_enabled); -} - -bool OS_Haiku::is_window_maximized() const { - return !window->IsMinimized(); -} - -void OS_Haiku::set_video_mode(const VideoMode &p_video_mode, int p_screen) { - ERR_PRINT("set_video_mode() NOT IMPLEMENTED"); -} - -OS::VideoMode OS_Haiku::get_video_mode(int p_screen) const { - return current_video_mode; -} - -void OS_Haiku::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const { - ERR_PRINT("get_fullscreen_mode_list() NOT IMPLEMENTED"); -} - -String OS_Haiku::get_executable_path() const { - return OS::get_executable_path(); -} - -bool OS_Haiku::_check_internal_feature_support(const String &p_feature) { - return p_feature == "pc"; -} - -String OS_Haiku::get_config_path() const { - if (has_environment("XDG_CONFIG_HOME")) { - return get_environment("XDG_CONFIG_HOME"); - } else if (has_environment("HOME")) { - return get_environment("HOME").plus_file("config/settings"); - } else { - return "."; - } -} - -String OS_Haiku::get_data_path() const { - if (has_environment("XDG_DATA_HOME")) { - return get_environment("XDG_DATA_HOME"); - } else if (has_environment("HOME")) { - return get_environment("HOME").plus_file("config/data"); - } else { - return get_config_path(); - } -} - -String OS_Haiku::get_cache_path() const { - if (has_environment("XDG_CACHE_HOME")) { - return get_environment("XDG_CACHE_HOME"); - } else if (has_environment("HOME")) { - return get_environment("HOME").plus_file("config/cache"); - } else { - return get_config_path(); - } -} diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h deleted file mode 100644 index d3ef9400d4..0000000000 --- a/platform/haiku/os_haiku.h +++ /dev/null @@ -1,123 +0,0 @@ -/*************************************************************************/ -/* os_haiku.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef OS_HAIKU_H -#define OS_HAIKU_H - -#include "audio_driver_media_kit.h" -#include "context_gl_haiku.h" -#include "core/input/input.h" -#include "drivers/unix/os_unix.h" -#include "haiku_application.h" -#include "haiku_direct_window.h" -#include "servers/audio_server.h" -#include "servers/rendering_server.h" - -class OS_Haiku : public OS_Unix { -private: - HaikuApplication *app; - HaikuDirectWindow *window; - MainLoop *main_loop; - InputDefault *input; - RenderingServer *rendering_server; - VideoMode current_video_mode; - int video_driver_index; - -#ifdef MEDIA_KIT_ENABLED - AudioDriverMediaKit driver_media_kit; -#endif - -#if defined(OPENGL_ENABLED) - ContextGL_Haiku *context_gl; -#endif - - virtual void delete_main_loop(); - -protected: - virtual int get_video_driver_count() const; - virtual const char *get_video_driver_name(int p_driver) const; - virtual int get_current_video_driver() const; - - virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver); - virtual void finalize(); - - virtual void set_main_loop(MainLoop *p_main_loop); - -public: - OS_Haiku(); - void run(); - - virtual String get_name() const; - - virtual MainLoop *get_main_loop() const; - - virtual bool can_draw() const; - virtual void release_rendering_thread(); - virtual void make_rendering_thread(); - virtual void swap_buffers(); - - virtual Point2 get_mouse_position() const; - virtual int get_mouse_button_state() const; - virtual void set_cursor_shape(CursorShape p_shape); - virtual CursorShape get_cursor_shape() const; - virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot); - - virtual int get_screen_count() const; - virtual int get_current_screen() const; - virtual void set_current_screen(int p_screen); - virtual Point2 get_screen_position(int p_screen = -1) const; - virtual Size2 get_screen_size(int p_screen = -1) const; - virtual void set_window_title(const String &p_title); - virtual Size2 get_window_size() const; - virtual void set_window_size(const Size2 p_size); - virtual Point2 get_window_position() const; - virtual void set_window_position(const Point2 &p_position); - virtual void set_window_fullscreen(bool p_enabled); - virtual bool is_window_fullscreen() const; - virtual void set_window_resizable(bool p_enabled); - virtual bool is_window_resizable() const; - virtual void set_window_minimized(bool p_enabled); - virtual bool is_window_minimized() const; - virtual void set_window_maximized(bool p_enabled); - virtual bool is_window_maximized() const; - - virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0); - virtual VideoMode get_video_mode(int p_screen = 0) const; - virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const; - virtual String get_executable_path() const; - - virtual bool _check_internal_feature_support(const String &p_feature); - - virtual String get_config_path() const; - virtual String get_data_path() const; - virtual String get_cache_path() const; -}; - -#endif diff --git a/platform/haiku/platform_config.h b/platform/haiku/platform_config.h deleted file mode 100644 index f2d5418adf..0000000000 --- a/platform/haiku/platform_config.h +++ /dev/null @@ -1,36 +0,0 @@ -/*************************************************************************/ -/* platform_config.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include <alloca.h> - -// for ifaddrs.h needed in drivers/unix/ip_unix.cpp -#define _BSD_SOURCE 1 - -#define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h" diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 8905950020..9af7c02351 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -829,7 +829,10 @@ void EditorExportPlatformOSX::_zip_folder_recursive(zipFile &p_zip, const String zipfi.tmz_date.tm_sec = time.sec; zipfi.tmz_date.tm_year = date.year; zipfi.dosDate = 0; - zipfi.external_fa = (is_executable ? 0755 : 0644) << 16L; + // 0100000: regular file type + // 0000755: permissions rwxr-xr-x + // 0000644: permissions rw-r--r-- + zipfi.external_fa = (is_executable ? 0100755 : 0100644) << 16L; zipfi.internal_fa = 0; zipOpenNewFileInZip4(p_zip, diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp index 271a4e41bc..81d0a766cb 100644 --- a/platform/windows/joypad_windows.cpp +++ b/platform/windows/joypad_windows.cpp @@ -172,6 +172,7 @@ bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE *instance) { sprintf_s(uid, "%04x%04x%04x%04x%04x%04x%04x%04x", type, 0, vendor, 0, product, 0, version, 0); id_to_change = joypad_count; + slider_count = 0; joy->di_joy->SetDataFormat(&c_dfDIJoystick2); joy->di_joy->SetCooperativeLevel(*hWnd, DISCL_FOREGROUND); @@ -206,9 +207,12 @@ void JoypadWindows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_ ofs = DIJOFS_RY; else if (ob->guidType == GUID_RzAxis) ofs = DIJOFS_RZ; - else if (ob->guidType == GUID_Slider) - ofs = DIJOFS_SLIDER(0); - else + else if (ob->guidType == GUID_Slider) { + if (slider_count < 2) { + ofs = DIJOFS_SLIDER(slider_count); + slider_count++; + } + } else return; prop_range.diph.dwSize = sizeof(DIPROPRANGE); prop_range.diph.dwHeaderSize = sizeof(DIPROPHEADER); @@ -388,9 +392,9 @@ void JoypadWindows::process_joypads() { } // on mingw, these constants are not constants - int count = 6; - unsigned int axes[] = { DIJOFS_X, DIJOFS_Y, DIJOFS_Z, DIJOFS_RX, DIJOFS_RY, DIJOFS_RZ }; - int values[] = { js.lX, js.lY, js.lZ, js.lRx, js.lRy, js.lRz }; + int count = 8; + unsigned int axes[] = { DIJOFS_X, DIJOFS_Y, DIJOFS_Z, DIJOFS_RX, DIJOFS_RY, DIJOFS_RZ, DIJOFS_SLIDER(0), DIJOFS_SLIDER(1) }; + int values[] = { js.lX, js.lY, js.lZ, js.lRx, js.lRy, js.lRz, js.rglSlider[0], js.rglSlider[1] }; for (int j = 0; j < joy->joy_axis.size(); j++) { for (int k = 0; k < count; k++) { diff --git a/platform/windows/joypad_windows.h b/platform/windows/joypad_windows.h index 6c06b3f6f0..c961abf0a5 100644 --- a/platform/windows/joypad_windows.h +++ b/platform/windows/joypad_windows.h @@ -118,6 +118,7 @@ private: Input *input; int id_to_change; + int slider_count; int joypad_count; bool attached_joypads[JOYPADS_MAX]; dinput_gamepad d_joypads[JOYPADS_MAX]; diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 8dc5cd4aba..7ffca4bd9e 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -754,9 +754,9 @@ void ClippedCamera3D::_notification(int p_what) { xf.origin = ray_from; xf.orthonormalize(); - float csafe, cunsafe; - if (dspace->cast_motion(pyramid_shape, xf, cam_pos - ray_from, margin, csafe, cunsafe, exclude, collision_mask, clip_to_bodies, clip_to_areas)) { - clip_offset = cam_pos.distance_to(ray_from + (cam_pos - ray_from) * csafe); + float closest_safe = 1.0f, closest_unsafe = 1.0f; + if (dspace->cast_motion(pyramid_shape, xf, cam_pos - ray_from, margin, closest_safe, closest_unsafe, exclude, collision_mask, clip_to_bodies, clip_to_areas)) { + clip_offset = cam_pos.distance_to(ray_from + (cam_pos - ray_from) * closest_safe); } _update_camera(); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index e050b3f174..c7fc8dbe43 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -366,26 +366,9 @@ void TextEdit::_update_scrollbars() { total_width += cache.minimap_width; } - bool use_hscroll = true; - bool use_vscroll = true; - - // Thanks yessopie for this clever bit of logic. - if (total_rows <= visible_rows && total_width <= visible_width) { - use_hscroll = false; - use_vscroll = false; - } else { - if (total_rows > visible_rows && total_width <= visible_width) { - use_hscroll = false; - } - - if (total_rows <= visible_rows && total_width > visible_width) { - use_vscroll = false; - } - } - updating_scrolls = true; - if (use_vscroll) { + if (total_rows > visible_rows) { v_scroll->show(); v_scroll->set_max(total_rows + get_visible_rows_offset()); v_scroll->set_page(visible_rows + get_visible_rows_offset()); @@ -403,7 +386,7 @@ void TextEdit::_update_scrollbars() { v_scroll->hide(); } - if (use_hscroll && !is_wrap_enabled()) { + if (total_width > visible_width && !is_wrap_enabled()) { h_scroll->show(); h_scroll->set_max(total_width); h_scroll->set_page(visible_width); @@ -2274,14 +2257,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) { if (mb->get_shift()) { h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor())); - } else { + } else if (v_scroll->is_visible()) { _scroll_up(3 * mb->get_factor()); } } if (mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) { if (mb->get_shift()) { h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor())); - } else { + } else if (v_scroll->is_visible()) { _scroll_down(3 * mb->get_factor()); } } diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index 2dd8ea3edb..9668358710 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -295,7 +295,7 @@ Array PhysicsDirectSpaceState3D::_intersect_shape(const Ref<PhysicsShapeQueryPar Array PhysicsDirectSpaceState3D::_cast_motion(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, const Vector3 &p_motion) { ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array()); - float closest_safe, closest_unsafe; + float closest_safe = 1.0f, closest_unsafe = 1.0f; bool res = cast_motion(p_shape_query->shape, p_shape_query->transform, p_motion, p_shape_query->margin, closest_safe, closest_unsafe, p_shape_query->exclude, p_shape_query->collision_mask, p_shape_query->collide_with_bodies, p_shape_query->collide_with_areas); if (!res) { return Array(); |