Compare commits

28 Commits

Author SHA1 Message Date
Rémi Verschelde
0097a4f49c Add README and Godot license text
(cherry picked from commit a5ae9d9b6b)
2020-06-20 17:56:54 +02:00
Rémi Verschelde
df6fd145a4 Image: Include S3TC compression via Squish in non-tools build
We already build Squish in templates build for S3TC decompression,
so we can as well expose the compression feature.

Fixes #25640.
2020-01-13 15:58:49 +01:00
Rémi Verschelde
2e98068c7d Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
bruvzg
68ea8aaa10 iOS modular build and export implementation. 2019-12-01 21:57:18 +02:00
Fabio Alessandrelli
4f8866df84 Remove libwebsocket. No longer used, yay! 2019-07-04 15:03:04 +02:00
Rémi Verschelde
289fa4347e SCons: Use CPPDEFINES instead of CPPFLAGS for pre-processor defines
It's the recommended way to set those, and is more portable
(automatically prepends -D for GCC/Clang and /D for MSVC).

We still use CPPFLAGS for some pre-processor flags which are not
defines.
2019-07-03 09:59:04 +02:00
Ibrahn Sahir
7ec9c75f82 Png driver reworked to use libpng 1.6 simplified API
Wrapped libpng usage in a pair of functions under PNGDriverCommon,
which convert between Godot Image and png data.
Switched to libpng 1.6 simplified API for ease of maintenance.
Implemented ImageLoaderPNG and ResourceSaverPNG in terms of
PNGDriverCommon functions.
Travis, switched to builtin libpng (thus builtin freetype and zlib also)
so we can build on Xenial.
2019-06-19 11:05:58 +01:00
BastiaanOlij
2511f40e25 Adding a new Camera Server implementation to Godot.
This is a new singleton where camera sources such as webcams or cameras on a mobile phone can register themselves with the Server.
Other parts of Godot can interact with this to obtain images from the camera as textures.
This work includes additions to the Visual Server to use this functionality to present the camera image in the background. This is specifically targetted at AR applications.
2019-06-15 21:30:32 +10:00
hbina085
d53c20c5f4 added a const keyword for a methods that return constant literal... 2019-05-21 02:16:30 -04:00
Rémi Verschelde
02705ef2cb SCons: Always use env.Prepend for CPPPATH
Include paths are processed from left to right, so we use Prepend to
ensure that paths to bundled thirdparty files will have precedence over
system paths (e.g. `/usr/include` should have lowest priority).
2019-04-30 13:12:06 +02:00
Rémi Verschelde
fc6c5bd709 SCons: Review uses of CCFLAGS, CXXFLAGS and CPPFLAGS
Many contributors (me included) did not fully understand what CCFLAGS,
CXXFLAGS and CPPFLAGS refer to exactly, and were thus not using them
in the way they are intended to be.

As per the SCons manual: https://www.scons.org/doc/HTML/scons-user/apa.html

- CCFLAGS: General options that are passed to the C and C++ compilers.
- CFLAGS: General options that are passed to the C compiler (C only;
  not C++).
- CXXFLAGS: General options that are passed to the C++ compiler. By
  default, this includes the value of $CCFLAGS, so that setting
  $CCFLAGS affects both C and C++ compilation.
- CPPFLAGS: User-specified C preprocessor options. These will be
  included in any command that uses the C preprocessor, including not
  just compilation of C and C++ source files [...], but also [...]
  Fortran [...] and [...] assembly language source file[s].

TL;DR: Compiler options go to CCFLAGS, unless they must be restricted
to either C (CFLAGS) or C++ (CXXFLAGS). Preprocessor defines go to
CPPFLAGS.
2019-04-24 16:57:58 +02:00
Guilherme Felipe
3b0d863ac7 Add Input::get_current_cursor_shape
[Clean up] Removed unused/unnecessary methods.
2019-04-15 15:22:09 -03:00
Sebastian Hartte
7dd7757708 Remove ContextGL since as an abstraction it's unused. 2019-04-06 17:52:52 +02:00
Rémi Verschelde
4e32ea9f05 Use mix rate and output latency constants in audio drivers
Fix default mix rate in Xaudio2 and potential shadowing issue in JAndroid.
2019-04-06 12:37:25 +02:00
Juan Linietsky
da2523458e -Remove harcoded opengl extension testing from OS, ask rasterizer instead.
-Fixed a bug where etc textures were imported broken
2019-02-26 11:58:47 -03:00
Hein-Pieter van Braam
c89b26f883 Don't use -ffast-math or other unsafe math optimizations
Godot supports many different compilers and for production releases we
have to support 3 currently: GCC8, Clang6, and MSVC2017. These compilers
all do slightly different things with -ffast-math and it is causing
issues now. See #24841, #24540, #10758, #10070. And probably other
complaints about physics differences between release and release_debug
builds.

