Commit graph

775 commits

Author SHA1 Message Date
hbina085 9f0c6a6009 Many fallthrough switch cases now have the FALLTHROUGH macro to tell the compiler that this is intended. 2019-06-29 16:08:48 -04:00
Luka Dornhecker ad504b926f Add option to toggle console window on Windows
This is an editor setting and its value can also be toggled
using an entry in the Editor toolbar. The console will still
appear briefly when starting the project manager or editor,
as it's still compiled as console application.

Does not impact exported games, which will still run without
console in release and with console in debug mode.

A project setting or export option could be added to disable
it in debug mode if there's demand for it, but that would
greatly reduce the usefulness of debug builds if Windows users
can no longer report error and crash messages.

Fixes #17889.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2019-06-20 16:55:52 +02:00
Georg Wacker 4014888687 Fix endless controller iteration
Fixes #29846
2019-06-17 18:01:09 +02:00
Rémi Verschelde 24ee8c3566 Add script to fix style issues and copyright headers
This is only meant to check the validity of the whole codebase every
now and then, or to apply clang-format config changes when relevant.
2019-06-17 13:35:47 +02:00
Rémi Verschelde 0d61fc2c0f
Merge pull request #29752 from bruvzg/window_size_limits
Add ability to limit maximum/minimum window size.
2019-06-17 11:58:00 +02:00
Rémi Verschelde baab976d0f
Merge pull request #10643 from BastiaanOlij/camera_server
CameraServer class
2019-06-16 10:22:26 +02:00
Rémi Verschelde 68735d2a88 Fix compilation warnings in JS and Windows builds
Warnings raised by Emscripten 1.38.0 and MinGW64 5.0.4 / GCC 8.3.0.

JS can now build with `werror=yes warnings=extra`.
MinGW64 still has a few warnings to resolve with `warnings=extra`,
and only one with `warnings=all`.

Part of #29033 and #29801.
2019-06-15 14:40:45 +02:00
BastiaanOlij 02ea99129e 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
bruvzg b924fb97d6
Add ability to limit maximum/minimum window size. 2019-06-15 09:49:11 +03:00
Rémi Verschelde bbbc04b2fe
Merge pull request #29711 from zaksnet/windows-export-improvemnts
Added hint for windows export options
2019-06-12 23:44:11 +02:00
Zak 3168c25bad Added hint for windows export options 2019-06-12 14:42:35 +03:00
Rémi Verschelde f65b0c6d89
Merge pull request #29679 from akien-mga/windows-res-desc
Remove "Editor" from Windows PE file description
2019-06-12 13:24:30 +02:00
Rémi Verschelde 93c00dfcd9 Remove "Editor" from Windows PE file description
Closes #29569.
2019-06-11 15:22:03 +02:00
bruvzg 54863b20e6
Removes redundant "display/window/per_pixel_transparency/splash" setting, improves per pixel transparency documentation. 2019-06-04 11:21:29 +03:00
Rémi Verschelde 06633a8074
Merge pull request #26462 from SubSage/master
Fixes OS.execute; stderr was silenced; adds missing quote from exe args (windows)
2019-05-28 14:26:57 +02:00
Rémi Verschelde e8fbb28e20
Merge pull request #29119 from bruvzg/native_icon_support
Add native window/taskbar icon support for Windows and macOS.
2019-05-27 12:09:42 +02:00
bruvzg 2b9ed68d6a
Add native window/taskbar icon support for Windows and macOS.
Co-authored-by: Markus Törnqvist <mjt@nysv.org>
2019-05-24 14:23:57 +03:00
Ibrahn Sahir 63068e2ccd Check project settings live before lookup in crash handler
In x11, windows and osx crash handlers, check project settings exists
before looking up the crash handler message setting.
Avoids crashing the crash handler when handling a crash outside project
settings lifetime. Instead omitting the configurable message and
continuing with trace dump.
2019-05-23 20:06:56 +01:00
hbina085 f78baa5f93 added a const keyword for a methods that return constant literal... 2019-05-21 02:16:30 -04:00
Rémi Verschelde e0574e1d98 Fix typos with codespell
Using codespell 1.15.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
doubleclick
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-05-19 13:10:35 +02:00
Rémi Verschelde d52b70fb5e 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 b2f6beb888
Merge pull request #28061 from guilhermefelipecgs/fix_19137
[Input] Release keys/actions pressed if window loses focus
2019-04-29 18:39:45 +02:00
Hugo Locurcio be2e8e4047
Convert line endings to CRLF in OS.set_clipboard() on Windows
Windows applications typically expect CRLF line endings in clipboard
content.

This closes #28439.
2019-04-27 18:59:06 +02:00
Guilherme Felipe c709dfdf06 [Input] Release keys/actions pressed if window loses focus
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
Co-authored-by: Marcelo Fernandez <marcelofg55@gmail.com>
2019-04-27 12:05:12 -03:00
Rémi Verschelde 24005bc03d
Merge pull request #28396 from akien-mga/scons-capture-the-flags
SCons: Review uses of CCFLAGS, CXXFLAGS and CPPFLAGS
2019-04-25 12:22:22 +02:00
Juan Linietsky faaecd6987 Fixes to make exporting more responsive.
-Process and drop input in step functions.
-Hide editor file dialog right after pressing ok
-Use actual editor file dialogs for project export.
2019-04-24 15:52:15 -03:00
Rémi Verschelde c2a669a9f0 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
Kenneth Lee 5c5c3a590a Fixes build for Windows cross-compilation
Fixes #28299
2019-04-23 17:48:46 +00:00
Juan Linietsky dd03dcbd5a Android now (optionally) builds the template when exporting
Added new way to create add-ons
Removed old way to create add-ons
2019-04-07 15:46:52 -03:00
Rémi Verschelde b4860ce3ac
Merge pull request #28166 from KLee1248/first_bug
Use SHGetKnownFolderPath instead of SHGetFolderPathW
2019-04-22 11:53:09 +02:00
Rémi Verschelde d1c26674eb
Merge pull request #28051 from WindyDarian/no_utf8_for_vs2013
Ignore '/utf-8' flag on Visual Studio 2013
2019-04-19 08:41:43 +02:00
KLee1248 3d908f57d8 Use SHGetKnownFolderPath instead of SHGetFolderPathW.
When getting system directories for Windows, we currently use
SHGetFolderPathW. This is a deprecated function and doesn't support
"Downloads" folders.

As a replacement, this commit uses the newer SHGetKnownFolderPath
function, which is supported since Windows Vista. Godot 3.0 only
supports Windows 7+, so we don't need to use SHGetFolderPathW for
backwards compatibility.

Fixes #26876
2019-04-18 06:45:04 -07:00
Guilherme Felipe 1bae73d7d0 Add Input::get_current_cursor_shape
[Clean up] Removed unused/unnecessary methods.
2019-04-15 15:22:09 -03:00
Windy Darian bd7aa1b6f6 Ignore '/utf-8' flag on vs2013 2019-04-15 08:44:34 -04:00
Windy Darian ff3fdabc52 Force utf-8 source file encoding in MSVC
On Windows, when "Language for non-Unicode programs" were set to "Japanese (Japan)", MSVC would by default use Shift JIS (code page 932) to interpret source files, which would result in test_string failing to compile because of characters in `test_34()`. Forcing utf-8 for MSVC fixes the issue
2019-04-10 23:01:05 -04:00
Rémi Verschelde c8994b56f9 Style: Apply new changes from clang-format 8.0
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0,
so contributors can keep using those versions for now (they will not undo those
changes).
2019-04-09 17:09:48 +02:00
Rémi Verschelde c562a7d149
Merge pull request #27067 from shartte/remove-context-gl
Remove ContextGL
2019-04-07 12:38:55 +02:00
Hendrikto 49a81308c0 Remove unused imports 2019-04-06 18:05:05 +02:00
Sebastian Hartte 3a8c6db513 Remove ContextGL since as an abstraction it's unused. 2019-04-06 17:52:52 +02:00
PouleyKetchoupp fac0f76b7a Fixed & improved Visual Studio custom debugger visualization 2019-03-12 08:59:30 +01:00
Luis Martinez 9e465c9fd0 Fixes stderr silence; adds missing quote from exe args(windows)
8d117b214f/core/bind/core_bind.cpp (L452)
This function calls the bottom function

8d117b214f/drivers/unix/os_unix.cpp (L312)

OS.execute doesn't send out a value to stderr, so stderr defaults to
false, which will invoke this bottom line and always silence stderr.

8d117b214f/drivers/unix/os_unix.cpp (L315)

Some programs, such as FFmpeg, will print out to stderr with valuable
and vital information. This fixes stderr always being silenced, user can
now opt to have it be read as normal.
2019-03-05 17:07:00 -06:00
Rémi Verschelde b0f782a0e3 Disable driver fallback to GLES2 by default
GLES2 is not designed to be a drop-in replacement for the GLES3 backend,
so the fallback mode has to be used knowingly. It *can* make sense for
simple projects which make sure to handle the differences between both
rendering backends, but most users should stick to one supported backend.

By making it opt-in, we can now use this parameter to define whether to
export ETC textures to Android and iOS when using GLES3 + Fallback.

When using GLES3 without Fallback on Android, set the proper min GLES
version in the AndroidManifest.

Also made the option boolean and renamed it for clarity and to avoid
conflict with the previous String option (which would always evaluate as
"true" otherwise).

Fixes #26569.
2019-03-05 16:36:46 +01:00
Juan Linietsky a1e73dcc94 Add support for event accumlation (off by default, on for editor), fixes #26536 2019-03-03 19:53:13 -03:00
Juan Linietsky 8b4c4d9b2f Implement a more coherent (and way less hack) way to block animation updates, fixes #24618 2019-03-03 17:57:16 -03:00
Juan Linietsky ae886a6f32 Ability to keep pumping messages while being debugged, may be a solution for #21431 2019-03-03 17:12:19 -03:00
Juan Linietsky 5eeb06ffd1 -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
Junwei Ng 731b152dc1 Update Windows global mouse position at startup
Fixes issue #8145 for Windows, in the same manner as
issue #21910 fixed it for X11.
2019-02-25 01:10:18 +09:00
Rémi Verschelde 51c9ffaec0 Drop RtAudio driver on Windows
We've been defaulting to WASAPI since 3.0 and it's superior to RtAudio
in all aspects.

Obsoletes and closes #25503.

Also enable WINMIDI on MinGW, this had been missed initially.