I've done some performance comparisons on Linux x86_64. All tests are
ran 20 times.

Bunnymark: (higher is better)
(bunnies)    min    max  stdev average
fast-math   7332   7597    71     7432
this pr     7379   7779   108     7621 (102%)

FPBench (gdscript port http://fpbench.org/) (lower is better)
(ms)
fast-math  15441  16127   192    15764
this pr    15671  16855   326    16001  (99%)

Float_add (adding floats in a tight loop) (lower is better)
(sec)
fast-math   5.49   5.78  0.07     5.65
this pr     5.65   5.90  0.06     5.76  (98%)

Float_div (dividing floats in a tight loop) (lower is better)
(sec)
fast-math  11.70  12.36  0.18    11.99
this pr    11.92  12.32  0.12    12.12  (99%)

Float_mul (multiplying floats in a tight loop) (lower is better)
(sec)
fast-math  11.72  12.17  0.12    11.93
this pr    12.01  12.62  0.17    12.26  (97%)

I have also looked at FPS numbers for tps-demo, 3d platformer, 2d
platformer, and sponza and could not find any measurable difference.

I believe that given the issues and oft-reported (physics) glitches on
release builds I believe that the couple of percent of tight-loop
floating point performance regression is well worth it.

This fixes #24540 and fixes #24841
2019-01-09 02:06:13 +01:00
Rémi Verschelde
390903b16d Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde
84bf66df19 Fix init of VisualServerRaster
Contrarily to what #23434 assumed, this is not a memory leak,
the VisualServerRaster instance is passed as a parameter to
VisualServerWrapMT's constructor.

Fixes #23437.
2018-11-01 19:23:12 +01:00
George Marques
a8bf18945d Fix initialization of visual server in all platforms
Avoid leaking an extra instance when using threads. Also fix threaded
loading issues on Android and iOS.
2018-11-01 10:27:04 -03:00
Aaron Franke
0cbdd5a965 Remove redundant "== true" code
If it can be compared to a boolean, it can be evaluated as one in-place.
2018-10-06 16:12:36 -04:00
Rémi Verschelde
ba121dfdcc Fix warnings on virtual methods [-Woverloaded-virtual] [-Wdelete-non-virtual-dtor]
Fixes the following Clang 7 warnings:
```
editor/editor_help.h:123:7: warning: 'EditorHelpIndex::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/editor_help.h:95:7: warning: 'EditorHelpSearch::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/editor_help.h:96:7: warning: 'EditorHelpSearch::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/plugins/curve_editor_plugin.h:141:15: warning: 'CurvePreviewGenerator::generate' hides overloaded virtual function [-Woverloaded-virtual]
editor/plugins/script_editor_plugin.h:70:7: warning: 'ScriptEditorQuickOpen::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/quick_open.h:69:7: warning: 'EditorQuickOpen::popup' hides overloaded virtual function [-Woverloaded-virtual]
main/tests/test_io.cpp:53:15: warning: 'TestIO::TestMainLoop::input_event' hides overloaded virtual function [-Woverloaded-virtual]
servers/audio/effects/audio_effect_record.h:69:15: warning: 'AudioEffectRecordInstance::process_silence' hides overloaded virtual function [-Woverloaded-virtual]

core/os/memory.h:119:2: warning: destructor called on non-final 'ContextGL_X11' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'EditorScriptCodeCompletionCache' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'Engine' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'PhysicalBone::JointData' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'VisualServerScene' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'VisualServerViewport' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
```
2018-10-02 13:40:17 +02:00
Rémi Verschelde
b52e4fd2c7 SCons: Remove avoidable defines from main env's CPPPATH
Also finally move freetype to its own env and disable warnings for it.
Still needs some work to fix the awkward situation of the freetype and
svg modules used in scene/ and editor/ respectively.
2018-10-01 11:59:22 +02:00
Rémi Verschelde
4ba037a9c2 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Adrien Destugues
6624b186ba Rebase patches for fixing haiku build. 2018-08-11 17:20:51 +02:00
Rémi Verschelde
748ff3d520 Fix some more build issues after c69de2ba4
Fixes #20301.
2018-07-20 11:56:18 +02:00
Juan Linietsky
e0d6362e5c -Project/Editor settings now use new inspector
-Project/Editor settings now show tooltips properly
-Settings thar require restart now will show a restart warning
-Video driver is now visible all the time, can be changed easily
-Added function to request current video driver
2018-07-19 19:02:04 -03:00
Hugo Locurcio
a221c85800 Optimize images losslessly using oxipng -o6 --strip all --zopfli 2018-06-28 19:17:41 +02:00
Hugo Locurcio
6aa5d63ca7 Tweak some help texts in the build system
This also removes `unix_global_settings_path` from SConstruct
since it is no longer used.
2018-06-07 21:40:54 +02:00
22 changed files with 325 additions and 283 deletions

20
LICENSE.txt Normal file
View File

@@ -0,0 +1,20 @@
Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.
Copyright (c) 2014-2020 Godot Engine contributors.
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.

53
README.md Normal file
View File

@@ -0,0 +1,53 @@
## Godot Engine platform port for Haiku
This is the platform port of [Godot Engine](https://godotengine.org) for the
[Haiku](https://www.haiku-os.org) operating system.
Haiku is not an officially supported platform in the main tree of Godot, so
this port is kept separate so that it can be contributed to independently of
Godot's main release cycle.
It may imply that this port might not be functional for the latest versions of
Godot. For the time being, neither the `3.2` branch nor the `master` branch are
functional out-of-the-box on Haiku.
We welcome all contributions from Haiku developers to ensure that each branch
and Git tag of this repository work as expected with the matching branches and
tags of the [Godot repository](https://github.com/godotengine/godot/).
## Usage
This code is meant to be copied as `platform/haiku` in the Godot Engine
[source repository](https://github.com/godotengine/godot/) to make builds of
Godot for Haiku.
It can also be cloned as a Git submodule:
```
git clone https://github.com/godotengine/godot
cd godot
git submodule add https://github.com/godotengine/godot-haiku-platform platform/haiku
```
Be sure to use compatible branches for the Godot repository and the Haiku port.
You can then compile Godot for Haiku with:
```
# Editor build, optimized.
scons p=haiku tools=yes target=release_debug
# Export template, debug.
scons p=haiku tools=no target=release_debug
# Export template, release.
scons p=haiku tools=no target=release
```
## License
This port is distributed under the MIT license, with the same copyright as the
main Godot source repository.
See [LICENSE.txt](/LICENSE.txt) for details, and
[AUTHORS.md](https://github.com/godotengine/godot/blob/master/AUTHORS.md) in
the Godot repository for a list of contributors.

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -32,18 +32,18 @@
#ifdef MEDIA_KIT_ENABLED
#include "project_settings.h"
#include "core/project_settings.h"
int32_t *AudioDriverMediaKit::samples_in = NULL;
Error AudioDriverMediaKit::init() {
active = false;
mix_rate = 44100;
mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE);
speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
int latency = GLOBAL_DEF("audio/output_latency", 25);
int latency = GLOBAL_DEF_RST("audio/output_latency", DEFAULT_OUTPUT_LATENCY);
buffer_size = next_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_size * channels);
@@ -100,7 +100,7 @@ int AudioDriverMediaKit::get_mix_rate() const {
return mix_rate;
}
AudioDriverSW::SpeakerMode AudioDriverMediaKit::get_speaker_mode() const {
AudioDriverMediaKit::SpeakerMode AudioDriverMediaKit::get_speaker_mode() const {
return speaker_mode;
}

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -35,9 +35,10 @@
#include "core/os/mutex.h"
#include "core/os/thread.h"
#include <SoundPlayer.h>
#include <kernel/image.h> // needed for image_id
#include <SoundPlayer.h>
class AudioDriverMediaKit : public AudioDriver {
Mutex *mutex;

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -33,12 +33,10 @@
#if defined(OPENGL_ENABLED)
#include "drivers/gl_context/context_gl.h"
#include "haiku_direct_window.h"
#include "haiku_gl_view.h"
class ContextGL_Haiku : public ContextGL {
class ContextGL_Haiku {
private:
HaikuGLView *view;
HaikuDirectWindow *window;
@@ -46,18 +44,18 @@ private:
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();
virtual Error initialize();
virtual void release_current();
virtual void make_current();
virtual void swap_buffers();
virtual int get_window_width();
virtual int get_window_height();
virtual void set_use_vsync(bool p_use);
virtual bool is_using_vsync() const;
};
#endif

View File

@@ -22,7 +22,7 @@ def get_opts():
from SCons.Variables import EnumVariable
return [
EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
]
@@ -37,14 +37,14 @@ def configure(env):
## Build type
if (env["target"] == "release"):
env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
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', '-ffast-math', '-DDEBUG_ENABLED'])
env.Prepend(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
if (env["debug_symbols"] == "yes"):
env.Prepend(CCFLAGS=['-g1'])
if (env["debug_symbols"] == "full"):
@@ -64,11 +64,91 @@ def configure(env):
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.Append(CPPPATH=['#platform/haiku'])
env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED', '-DGLES_OVER_GL'])
env.Append(CPPFLAGS=['-DMEDIA_KIT_ENABLED'])
# env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
env.Append(CPPFLAGS=['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
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'])

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -31,9 +31,10 @@
#ifndef HAIKU_APPLICATION_H
#define HAIKU_APPLICATION_H
#include <Application.h>
#include <kernel/image.h> // needed for image_id
#include <Application.h>
class HaikuApplication : public BApplication {
public:
HaikuApplication();

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -30,10 +30,10 @@
#include <UnicodeChar.h>
#include "core/os/keyboard.h"
#include "haiku_direct_window.h"
#include "key_mapping_haiku.h"
#include "main/main.h"
#include "os/keyboard.h"
HaikuDirectWindow::HaikuDirectWindow(BRect p_frame) :
BDirectWindow(p_frame, "Godot", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE) {
@@ -41,10 +41,14 @@ HaikuDirectWindow::HaikuDirectWindow(BRect p_frame) :
last_buttons_state = 0;
last_button_mask = 0;
last_key_modifier_state = 0;
view = NULL;
update_runner = NULL;
input = NULL;
main_loop = NULL;
}
HaikuDirectWindow::~HaikuDirectWindow() {
delete update_runner;
}
void HaikuDirectWindow::SetHaikuGLView(HaikuGLView *p_view) {
@@ -53,7 +57,7 @@ void HaikuDirectWindow::SetHaikuGLView(HaikuGLView *p_view) {
void HaikuDirectWindow::StartMessageRunner() {
update_runner = new BMessageRunner(BMessenger(this),
new BMessage(REDRAW_MSG), 1000000 / 30 /* 30 fps */);
new BMessage(REDRAW_MSG), 1000000 / 60 /* 60 fps */);
}
void HaikuDirectWindow::StopMessageRunner() {
@@ -69,6 +73,7 @@ void HaikuDirectWindow::SetMainLoop(MainLoop *p_main_loop) {
}
bool HaikuDirectWindow::QuitRequested() {
StopMessageRunner();
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
return false;
}
@@ -81,7 +86,7 @@ void HaikuDirectWindow::DirectConnected(direct_buffer_info *info) {
void HaikuDirectWindow::MessageReceived(BMessage *message) {
switch (message->what) {
case REDRAW_MSG:
if (Main::iteration() == true) {
if (Main::iteration()) {
view->EnableDirectMode(false);
Quit();
}
@@ -152,39 +157,36 @@ void HaikuDirectWindow::HandleMouseButton(BMessage *message) {
}
*/
Ref<InputEvent> mouse_event;
mouse_event.type = Ref<InputEvent>::MOUSE_BUTTON;
mouse_event.device = 0;
Ref<InputEventMouseButton> mouse_event;
mouse_event.instance();
mouse_event.mouse_button.mod = GetKeyModifierState(modifiers);
mouse_event->get_button_mask() = GetMouseButtonState(buttons);
mouse_event->get_position().x = where.x;
mouse_event->get_position().y = where.y;
mouse_event.mouse_button.global_x = where.x;
mouse_event.mouse_button.global_y = where.y;
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->get_button_index() = 1;
mouse_event->set_button_index(1);
break;
case B_SECONDARY_MOUSE_BUTTON:
mouse_event->get_button_index() = 2;
mouse_event->set_button_index(2);
break;
case B_TERTIARY_MOUSE_BUTTON:
mouse_event->get_button_index() = 3;
mouse_event->set_button_index(3);
break;
}
mouse_event->is_pressed() = (message->what == B_MOUSE_DOWN);
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.mouse_button.doubleclick = true;
mouse_event->set_doubleclick(true);
}
}
@@ -208,22 +210,18 @@ void HaikuDirectWindow::HandleMouseMoved(BMessage *message) {
Point2i rel = pos - last_mouse_position;
Ref<InputEvent> motion_event;
motion_event.type = Ref<InputEvent>::MOUSE_MOTION;
motion_event.device = 0;
Ref<InputEventMouseMotion> motion_event;
motion_event.instance();
GetKeyModifierState(motion_event, modifiers);
motion_event.mouse_motion.mod = GetKeyModifierState(modifiers);
motion_event->get_button_mask() = GetMouseButtonState(buttons);
motion_event.mouse_motion.x = pos.x;
motion_event.mouse_motion.y = pos.y;
motion_event->set_button_mask(GetMouseButtonState(buttons));
motion_event->set_position({ pos.x, pos.y });
input->set_mouse_position(pos);
motion_event.mouse_motion.global_x = pos.x;
motion_event.mouse_motion.global_y = pos.y;
motion_event.mouse_motion.speed_x = input->get_last_mouse_speed().x;
motion_event.mouse_motion.speed_y = input->get_last_mouse_speed().y;
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->get_relative().x = rel.x;
motion_event->get_relative().y = rel.y;
motion_event->set_relative({ rel.x, rel.y });
last_mouse_position = pos;
@@ -236,22 +234,21 @@ void HaikuDirectWindow::HandleMouseWheelChanged(BMessage *message) {
return;
}
Ref<InputEvent> mouse_event;
mouse_event.type = Ref<InputEvent>::MOUSE_BUTTON;
mouse_event.device = 0;
Ref<InputEventMouseButton> mouse_event;
mouse_event.instance();
//GetKeyModifierState(mouse_event, modifiers);
mouse_event->get_button_index() = wheel_delta_y < 0 ? 4 : 5;
mouse_event.mouse_button.mod = GetKeyModifierState(last_key_modifier_state);
mouse_event->get_button_mask() = last_button_mask;
mouse_event->get_position().x = last_mouse_position.x;
mouse_event->get_position().y = last_mouse_position.y;
mouse_event.mouse_button.global_x = last_mouse_position.x;
mouse_event.mouse_button.global_y = last_mouse_position.y;
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->is_pressed() = true;
mouse_event->set_pressed(true);
input->parse_input_event(mouse_event);
mouse_event->is_pressed() = false;
mouse_event->set_pressed(false);
input->parse_input_event(mouse_event);
}
@@ -272,24 +269,23 @@ void HaikuDirectWindow::HandleKeyboardEvent(BMessage *message) {
return;
}
Ref<InputEvent> event;
event.type = Ref<InputEvent>::KEY;
event.device = 0;
event.key.mod = GetKeyModifierState(modifiers);
event->is_pressed() = (message->what == B_KEY_DOWN);
event->get_scancode() = KeyMappingHaiku::get_keysym(raw_char, key);
event->is_echo() = message->HasInt32("be:key_repeat");
event.key.unicode = 0;
Ref<InputEventKey> event;
event.instance();
GetKeyModifierState(event, modifiers);
event->set_pressed(message->what == B_KEY_DOWN);
event->set_scancode(KeyMappingHaiku::get_keysym(raw_char, key));
event->set_echo(message->HasInt32("be:key_repeat"));
event->set_unicode(0);
const char *bytes = NULL;
if (message->FindString("bytes", &bytes) == B_OK) {
event.key.unicode = BUnicodeChar::FromUTF8(&bytes);
event->set_unicode(BUnicodeChar::FromUTF8(&bytes));
}
//make it consistent across platforms.
if (event->get_scancode() == KEY_BACKTAB) {
event->get_scancode() = KEY_TAB;
event->get_shift() = true;
event->set_scancode(KEY_TAB);
event->set_shift(true);
}
input->parse_input_event(event);
@@ -309,14 +305,14 @@ void HaikuDirectWindow::HandleKeyboardModifierEvent(BMessage *message) {
int32 key = old_modifiers ^ modifiers;
Ref<InputEvent> event;
event.type = Ref<InputEvent>::KEY;
event.device = 0;
event.key.mod = GetKeyModifierState(modifiers);
event->is_pressed() = ((modifiers & key) != 0);
event->get_scancode() = KeyMappingHaiku::get_modifier_keysym(key);
event->is_echo() = false;
event.key.unicode = 0;
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);
}
@@ -333,14 +329,13 @@ void HaikuDirectWindow::HandleWindowResized(BMessage *message) {
current_video_mode->height = height;
}
inline InputModifierState HaikuDirectWindow::GetKeyModifierState(uint32 p_state) {
inline void HaikuDirectWindow::GetKeyModifierState(Ref<InputEventWithModifiers> event, uint32 p_state) {
last_key_modifier_state = p_state;
InputModifierState state;
state.shift = (p_state & B_SHIFT_KEY) != 0;
state.control = (p_state & B_CONTROL_KEY) != 0;
state.alt = (p_state & B_OPTION_KEY) != 0;
state.meta = (p_state & B_COMMAND_KEY) != 0;
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;
}

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -31,9 +31,10 @@
#ifndef HAIKU_DIRECT_WINDOW_H
#define HAIKU_DIRECT_WINDOW_H
#include <DirectWindow.h>
#include <kernel/image.h> // needed for image_id
#include <DirectWindow.h>
#include "core/os/os.h"
#include "main/input_default.h"
@@ -63,7 +64,7 @@ private:
void HandleWindowResized(BMessage *message);
void HandleKeyboardEvent(BMessage *message);
void HandleKeyboardModifierEvent(BMessage *message);
inline InputModifierState GetKeyModifierState(uint32 p_state);
inline void GetKeyModifierState(Ref<InputEventWithModifiers> event, uint32 p_state);
inline int GetMouseButtonState(uint32 p_state);
public:

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -31,9 +31,10 @@
#ifndef HAIKU_GL_VIEW_H
#define HAIKU_GL_VIEW_H
#include <GLView.h>
#include <kernel/image.h> // needed for image_id
#include <GLView.h>
class HaikuGLView : public BGLView {
public:
HaikuGLView(BRect frame, uint32 type);

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -30,8 +30,8 @@
#include <InterfaceDefs.h>
#include "core/os/keyboard.h"
#include "key_mapping_haiku.h"
#include "os/keyboard.h"
struct _HaikuTranslatePair {
unsigned int keysym;

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -28,9 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "drivers/gles3/rasterizer_gles3.h"
#include "os_haiku.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "main/main.h"
#include "servers/physics/physics_server_sw.h"
#include "servers/visual/visual_server_raster.h"
@@ -68,7 +69,7 @@ void OS_Haiku::run() {
main_loop->finish();
}
String OS_Haiku::get_name() {
String OS_Haiku::get_name() const {
return "Haiku";
}
@@ -80,6 +81,10 @@ const char *OS_Haiku::get_video_driver_name(int p_driver) const {
return "GLES3";
}
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 = NULL;
current_video_mode = p_desired;
@@ -107,22 +112,20 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
context_gl->initialize();
context_gl->make_current();
context_gl->set_use_vsync(current_video_mode.use_vsync);
/* Port to GLES 3 rasterizer */
//rasterizer = memnew(RasterizerGLES2);
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
#endif
visual_server = memnew(VisualServerRaster(rasterizer));
visual_server = memnew(VisualServerRaster);
// FIXME: Reimplement threaded rendering
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
}
ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);
// TODO: enable multithreaded VS
/*
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
}
*/
video_driver_index = p_video_driver;
input = memnew(InputDefault);
window->SetInput(input);
@@ -132,8 +135,6 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
AudioDriverManager::initialize(p_audio_driver);
power_manager = memnew(PowerHaiku);
return OK;
}
@@ -146,7 +147,6 @@ void OS_Haiku::finalize() {
visual_server->finish();
memdelete(visual_server);
memdelete(rasterizer);
memdelete(input);
@@ -203,6 +203,10 @@ 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
}
@@ -322,7 +326,7 @@ String OS_Haiku::get_executable_path() const {
bool OS_Haiku::_check_internal_feature_support(const String &p_feature) {
return p_feature == "pc" || p_feature == "s3tc";
return p_feature == "pc";
}
String OS_Haiku::get_config_path() const {
@@ -330,7 +334,7 @@ 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");
return get_environment("HOME").plus_file("config/settings");
} else {
return ".";
}
@@ -341,7 +345,7 @@ 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(".local/share");
return get_environment("HOME").plus_file("config/data");
} else {
return get_config_path();
}
@@ -352,8 +356,23 @@ 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(".cache");
return get_environment("HOME").plus_file("config/cache");
} else {
return get_config_path();
}
}
OS::PowerState OS_Haiku::get_power_state() {
WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
return OS::POWERSTATE_UNKNOWN;
}
int OS_Haiku::get_power_seconds_left() {
WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
return -1;
}
int OS_Haiku::get_power_percent_left() {
WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
return -1;
}

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -37,9 +37,7 @@
#include "haiku_application.h"
#include "haiku_direct_window.h"
#include "main/input_default.h"
#include "power_haiku.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
#include "servers/visual_server.h"
class OS_Haiku : public OS_Unix {
@@ -48,10 +46,9 @@ private:
HaikuDirectWindow *window;
MainLoop *main_loop;
InputDefault *input;
Rasterizer *rasterizer;
VisualServer *visual_server;
VideoMode current_video_mode;
PowerHaiku *power_manager;
int video_driver_index;
#ifdef MEDIA_KIT_ENABLED
AudioDriverMediaKit driver_media_kit;
@@ -66,6 +63,7 @@ private:
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();
@@ -76,7 +74,7 @@ public:
OS_Haiku();
void run();
virtual String get_name();
virtual String get_name() const;
virtual MainLoop *get_main_loop() const;
@@ -88,6 +86,7 @@ public:
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;

View File

@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
/* 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 */
@@ -33,4 +33,5 @@
// for ifaddrs.h needed in drivers/unix/ip_unix.cpp
#define _BSD_SOURCE 1
#define GLES3_INCLUDE_H "glad/glad.h"
#define GLES3_INCLUDE_H "thirdparty/glad/glad/glad.h"
#define GLES2_INCLUDE_H "thirdparty/glad/glad/glad.h"

View File

@@ -1,74 +0,0 @@
/*************************************************************************/
/* power_haiku.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 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 "core/error_macros.h"
#include "power_haiku.h"
bool PowerHaiku::UpdatePowerInfo() {
return false;
}
OS::PowerState PowerHaiku::get_power_state() {
if (UpdatePowerInfo()) {
return power_state;
} else {
WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
return OS::POWERSTATE_UNKNOWN;
}
}
int PowerX11::get_power_seconds_left() {
if (UpdatePowerInfo()) {
return nsecs_left;
} else {
WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
return -1;
}
}
int PowerX11::get_power_percent_left() {
if (UpdatePowerInfo()) {
return percent_left;
} else {
WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
return -1;
}
}
PowerHaiku::PowerHaiku() :
nsecs_left(-1),
percent_left(-1),
power_state(OS::POWERSTATE_UNKNOWN) {
}
PowerHaiku::~PowerHaiku() {
}

View File

@@ -1,53 +0,0 @@
/*************************************************************************/
/* power_haiku.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2018 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 PLATFORM_HAIKU_POWER_HAIKU_H_
#define PLATFORM_HAIKU_POWER_HAIKU_H_
#include <os/os.h>
class PowerHaiku {
private:
int nsecs_left;
int percent_left;
OS::PowerState power_state;
bool UpdatePowerInfo();
public:
PowerHaiku();
virtual ~PowerHaiku();
OS::PowerState get_power_state();
int get_power_seconds_left();
int get_power_percent_left();
};
#endif /* PLATFORM_HAIKU_POWER_HAIKU_H_ */