Fix os_windows.cpp and crash_handler_windows.cpp which had weird
dependencies on RtAudio.h's includes (ugh).
2019-02-20 13:47:01 +01:00
Marcelo Fernandez 0c5f87531d Fix compiling with use_mingw flag on Windows 2019-02-19 10:02:24 -03:00
Rémi Verschelde bc9c1e899e
Merge pull request #25842 from marcelofg55/windows_timezone
Fix get_time_zone_info returning inverted bias on Windows/UWP
2019-02-13 14:28:11 +01:00
Marcelo Fernandez 4d43aba31e Fix get_time_zone_info returning inverted bias on Windows/UWP 2019-02-13 09:10:26 -03:00
Rémi Verschelde bc26d0d6cd Platform: Ensure classes match their header filename
Also drop some unused files.

Renamed:
- `platform/iphone/sem_iphone.h` -> `semaphore_iphone.h`
  (same for `osx`)
- `platform/uwp/gl_context_egl.h` -> `context_egl_uwp.h`
- in `platform/windows`: `context_gl_win.h`, `crash_handler_win.h`,
  `godot_win.cpp`, `joypad.h` and `key_mapping_win.h` all renamed to
  use `windows`. Some classes renamed accordingly too.
- `EditorExportAndroid` and `EditorExportUWP` renamed to
  `EditorExportPlatformAndroid` and `EditorExportPlatformUWP`
- `power_android` and `power_osx` renamed to `PowerAndroid` and
  `PowerOSX`
- `OSUWP` renamed to `OS_UWP`

Dropped:
- `platform/windows/ctxgl_procaddr.h`
2019-02-12 16:56:25 +01:00
Rémi Verschelde 75dae1b9a9 Drivers, main, servers: Ensure classes match their header filename
Renamed:
- `drivers/alsamidi/alsa_midi.h` -> `midi_driver_alsamidi.h`
  (same for `coremidi` and `winmidi`)
- `main/timer_sync.h` -> `main_timer_sync.h`
- `servers/visual/visual_server_global.h` -> `visual_server_globals.h`
2019-02-12 14:39:47 +01:00
Rémi Verschelde b867ef0eec
Merge pull request #25570 from Kanabenki/windows-relative-icon
Use relative path property hint for windows export icon
2019-02-08 16:50:14 +01:00
Ignacio Etcheverry 4e4e889c75
Merge pull request #25478 from neikeq/rr
Mono: Fix MonoPosixHelper not being found
2019-02-03 06:31:52 +01:00
Ignacio Etcheverry 41873ffa88 Added set_environment to OS class 2019-02-03 05:38:47 +01:00
Kanabenki 5890e7060e Use relative path property hint for windows export icon 2019-02-03 01:31:53 +01:00
Rémi Verschelde 70689ebffd Remove unused iostream includes 2019-01-28 12:16:22 +01:00
Marcelo Fernandez daf57bc81f Fix ALT+F4 being ignored with MOUSE_MODE_CAPTURED on Windows 2019-01-23 10:59:54 -03:00
Marcin Zawiejski 62f3611271 Fix GDI objects leak when setting custom cursor
Fixes #19906
2019-01-23 01:11:40 +01:00
Marcin Zawiejski 9ca649c67b
Set WINVER and _WIN32_WINNT values in VS project
While looking into a different issue, I've noticed that Visual Studio Intellisense does not work well for Godot project when using Windows Vista+ APIs (e.g. CreateThreadpool), i.e. it does not recognise the APIs because they are defined in Windows header files for Vista+ only.

This is because the WINVER and _WIN32_WINNT symbols don't have their values set in the generated Godot project file. This fixes the problem by setting the values when generating the project file.
2019-01-22 21:34:37 +01:00
Juan Linietsky ab843b1698 Raised executable priority on windows to avoid stuter, helps #25162 2019-01-22 16:04:54 -03:00
Juan Linietsky 0c9fd3c4b4 Avoid cyclic iteration check, fixes #24969 2019-01-22 13:17:39 -03:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
volzhs 84d060c768 Added OS.get_system_time_msecs() 2018-12-20 18:50:50 +09:00
Rémi Verschelde 57c3f6a94b
Merge pull request #20063 from moiman100/fix-button-mask
Unified button mask behavior across platforms
2018-12-14 23:31:52 +01:00
Rémi Verschelde a99e90b258 SCons: Properly set bits variable as string for MSVC detection 2018-12-04 14:30:49 +01:00
Marcelo Fernandez 711bc1c07e Fix wrong size and position when windows is minimized on Windows 2018-11-30 00:36:48 -03:00
Rémi Verschelde 173b342ca7 Remove trailing whitespace
With `sed -i $(rg -l '[[:blank:]]*$' -g'!thirdparty') -e 's/[[:blank:]]*$//g'`
(+ manual revert of some thirdparty code under `platform/android`).
2018-11-20 11:15:02 +01:00
Pedro J. Estébanez b5c56f6cca Fix mouse mode restoration on Windows
Fixes #23494.
2018-11-09 23:55:19 +01:00
Hein-Pieter van Braam 19d91f788d Properly export the various 'use dGPU' symbols when building with MingW
This fixes exporting the NvOptimusEnablement export when building with
MingW. This also adds the equivalent for AMD.

This fixes #23400
2018-11-03 10:55:03 +01:00
Rémi Verschelde 8ac1bcfd3d 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 4c9d734a75 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 dc2e73499a Fix compile warnings for Windows from Linux
At least the ones I got when I compiled it using Mingw64 POSIX on Xubuntu 18.04. Plus use the Size2 of get_window_size() directly, rather than reconstructing it.
2018-10-19 09:11:14 -04:00
Dualtagh Murray b902a2f2a7 Fixing warnings generated by MSVC
Fixes #22684.
2018-10-19 11:45:24 +02:00
Aaron Franke 4f7b33cdcf Remove redundant "== false" code
Some of this code has been re-organized.
f
2018-10-06 16:20:41 -04:00
Aaron Franke 37386f112b 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 c026e3957a 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 93570be2de
Merge pull request #22368 from moiman100/raw-input-fixes
Windows raw input fixes
2018-10-02 09:26:18 +02:00
Rémi Verschelde 6bfb7944d9 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 3a2ca68af3 SCons: Build thirdparty code in own env, disable warnings
Also remove unnecessary `Export('env')` in other SCsubs,
Export should only be used when exporting *new* objects.
2018-09-28 14:07:39 +02:00
Mikko Mustonen db346bff8b Fix mouse position when clicking in MOUSE_MODE_CAPTURED 2018-09-23 12:29:15 +03:00
Mikko Mustonen 33dd2c8de6 Fix zero relative motion event when clicking in MOUSE_MODE_CAPTURED 2018-09-23 12:06:55 +03:00
Guilherme Felipe 360204e532 Fix Input::set_custom_mouse_cursor showing cursor when it's invisible 2018-09-17 11:37:54 -03:00
Rémi Verschelde 1e201163b9
Merge pull request #22134 from elasota/natvis
Add Visual Studio debug visualizer
2018-09-17 10:16:18 +02:00
elasota af1e945435 Initial version of VS natvis file 2018-09-17 03:57:25 -04:00
Guilherme Felipe 04aef23585 Fix set_custom_mouse_cursor changing to incorrect cursor shape
[Docs] Add class ref for Input::set_default_cursor_shape
2018-09-13 15:13:57 -03:00
Fabio Alessandrelli 01c3c1a07b Properly initialize Winsock on startup
Also fix typo in _get_last_error which caused Winsock connect to fail.
2018-09-13 16:05:47 +02:00
Rémi Verschelde c8f761ae2d
Merge pull request #22000 from Faless/lws_uwp32
Fix libwebsockets 32-bits UWP builds.
2018-09-13 10:59:26 +02:00
Rémi Verschelde 1a16dabfb5
Merge pull request #21982 from luzpaz/misc-typos
Misc. typos
2018-09-13 10:59:00 +02:00
luz.paz 08bde5b2de Misc. typos
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12 21:39:17 -04:00
Fabio Alessandrelli 75b2db8c5f Fix libwebsockets 32-bits UWP builds.
Also fix bogus windows detect.py
2018-09-13 02:26:54 +02:00
Fabio Alessandrelli 30327872e0 Unify StreamPeerTCP/TCP_Server with NetSocket API 2018-09-12 15:56:20 +02:00
Fabio Alessandrelli 1b99806b47 Unify PacketPeerUDP using NetSocket 2018-09-12 15:56:16 +02:00
Rémi Verschelde 277b24dfb7 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
Rémi Verschelde 0dd7e02350
Merge pull request #21859 from avencherus/fix-scancode-colon
Changed Windows key translate pair from KEY_COLON to KEY_COMMA.
2018-09-10 18:38:39 +02:00
Jared dde0229fac Changed Windows key translate pair from KEY_COLON to KEY_COMMA. 2018-09-08 09:27:39 +03:00
Guilherme Felipe bd3d73a9fd Fix mouse confined leaving window with OS_Windows::set_window_position 2018-09-05 18:52:05 -03:00
Martin Capitanio bcee65284e Really fix the custom cursor hotspot
Add check for negative values.

Fixes #21721
2018-09-04 04:42:23 +02:00
Guilherme Felipe e5470cfa70 Fix custom cursor hotspot
Cursor hotspot must be inside image on Linux. Adding validation for all
platforms for consistency.
2018-09-03 09:57:07 -03:00
elasota d4045d835f Fix bad res file include in VS project and simplify a bit 2018-09-01 00:13:49 -04:00
Pedro J. Estébanez 28019c71a6 Fix multitouch input not working on certain devices on Windows
Fixes #20474.
2018-08-30 22:42:18 +02:00
Rémi Verschelde 72996df656
Revert "Try closing gracefully before terminating process" 2018-08-27 17:32:43 +02:00
Hein-Pieter van Braam 08f452d1a9 Fall back to GLES2 if GLES3 is not working
This adds a static is_viable() method to all rasterizers which has to be
called before initializing the rasterizer. This allows us to check what
rasterizer to use in OS::initialize together with the GL context
initialization.

This commit also adds a new project setting
"rendering/quality/driver/driver_fallback" which allows the creator of a
project to specify whether or not fallback to GLES2 is allowed. This
setting is ignored for the editor so the editor will always open even if
the project itself cannot run. This will hopefully reduce confusion for
users downloading projects from the internet.

We also no longer crash when GLES3 is not functioning on a platform.

This fixes #15324
2018-08-26 16:40:46 +02:00
Rémi Verschelde ff81b2daea
Merge pull request #21375 from akien-mga/msvc-nominmax
SCons: Disable min/max WinDef.h macros on MSVC
2018-08-24 20:02:53 +02:00
Rémi Verschelde 7238462601 SCons: Disable min/max WinDef.h macros on MSVC
Fixes #21370.
2018-08-24 18:04:18 +02:00
Juan Linietsky c6b340ea98
Merge pull request #20712 from marcelofg55/midi_open_close
Add OS::open_midi_inputs and OS::close_midi_inputs
2018-08-24 12:17:14 -03:00
Rémi Verschelde 52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Rémi Verschelde de59fe04e7 Add print_verbose to print to stdout only in verbose mode
Equivalent of the cumbersome:
if (OS::get_singleton()->is_stdout_verbose())
	print_line(msg);
2018-08-24 09:23:20 +02:00
Juan Linietsky 2db494267b Modifications to raw input so the handling of absolute coordinates is more correct. 2018-08-22 21:27:15 -03:00
Juan Linietsky 106e5a8d5e
Merge pull request #20523 from moiman100/windows-raw-input
Raw input relative motion for Windows
2018-08-22 19:32:20 -03:00
elasota 35f6ba5c5d BPTC support 2018-08-21 22:56:04 -04:00
Rémi Verschelde 4bf15d8090
Merge pull request #21236 from dragmz/windows-graceful-close
Try closing gracefully before terminating process
2018-08-21 22:47:21 +02:00
Rémi Verschelde e71c20099c CI: Disable debug_symbols on Travis/AppVeyor
Also increase AppVeyor cache size to 1024,
should match what is available for us in the free plan:
https://www.appveyor.com/docs/build-cache/#cache-size-beta

And drop obsolete debug_release option for Windows, superseded
by target=release and debug_symbols=yes.
2018-08-21 12:36:57 +02:00
Marcin Zawiejski ca1c851dbd Try closing gracefully before terminating process
Use a Microsoft recommended way of process termination for the project
process run from the editor. This allows loaded DLLs to receive and handle
DLL_PROCESS_DETACH notification and cleanup any global state before the
process actually exits.
2018-08-20 22:41:06 +02:00
Rémi Verschelde 661c9ece7c Add PROPERTY_HINT_PLACEHOLDER_TEXT for String properties
Use it to provide a better example for application identifiers
on Android, iOS and macOS, where users thought they *had* to use
this as a magic token.
2018-08-20 13:48:05 +02:00
Rémi Verschelde 54fcdabfd3
Merge pull request #21179 from elasota/vs-pdb
Support debug_symbols in VS optimized builds
2018-08-19 09:34:06 +02:00
elasota ffe0235f62 Support debug_symbols in VS optimized builds 2018-08-19 01:37:53 -04:00
neonsoup 42dc2ec080 Fix errors during removing files or folders and fix for latin symbols
This commit adds support for unicode strings in OS_Windows::move_to_trash.
Also reverts commit 6188388c5a as it did not add extra null character to the path string (SHFILEOPSTRUCTA and SHFILEOPSTRUCTW require path to be double null-terminated).
2018-08-18 01:30:22 +03:00
Chaosus 6188388c5a Fix impossibility of removing folder which contains non-latin symbols(on Windows) 2018-08-14 11:49:16 +03:00
Marcelo Fernandez 05fc12ddb6 Add OS::open_midi_inputs and OS::close_midi_inputs 2018-08-04 10:07:46 -03:00
Mikko Mustonen dcbbc445db Relative motion based on raw input for Windows 2018-07-30 23:51:51 +03:00
Marcin Zawiejski b1e0da455b Fix Windows handles leak
Fixes thread and process handles leak when running and killing project
from editor (caused by a missing CloseHandle call) plus a potential leak
when calling OS_Windows::execute with p_blocking and !r_pipe.

The leak could be easily observed with a Handles counter in Task Manager
(or Performance Monitor) for the Godot editor process.
2018-07-30 13:41:46 +02:00
Juan Linietsky e896261b87 Added missing support for traditional chinese on Windows, fixes #7674 2018-07-29 21:10:30 -03:00
Viktor Ferenczi c5bd0c37ce Running builder (content generator) functions in subprocesses on Windows
- Refactored all builder (make_*) functions into separate Python modules along to the build tree
- Introduced utility function to wrap all invocations on Windows, but does not change it elsewhere
- Introduced stub to use the builders module as a stand alone script and invoke a selected function

There is a problem with file handles related to writing generated content (*.gen.h and *.gen.cpp)
on Windows, which randomly causes a SHARING VIOLATION error to the compiler resulting in flaky
builds. Running all such content generators in a new subprocess instead of directly inside the
build script works around the issue.

Yes, I tried the multiprocessing module. It did not work due to conflict with SCons on cPickle.
Suggested workaround did not fully work either.

Using the run_in_subprocess wrapper on osx and x11 platforms as well for consistency. In case of
running a cross-compilation on Windows they would still be used, but likely it will not happen
in practice. What counts is that the build itself is running on which platform, not the target
platform.

Some generated files are written directly in an SConstruct or SCsub file, before the parallel build starts. They don't need to be written in a subprocess, apparently, so I left them as is.
2018-07-27 21:37:55 +02:00
Hein-Pieter van Braam 0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Rémi Verschelde a501678ba1
Merge pull request #20154 from marcelofg55/midi_driver
Added a new MIDIDriver class
2018-07-25 01:17:57 +02:00
Rémi Verschelde d1624cca99
Merge pull request #20245 from bruvzg/fix_win_pp_transp
Fix OpenGL buffer depth for per pixel transparency support (Windows)
2018-07-24 22:36:24 +02:00
Juan Linietsky 2b9902db06 -Fix disable_3d flag
-Add extra flag optimize=[size,speed] to be able to prioritize size
2018-07-21 17:26:49 -03:00
Marcelo Fernandez 7a5f9fc08e Added a new MIDIDriver class 2018-07-21 09:09:42 -03:00
Juan Linietsky c69de2ba46 -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
bruvzg 31a0b9eaed
Fix OpenGL buffer depth for per pixel transparency support (Windows, NVIDIA) 2018-07-18 17:40:20 +03:00
Rémi Verschelde 7c9f7452f4 Style: Format code with clang-format 6.0.1 2018-07-18 16:27:03 +02:00
mm bd9c592c52 Fixed button mask behavior 2018-07-11 01:15:03 +03:00
unknown 9cc41a59ac Added support for extra mouse buttons. 2018-07-09 14:34:19 +03:00
Juan Linietsky 085483e885 -Fix fullscreen on Windows with a HiDPI monitor but a non-HiDPI project
-Replaced some viewport size calls to screen size, since viewport size should be deprecated at this point..
2018-07-03 18:53:27 -03:00
Max Hilbrunner 2017119a3d
Merge pull request #19919 from marcelofg55/notif_crash
Add a new notification to detect crashes on native scripts
2018-07-03 18:42:49 +02:00
Max Hilbrunner bb8844d8d7
Merge pull request #19708 from RandomShaper/fix-windows-touch
Fix touch issues on Windows
2018-07-03 15:41:14 +02:00
Marcelo Fernandez deebeb2742 Add a new notification to detect crashes on native scripts 2018-07-02 16:18:58 -03:00
Hugo Locurcio 53e94a1ce1
Optimize images losslessly using oxipng -o6 --strip all --zopfli 2018-06-28 19:17:41 +02:00
Pedro J. Estébanez 2f161ffd4f Fix touch issues on Windows 2018-06-26 20:00:23 +02:00
Saracen c5bdb5b1d8 IME context detection. 2018-06-11 17:22:11 +01:00
Hugo Locurcio d54b5da940
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
Rémi Verschelde f392650be2 Improve return value of OS.execute in blocking/non-blocking variants
Initialized the PID to -2, which will be the value returns in blocking-
mode where the PID is not available. (-1 was already taken to signify an
execution failure).

OS::execute will now properly return a non-OK error code when it fails
to execute the target file.

The documentation was rewritten to be very clear about the differences
between blocking and non-blocking mode.

Fixes #19056.
2018-05-30 12:55:17 +02:00
Guilherme Felipe c8e0ec0580 Change position of validation in set_custom_mouse_cursor 2018-05-28 09:36:30 -03:00
Max Hilbrunner 856d945248
Merge pull request #19210 from guilhermefelipecgs/fix_invalid_image
Add validation in set_custom_mouse_cursor
2018-05-28 12:52:10 +02:00
Guilherme Felipe aad6bdad94 Add validation in set_custom_mouse_cursor
Check if the image is valid.
2018-05-27 20:55:05 -03:00
Guilherme Felipe aa174d963d Fix memory leak in set_custom_mouse_cursor 2018-05-26 15:56:35 -03:00
Guilherme Felipe 8c17d8e6fe More fixes to set_borderless_window
[x11] Preserve window size when calling this method.
[osx] Make sure it don't make the window resizable if it's not needed.
[windows] clean up the code.
2018-05-23 17:42:31 -03:00
Max Hilbrunner 0980991e64
Merge pull request #19070 from guilhermefelipecgs/fix_19033
Fix mouse confined and set_borderless_window
2018-05-21 18:30:11 +02:00
Guilherme Felipe 9af14ac1db Fix #15678
Fix cursor not displaying arrow when transiting from mode captured to
visible.
2018-05-21 14:37:30 -03:00
Guilherme Felipe 28d24c4f66 Fix #19033
- Fix a bug when mouse is confined don't update the cursor shape.
- Don't let the mouse leave the window when resizing to a smaller
resolution when MOUSE_MODE_CONFINED.
- Fix set_borderless_window to preserve the actual video_mode.widht/height.
2018-05-20 20:53:04 -03:00
Guilherme Felipe 50a0220d2d Reset the cursor with Input.set_custom_mouse_cursor(null) 2018-05-10 20:02:12 -03:00
Guilherme Felipe 8ead09342d Add support for atlas texture on set_custom_mouse_cursor 2018-05-09 12:44:43 +00:00
Hein-Pieter van Braam e668757aa9
Merge pull request #14622 from bruvzg/non-rectangular-windows
Experimental support for windows with per-pixel transparency.
2018-05-08 16:44:35 +02:00
Rémi Verschelde 7e39647623
Merge pull request #18665 from mhilbrunner/build-sdk
Windows detect.py: Detect missing WindowsSdkDir
2018-05-08 10:21:54 +02:00
Blazej Floch c45f44d856 Local debugger fixes and extensions
- Adds q/quit option to console debugging
- Adds options (variable_prefix)
- Breaks into debugger with Ctrl-C in local debug mode (Unix/Windows)
- Added option to list all breakpoints
- Fixes add/remove breakpoint bug (invalid path parsing)
- Minor cleanup
2018-05-07 23:17:06 -04:00
Max Hilbrunner a6b191e3e0
Windows detect.py: Detect missing WindowsSdkDir 2018-05-07 00:42:12 +02:00
Max Hilbrunner a53b08861a
Merge pull request #18541 from profan/fix/win-sleep
Windows: ensure minimum possible timer resolution for sleep
2018-05-05 06:47:13 +02:00
Robin Hübner 8cb1ff9452 windows: ensure minimum possible timer resolution for sleep 2018-05-01 09:58:16 +02:00
Pedro J. Estébanez de9d40a953 Implement universal translation of touch to mouse
Now generating mouse events from touch is optional (on by default) and it's performed by `InputDefault` instead of having each OS abstraction doing it. (*)

The translation algorithm waits for a touch index to be pressed and tracks it translating its events to mouse events until it is raised, while ignoring other pointers.

Furthermore, to avoid an stuck "touch mouse", since not all platforms may report touches raised when the window is unfocused, it checks if touches are still down by the time it's focused again and if so it resets the state of the emulated mouse.

*: In the case of Windows, since it already provides touch-to-mouse translation by itself, "echo" mouse events are filtered out to have it working like the rest.

On X11 a little hack has been needed to avoid a case of a spurious mouse motion event that is generated during touch interaction.

Plus: Improve/fix tracking of current mouse position.

** Summary of changes to settings: **

- `display/window/handheld/emulate_touchscreen` becomes `input/pointing_devices/emulate_touch_from_mouse`
- New setting: `input/pointing_devices/emulate_mouse_from_touch`
2018-04-30 19:03:38 +02:00
Guilherme Felipe 62b835a2cd Fix custom cursor when it's hidden
[Linux] Ensures that the custom cursor will be used when changing to
MOUSE_MODE_VISIBLE. Fix #3086

[Windows] Fix cursor flickering when MOUSE_MODE_HIDDEN.

[Mac] Fix possible cursor flicker when MOUSE_MODE_HIDDEN.
2018-04-09 10:28:20 -03:00
bruvzg ddae098dee
Experimental support for windows with per-pixel transparency (macOS, X11 and Windows). 2018-04-07 17:11:45 +03:00
Guilherme Felipe dc57632d66 Remove size restriction for mouse cursor 2018-04-05 15:41:09 -03:00
bruvzg e337eecd17
Fix MinGW cross-build 2018-03-15 17:29:55 +02:00
Bastiaan Olij cc9e8aa732 Added missing import BoolVariable
Didn't like the missing BoolVariable :)
2018-03-15 22:35:44 +11:00
Gary Oberbrunner d1318ee12c Enable SCons to autodetect Windows MSVC compiler
SCons has good compiler detection logic for MSVC compilers. Up to now,
Godot hasn't used it; it depends on passed-in OS environment vars from
a specific Visual Studio cmd.exe windows. This makes it harder to
build from a msys or cygwin shell.

This change allows SCons to autodetect Visual Studio unless it sees
VCINSTALLDIR in the os.environ. It also adds a 'msvc_version' arg for
manual specification of compiler version, and uses the existing 'bits'
arg to specify the target architecture. More detail could be added as
desired. It also adds 'use_mingw' to always use mingw, even if Visual
Studio is installed. That uses the existing mingw setup logic.

If people are used to building Godot in a Visual Studio cmd window,
this should not change the behavior in that case, since VCINSTALLDIR
will be set in those windows. (However, note that you could now unset
that var and build with any other MSVC version or target arch, even in
that window.)

I refactored much of platform/windows/detect.py during this, to
simplify and clarify the logic. I also cleaned up a bunch of env var
settings in windows/detect.py and SConstruct to use modern SCons
idioms and simplify things.

I suspect this will also enable using the Intel compiler on Windows,
though that hasn't been tested.
2018-03-13 09:51:05 -04:00
bruvzg ad67911f1a
Explicitly set OpenGL profile to core (X11, Windows).
Enable GLES2 on Windows.
2018-03-06 15:53:30 +02:00
Marcelo Fernandez d780d774aa Clean and expose get_audio/video_driver_* funcs on OS class 2018-03-04 14:18:05 -03:00
karroffel eac4c984df add GLES 2 renderer for 2D
This commit adds a new rendering backend, GLES2, and adds a
project setting to enable it.

Currently this backend can only be used on the X11 platform,
but integrating into other platforms is planned.
2018-03-01 15:12:30 +01:00
Marcelo Fernandez f8da9550f4 Fixed Windows ignoring minimized/maximized status set by user 2018-02-26 17:38:00 -03:00
Rémi Verschelde 23ebae01dc Refactor version macros and fix related bugs
The previous logic with VERSION_MKSTRING was a bit unwieldy, so there were
several places hardcoding their own variant of the version string, potentially
with bugs (e.g. forgetting the patch number when defined).

The new logic defines:

- VERSION_BRANCH, the main 'major.minor' version (e.g. 3.1)
- VERSION_NUMBER, which can be 'major.minor' or 'major.minor.patch',
  depending on whether the latter is defined (e.g. 3.1.4)
- VERSION_FULL_CONFIG, which contains the version status (e.g. stable)
  and the module-specific suffix (e.g. mono)
- VERSION_FULL_BUILD, same as above but with build/reference name
  (e.g. official, custom_build, mageia, etc.)
  Note: Slight change here, as the previous format had the build name
  *before* the module-specific suffix; now it's after
- VERSION_FULL_NAME, same as before, so VERSION_FULL_BUILD prefixed
  with "Godot v" for readability

Bugs fixed thanks to that:

- Export templates version matching now properly takes VERSION_PATCH
  into account by relying on VERSION_FULL_CONFIG.
- ClassDB hash no longer takes the build name into account, but limits
  itself to VERSION_FULL_CONFIG (build name is cosmetic, not relevant
  for the API hash).
- Docs XML no longer hardcode the VERSION_STATUS, this was annoying.
- Small cleanup in Windows .rc file thanks to new macros.
2018-02-23 20:15:29 +01:00
luz.paz 612ab4bbc6 Fix typos with codespell
Found via `codespell -q 3 --skip="./thirdparty,./editor/translations" -I ../godot-word-whitelist.txt`
Whitelist consists of:
```
ang
doubleclick
lod
nd
que
te
unselect
```
2018-02-21 19:46:06 +01:00
Fabio Alessandrelli d29488ee9b Link bcrypt lib in window and UWP 2018-02-20 17:42:16 +01:00
Rémi Verschelde 3925e6a543
Merge pull request #16696 from BTaskaya/master
PEP3101 applied with changing old type string formatting as new ones
2018-02-19 20:38:37 +01:00
Rémi Verschelde 4fa8987494 Windows: Fix case of imm32 for case-sensitive MinGW build
Fixes #16713.
2018-02-15 09:06:02 +01:00
BTaskaya 78dba05fc0 PEP3101 applied with changing old type string formatting as new ones 2018-02-14 19:29:25 +03:00
Rémi Verschelde e0f43e0678
Merge pull request #15564 from RandomShaper/adpod-topmost
Add new window setting: always on top
2018-02-14 16:43:40 +01:00
Rémi Verschelde 7d7f8d9e54
Merge pull request #15864 from GodotExplorer/pr-get_unique_id-desktop-impl
Implement more methods for OS on Desktop platforms
2018-02-14 16:11:53 +01:00
Marcelo Fernandez ea1d726a46 Added OS::center_window to center the window precisely on desktop platforms 2018-02-12 15:45:41 -03:00
geequlim 3be04f73f5 Windows: implement OS.get_unique_id and OS.set_ime_position 2018-01-31 09:40:33 +08:00
Hein-Pieter van Braam b4d369c887 Implement OS::get_processor_count() for Windows
Current this is hardcoded as '1' for any platform except Unix. The
little is_wow64() dance is required to get correct output on a 32bit
compiled godot running on 64bit Windows according to MSDN.

This code should be UWP safe but I have no way to test that so it's not
implemented for UWP yet.
2018-01-29 16:50:49 +01:00
Rémi Verschelde f12e8568d4
Merge pull request #16081 from djgaspa/dll-directory
Fix remove_dll_directory crash when cookie is null
2018-01-27 23:32:05 +01:00
Hein-Pieter van Braam c6d9a7665a Make separate debug symbols opt-in
This adds a separate_debug_symbols option to the x11, windows, and osx
targets. This will default to adding normal debugging symbols to the
artifacts and only splits them when separate_debug_symbols=yes on the
Scons command line.
2018-01-26 20:46:56 +01:00
djgaspa 18e66a28bc Fix remove_dll_directory crash when cookie is null 2018-01-26 12:30:02 +01:00
binbitten 017a8521c0 Fix horizontal scroll for windows platform 2018-01-20 21:15:58 +01:00
Juan Linietsky 554e95747c sorry, accidentally pressed delete before commiting. 2018-01-10 17:55:00 -03:00
Juan Linietsky 0f00384c93 Added middle button doubleclick, fixes #15567 2018-01-10 17:46:41 -03:00
Pedro J. Estébanez ee2c31d306 Add new window setting: always on top
Implemented for Windows and Linux.
2018-01-05 21:31:04 +01:00
Rémi Verschelde db49f35ab8 SCons: Fix usage of LD when we meant LINK
Also made LINK and CXXFLAGS configurable as command line options.
Note that LINK currently expects the *compiler* that will be used
for linking and will call its configured linker behind the scenes
(so g++, clang++, etc., not ld.gold). See #15364 for details.
2018-01-05 20:37:45 +01:00
Juan Linietsky 7332da31fc Forced set mouse global position always, hopefully will fix #15354, otherwise out of luck. 2018-01-05 14:33:13 -03:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Juan Linietsky 6e2ed15ff1 Add support from properly exporting shared objects, needed for GDNative export 2018-01-04 15:43:06 -03:00
Emmanuel Leblond e315c94900 Change OS::initialize signature to return Error (fix segfault on x11) 2018-01-04 15:15:55 +01:00
Rémi Verschelde 6322b0bbb7
Merge pull request #12814 from guilhermefelipecgs/add_hardware_custom_cursor
Custom hardware-accelerated mouse cursor
2018-01-03 08:35:59 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
George Marques abf416f922
Improve LTO build with MSVC 2017-12-31 14:35:38 -02:00
Juan Linietsky 021f3c924b -Removed OpenMP support, replaced by a custom class.
-Disabled Opus, implementation is wrong.
2017-12-24 09:32:12 -03:00
Rémi Verschelde bf4d398d4e Do not require OpenMP for non-tools builds (export templates) 2017-12-22 12:24:40 +01:00
Guilherme Silva a392dbdbe3 Add implementation for custom hardware cursor 2017-12-17 13:40:29 -02:00