Compare commits

..

242 Commits

Author SHA1 Message Date
9ed2084b42 Revert "-make sure single select after multi select works better"
This reverts commit f909634832.
It caused various regressions (#4556 and #4607).
2016-05-13 08:06:31 +02:00
c0df7da2ca Version 2.0.3 2016-05-12 19:54:11 +02:00
49bf494eac classref: Readd String.strip_edges description 2016-05-12 19:47:26 +02:00
b8d8ec09ee Remove nocpuid.c from builtin OpenSSL
Since opensslconf.h no longer defines OPENSSL_CPUID_OBJ, OpenSSL defines
OPENSSL_cpuid_setup itself (with the same empty definition)

(cherry picked from commit 2392824dba)
2016-05-12 19:35:49 +02:00
f120514402 classref: Fixed return types in Area and Area2D (#4635)
(cherry picked from commit 91c85ff1f5)
2016-05-12 19:35:41 +02:00
77573a76d1 classref: Sync with current source 2016-05-12 09:16:37 +02:00
c734a508c3 classref: Directory and ConfigFile
(cherry picked from commit 22d1385caf)
2016-05-12 09:07:43 +02:00
d66b04921f Windows: Fix GCC/Clang argument being passed to MSVC
Fixes #4620

(cherry picked from commits 972b0f78b3
and c7292b1f3d)
2016-05-12 09:06:48 +02:00
f61f515872 Updated caret blink method documentation
(cherry picked from commit 997476777a)
2016-05-12 09:06:10 +02:00
c5e17d553e Bind caret blink to gdscript and properties
(cherry picked from commit dc90cba42e)
2016-05-12 09:05:46 +02:00
2bd6e2402b OS.get_screen_size now returns the correct value on OSX
(cherry picked from commit b697de92ef)
2016-05-12 09:05:32 +02:00
c575f31d5d Added possibility to strip left and right to strip_edges (#4594)
(cherry picked from commit 49c473bb36)
2016-05-12 09:04:59 +02:00
6d50ccfd32 Joystick demo script cleanup
Removes a leftover variable and uses constants instead of magic numbers.

(cherry picked from commit 86b46c0b7e)
2016-05-12 09:04:41 +02:00
bd51dea8f6 Added caret blink in text editor
(cherry picked from commit e03e7deb1b)
2016-05-12 09:04:03 +02:00
abc97d3bb4 Fixed autocomplete truncate, issue 4554
(cherry picked from commit accc2a195b)
2016-05-12 09:03:59 +02:00
a5e54b83ec Add ignore error flag to OpenSSL driver
(cherry picked from commit 2e44e255ed)
2016-05-12 09:00:39 +02:00
18782aec61 Fixed autocomlete strings not appearing for function arguments
(cherry picked from commit 9e6234201b)
2016-05-12 09:00:22 +02:00
f58cfaf585 fix percent decode utf8 error
(cherry picked from commit f86cffd8e6)
2016-05-12 08:59:30 +02:00
5d98718c28 Fixed animation player auto-queue duplication and undo/redo
(cherry picked from commit 488495852b)
2016-05-12 08:58:39 +02:00
7ab1c1ea3b Fixed code completion after opening bracket, issue 3977
(cherry picked from commit 0a2b341d0a)
2016-05-12 08:55:43 +02:00
f8debd8152 cloning env for builtin_openssl _and_ openssl :)
(cherry picked from commit baaa74f215)
2016-05-12 08:55:34 +02:00
ac06e3d4db clonning env for builtin ssl
(cherry picked from commit 62c17d65a8)
2016-05-12 08:55:28 +02:00
b6be2f503d Rotation APIs: Better exposure for degrees methods
Made public the various set/getters for rotations in degrees.
For consistency, renamed the exposed method names to remove the leading
underscore, and kept the old names with a deprecation warning.

Fixes #4511.

(cherry picked from commit 4eab767a6f)
2016-05-12 08:55:14 +02:00
b224407770 Partial documentation for OS methods
(cherry picked from commit ed7c0a6caf)
2016-05-06 11:14:59 +02:00
7556391d20 Fix build for Windows 64-bits with GCC
(cherry picked from commit 81297f0fa1)
2016-05-06 11:14:53 +02:00
23c659fc47 -make sure single select after multi select works better
-fixed some warnings for OSX

(cherry picked from commit f909634832)
2016-05-06 11:14:11 +02:00
4832731477 Fix memory leak
As pointed out by @sanikoyes in #4541.

(cherry picked from commit 5930408746)
2016-05-06 11:13:41 +02:00
19f08eaa5b Fix wrong return and argument types in documentation
(cherry picked from commit 1e752c0120)
2016-05-06 11:13:35 +02:00
975b4d2927 Add missing Vector2Array case to Variant::operator String()
- Correcly display Vector2Array default arguments in the documentation

(cherry picked from commit 2060e6616c)
2016-05-06 11:13:25 +02:00
913818a246 Fix ds3 gamepad mapping
(cherry picked from commit d6cd5108e3)
2016-05-06 11:12:44 +02:00
4a4999451b Changed barely visible PROPERTY_HINT_ALL_FLAGS buttons for checkboxes
(cherry picked from commit 723c0d730c)
2016-05-06 11:12:38 +02:00
4f57e532b8 Fix windows 64-bits build.
The change in `tools/doc/doc_data.cpp` is needed because the MSVC
compiler does not support variable length arrays.

Fix #4113

(cherry picked from commit 9424c6c58f)
2016-05-06 11:12:31 +02:00
3449c81bdb Fixes 64 bit MSVC builds, disables bits parameter
Also Enables automatic detection of architecture for the MSVC compilers.
Builds without assembly optimisations for x64
Closes issue #3098

Signed-off-by: Aleksandar Danilovic <greatgames.alexandar@gmail.com>
(cherry picked from commit 7762e1afe6)
2016-05-06 11:12:23 +02:00
05857a5472 Update OpenSSL to 1.0.2h
(cherry picked from commit ab623c923d)
2016-05-06 11:11:21 +02:00
ec3b50fd65 Autocomplete no longer shows duplicates, issue 1824
(cherry picked from commit 084d0bef96)
2016-05-06 11:11:14 +02:00
f95918e05a Input Documentation
Input Documentation

(cherry picked from commit f6ae5e41de)
2016-05-06 11:11:09 +02:00
b3404c8c44 Fixed behavior of OS.set_window_resizable
Should fix #4428.
 * Minimize button is not hidden anymore
(cherry picked from commit 8fb7280f39)
2016-05-06 11:10:57 +02:00
7e077258c5 Fixed documentation generator for polymorphic functions
(cherry picked from commit 57d0b78426)
2016-05-06 11:10:48 +02:00
fb3d10c579 Documented bool methods
(cherry picked from commit 3ca1d0f1d5)
2016-05-06 11:10:41 +02:00
0b75c39c2b Documented float
(cherry picked from commit 520e6f5b09)
2016-05-06 11:10:34 +02:00
e0a13981fc Documented int methods
(cherry picked from commit 4453284388)
2016-05-06 11:10:28 +02:00
bdbb831261 Finished AnimationPlayer Documentation
(cherry picked from commit abf5f8c586)
2016-05-06 11:09:51 +02:00
97e30f4cd7 Fix checking unsaved changes only in current scene
(cherry picked from commit 107e62be70)
2016-05-06 11:07:46 +02:00
78dc8e79c4 Documented YSort (#4515)
Documented YSort
(cherry picked from commit 957c265f11)
2016-05-06 11:07:25 +02:00
40681d90e5 Debugger: Fix breaked signal binding (#4508)
Closes #4270.
(cherry picked from commit 8ceab5ddaf)
2016-05-06 11:07:17 +02:00
fbb8a2170c Documented ColorRamp
(cherry picked from commit c2bdb3727b)
2016-05-06 11:07:03 +02:00
e8a972197c Partial documentation for Particles2D
(cherry picked from commit 3cd58fe0ba)
2016-05-06 11:06:56 +02:00
047767b824 Document Popup, PopupDialog, PopupMenu, and PopupPanel
(cherry picked from commit 5cdf4a6379)
2016-05-06 11:06:49 +02:00
ef2f1ae811 Tabs: Fix align issue with right/close buttons
The stylebox around the close button was badly centered.
There were also bad margins applied when using right buttons.

(cherry picked from commit 21c181bd3c)
2016-05-06 11:06:42 +02:00
7c419032c7 Tabs: cleanup code, no functional change
Some dead code removed, a few cosmetic changes.

(cherry picked from commit 8b32c80529)
2016-05-06 11:06:35 +02:00
9bdcc97e56 Tabs: Fix navigation buttons overlap when resizing
It was not taking into account the minimum width of the stylebox.
Fixed by factorizing some duplicate code.

(cherry picked from commit 8574489dd2)
2016-05-06 11:06:29 +02:00
7f80fce464 Tabs: Fix icon size not taken into account for offset
Fixes #4107.

(cherry picked from commit bbaf296948)
2016-05-06 11:06:22 +02:00
ea9b552e27 Variant: readd Dict.has_all
Erroneously removed in 4bc494ae2e.
2016-05-06 10:56:39 +02:00
21ab3a030e missing default value 2016-05-05 18:44:29 -03:00
a14ff27337 fix to avoid video texture scaling 2016-05-05 18:44:20 -03:00
d6e30256ad ability to shrink all images x2 on load
this is for extreme cases when running on devices with very low video
memory, so you can still retain compatibility.
2016-05-05 18:43:47 -03:00
4bc494ae2e export fix_alpha_edges 2016-05-05 18:42:55 -03:00
d49fff6246 FileDialog: reset mkdir label after use (#4500)
Closes #1686.
(cherry picked from commit ab7886ffc4)
2016-05-01 12:28:27 +02:00
d29087cc53 OSX: Fix lib suffix for Android lib (#4499)
Fixes #1452.
(cherry picked from commit 94274b9ab5)
2016-05-01 12:28:20 +02:00
27461a79dc GridMap: Fix backwards rotate hotkeys (#4498)
Fixes #1237
(cherry picked from commit 8259c46707)
2016-05-01 12:28:14 +02:00
a86cfc258e AnimationPlayer: Prevent resetting timeline when pinned (#4497)
Fixes #1019
(cherry picked from commit 0b4f277184)
2016-05-01 12:28:07 +02:00
26c2e0d09d math: Fix rounding error for 0 in Math::round (#4495)
Thus revert the previous workaround in commit b123bc4a2a.
Fixes #3221.
(cherry picked from commit 6883325f92)
2016-05-01 12:28:01 +02:00
0b49d78a3f Project manager: unescape project names (#4494)
Fixes #3609
(cherry picked from commit 78adbf4790)
2016-05-01 12:27:54 +02:00
40b546fb83 Allow any directory for custom character set and gradient image file when import font
fix #4486

(cherry picked from commit b172cb524d)
2016-05-01 12:27:43 +02:00
3c453b7bd2 Ignore invalid folders in platform
Fixes #4479

(cherry picked from commit f938793e78)
2016-05-01 12:27:14 +02:00
f033763700 Implement OS.get_process_ID for Windows
Based on code by @ratsdiov.
Closes #1733

(cherry picked from commit 2cd8e86aa0)
2016-05-01 12:27:04 +02:00
944ac2500a classref: Sync with source 2016-04-29 18:12:33 +02:00
b4adb0d338 Add more documentations for this classes:
* BoxContainer
* CenterContainer
* ScrollContainer
* SplitContainer
* Vector2
* StringArray
* FileDiloags

(cherry picked from commit a518792d89)
2016-04-29 18:06:09 +02:00
227604a566 Fix launching from .app on OSX
(cherry picked from commit 6962fd91c6)
2016-04-29 18:05:39 +02:00
70644301dd Allow dragging on only one (global) axis when holding down shift
Closes #1723

(cherry picked from commit d82ff4ed09)
2016-04-29 18:02:27 +02:00
4228505cf0 Shader editor now uses text editor settings
(cherry picked from commit 64751e0a75)
2016-04-29 18:02:19 +02:00
9086a929b2 Specify the demos license
It was already under the MIT as the rest of the engine,
but some users seemed not convinced about it.
(cherry picked from commit fa3240a8e9)
2016-04-29 18:02:10 +02:00
5365ae9212 Add more documentations and fix AcceptDialog::add_cancel
(cherry picked from commit 5c61e17c10)
2016-04-29 18:02:03 +02:00
a3fd381a4f Fill in the blank in the Array, CenterContainer and Dictionary class reference (#4476)
(cherry picked from commit 4de3f8944e)
2016-04-29 07:44:23 +02:00
d81ffaf2ab Documentation for Canvas Modulate, ColorPicker, ColorPickerButton
(cherry picked from commit faf21b81e8)
2016-04-29 07:43:43 +02:00
c77a5f910e Fixed shader editor syntax coloring
(cherry picked from commit bda5ea0871)
2016-04-29 07:43:30 +02:00
91461b588d Move export GUI debug toggle to export settings window
(cherry picked from commit ab4caa7953)
2016-04-29 07:43:23 +02:00
3a3f56689e More precise InputMap Axis descriptions in project settings.
Now it's "Left Stick {Up, Down, Left, Right}" instead of just "Left Stick" repeated 4x.

(cherry picked from commit 418049b741)
2016-04-29 07:43:16 +02:00
35e05b092c Partial documentation for Polygon2D and Raycast2D (#4467)
(cherry picked from commit 9f29b4b26a)
2016-04-29 07:43:09 +02:00
238bbb6539 Classref: Document Button and ButtonArray
Also bind relevant constants and define some object types and better
argument names for the docs.

(cherry picked from commit 3a4ec88b37)
2016-04-29 07:42:59 +02:00
946ef8d478 GridContainer, CheckBox documentation, descriptions for Vector2 and CenterContainer.set_use_top_left
(cherry picked from commit a5b4c1d64f)
2016-04-29 07:42:48 +02:00
d3ee8de754 fix - HTTPClient connection keep-alive duplicate Headers #4208
(cherry picked from commit 6ad226ac38)
2016-04-29 07:42:40 +02:00
517518ae9a Added scroll lines, issue 4243
(cherry picked from commit 54244e0e1d)
2016-04-29 07:42:08 +02:00
084ce221d7 NACL removal: fix leftover 2016-04-27 23:17:18 +02:00
e38666b76a fixed some mistakes in WeakRef documentation
(cherry picked from commit e301ca3544)
2016-04-27 20:19:52 +02:00
6f76eca883 Documented WeakRef and member functions
(cherry picked from commit edff81c214)
2016-04-27 20:19:46 +02:00
d183a5361f Documented Node2D
(cherry picked from commit 87aa128228)
2016-04-27 20:19:37 +02:00
11aa0d1405 Various improvements to doc_status.py
- Make comments opt-in (smaller table in width)
- Reduce length of Brief Description and Description (also smaller table as output)
- Make names cyan (blue is too dark on black terminal)
- Drop some redundant synonyms for the flags

(cherry picked from commit 034d6e811f)
2016-04-27 20:19:30 +02:00
6efe8818a7 Edited classes.xml : GraphEdit finished (#4450)
(cherry picked from commit 81e405545b)
2016-04-27 20:19:20 +02:00
9023a84a93 Remove last NACL references
(cherry picked from commit d3811b490d)
2016-04-27 20:19:12 +02:00
1bd2145e34 Drop NACL platform
It's no longer maintained and Chrome-specific, so it's not a viable solution
to deploy Godot games in browsers. The current prefered alternative is asm.js
(platform/javascript), and we're looking forward to WebAssembly.

(cherry picked from commit ec606f94dc)
2016-04-27 20:18:59 +02:00
382a8250ba Drop obsolete WIP for Flash platform
It was apparently never fully functional and has not been maintained.
Flash itself is nowadays clearly a deprecated technology, so there will
not be further work on it. platform/javascript and the upcoming
WebAssembly technologies should have a brighter future.

(cherry picked from commit f368d380e7)
2016-04-27 20:17:37 +02:00
73296a9a6d Trim trailing white space on save, issue 4383
(cherry picked from commit f3e6569e00)
2016-04-27 20:17:25 +02:00
93b1f60ca2 Encode axis_value in Variant for InputEvent::JOYSTICK_MOTION.
Fixes a bug that caused InputMap actions which have been set to joystick axes
not to work correctly on exported builds as the axis_value property wouldn't be serialized into engine.cfb.
See recent discussion in #49 (Post 121+)

(cherry picked from commit 9201b5a27c)
2016-04-27 20:17:13 +02:00
7f4387d21e Fix continious update with Camera2D
Closes #4406

(cherry picked from commit b2e0cedbf0)
2016-04-27 20:17:07 +02:00
c0748bad06 Add a python script to check the current doc status
(cherry picked from commit c9340cdcc6)
2016-04-27 20:17:00 +02:00
94b321822d add sign comparison for joystick axis events in InputMap::_find_event
fixes #4400

(cherry picked from commit 3b12f9ea82)
2016-04-27 20:16:51 +02:00
c523749662 Fix Camera2D ignoring zoom when checking limits
Closes #1912

(cherry picked from commit 7a8aea0be9)
2016-04-27 20:16:08 +02:00
0f47311610 Add fallback to legacy KeyboardEvent in web export
Fallback to KeyboardEvent property `charCode` is absence of both `key`
and `char` for retrieval of unicode value.

(cherry picked from commit 45b90f16ca)
2016-04-27 20:16:01 +02:00
4c358b7043 Add preview of the Camera2D's screen boundaries
Closes #3365

(cherry picked from commit e7f66a88d6)
2016-04-27 20:15:46 +02:00
98b30e3aff Reimplement key input events in Emscripten export
Scancodes work, but unicode values are now completely broken in some
browser/OS combinations.

(cherry picked from commit 0e9eefb7d4)
2016-04-27 19:42:31 +02:00
9f5c6cf950 remove unused resources and add korean locale for android
- remove unused resources in platform/android/java/res/values/strings.xml
- add korean language resource for apk expansion download screen

(cherry picked from commit e94e710893)
2016-04-27 19:42:22 +02:00
07fc330241 Fixed zero-length arrays in nrex. Fixes #4346
(cherry picked from commit 48b2dfab9f)
2016-04-27 08:50:36 +02:00
c712e54b63 tiny fix to loop restart (#4358)
Closes #4355
(cherry picked from commit e566b17f91)
2016-04-27 08:50:28 +02:00
6a2efc48c5 Fix 'Quit to Project Manager' not stopping the running application
(cherry picked from commit e48c07750f)
2016-04-27 08:50:09 +02:00
ff1d370b9f Fix File.get_csv_line not including quoted newlines in the output
Close #1232

(cherry picked from commit 7a18bb8ace)
2016-04-27 08:50:03 +02:00
e654184888 Always set default clear color
(cherry picked from commit 0ee8b74101)
2016-04-27 08:49:56 +02:00
cabb80ecf4 Add openssl=builtin to build command in .travis.yml
(cherry picked from commit 1db2759f5e)
2016-04-27 08:49:45 +02:00
3efa0f130d Update OpenSSL to version 1.0.2g
(cherry picked from commit e97922f220)
2016-04-27 08:49:39 +02:00
47c7b535d2 BoneAttachments now position themselves instantly during bind.
(cherry picked from commit bc5ee6c98f)
2016-04-27 08:49:30 +02:00
5fac497aa2 Fixed curve baking, now always start at origin point
(cherry picked from commit 08b93da28a)
2016-04-27 08:49:23 +02:00
4bfcd14a6a correct typo "overwrite"
(cherry picked from commit 86c6326057)
2016-04-27 08:48:43 +02:00
dbcf969fbf Keep editable instances data when replacing tree root node
(cherry picked from commit 3029f5ee02)
2016-04-27 08:48:34 +02:00
52bf4a76b2 x11: Flush the X output buffer after changing mouse mode
(cherry picked from commit 5907a007dc)
2016-04-27 08:48:23 +02:00
f32a4dc516 Made trackpad behaviour optional in 3D mode (issue #4265)
(cherry picked from commit 84d706cb35)
2016-04-27 08:44:40 +02:00
a0b6645858 Fixed #4163 (intersect_shape crashes on results limit)
(cherry picked from commit d239e6bc0e)
2016-04-27 08:44:31 +02:00
b24c3be564 Update OpenSSL to version 1.0.1s
(cherry picked from commit c860574d8b
and commit 2cbd850979)
2016-04-27 08:43:39 +02:00
b2b5c495e1 Subclasses can now extend from other subclasses contained in scripts derived from relative paths.
(cherry picked from commit d643a40f95)
2016-04-27 08:42:48 +02:00
e367c6cdd8 Fixed undo redo interaction with find replace
(cherry picked from commit 189b306722)
2016-04-27 08:42:23 +02:00
b5a438413a Setting to change line number color
(cherry picked from commit 8c328474f2)
2016-04-27 08:42:18 +02:00
f4ebba513a Updated nrex to v0.2
* Fixed capturing groups matching to invalid results
 * Fixed parents of recursive quantifiers not expanding properly
 * Fixed LookAhead sometimes adding to result

(cherry picked from commit 6207d56b95)
2016-04-27 08:42:12 +02:00
40d21117f9 Fix RayCast not updating when debugging collissions
(cherry picked from commit 6cf3bdcf76)
2016-04-27 08:42:01 +02:00
e120e2265b CanvasItemEditorPlugin: Avoid selecting items from instanced scenes
- This behaviour is only applied to click selection. Rect selection and List selection can still select these items

(cherry picked from commit fab57f2fbc)
2016-04-27 08:41:51 +02:00
8746966194 Doc: fix type of stream object
(cherry picked from commit 7820e590ea)
2016-04-27 08:40:49 +02:00
76eeb457d3 Fix warn print when hide an control does not inside_tree
(cherry picked from commit 5ec7d3f264)
2016-04-27 08:40:38 +02:00
02afea1e4e Fix crash when tween control object previous freed
(cherry picked from commit da28a2f062)
2016-04-27 08:40:19 +02:00
692878b7f4 Fix Ctrl+LaunchMedia showing up as a shortcut for "Make Bones"
Close #4044

(cherry picked from commit 4af1839073)
2016-04-27 08:38:28 +02:00
b7f5418f8d Ability to change the caret color
(cherry picked from commit c7519f091d)
2016-04-27 08:37:20 +02:00
d4d810faac dictionary has_all
(cherry picked from commit a8ebd43ab7)
2016-04-27 08:36:08 +02:00
3a390e9b44 Update vector.h
using non-templated neares_power_of_2
2016-04-11 03:34:10 -03:00
5d63f4e758 Sync classref with source 2016-04-07 21:30:22 +02:00
cbac9a2ca3 Remove duplicate
(cherry picked from commit 473de561f8)
2016-04-07 21:28:28 +02:00
837d50714a Version 2.0.2 2016-04-07 08:34:27 +02:00
bb6cfc130b Option to toggle syntax highlighting
(cherry picked from commit d78e98e2a4)
2016-04-06 19:39:36 +02:00
b3891246e5 Fixed block indent inconsistency, fixes issue 3803
(cherry picked from commit 93700676b5)
2016-04-06 19:39:30 +02:00
00566a8592 Revert "free Material 'shadow_material_double_sided' on ::finish()"
This reverts commit 43c74056b1.
2016-04-06 19:37:16 +02:00
63e33cfdd2 Add a sleeping_state_changed signal to RigidBody and RigidBody2D classes
Closes #3911

(cherry picked from commit 6dcd1354c2)
2016-04-06 18:49:51 +02:00
dea6671d58 Bind Z key (without modifiers) to toggle wireframe in 3D view
Fixed #4124

(cherry picked from commit 8ee8802cbe)
2016-04-06 18:49:26 +02:00
7c6d2e7062 Fixed text edit undo and redo operation interaction
(cherry picked from commit 646e089782)
2016-04-06 18:48:31 +02:00
eb927383f2 Fixes errors occurring when switching to a new scene with a spatial editor from a canvas editor.
(cherry picked from commit f303e3483d)
2016-04-06 18:48:25 +02:00
5c98674a8b Added rotation/panning support for trackpads in 3D mode #53
(cherry picked from commit 3ebde34d8f)
2016-04-06 18:48:05 +02:00
4bde902de1 Fixed 'complex' typo in method name
(cherry picked from commit 971c3be52d)
2016-04-06 18:47:34 +02:00
a5f07d18ec Fixed undoing twice when removing selection
(cherry picked from commit 15f43149e1)
2016-04-06 18:47:28 +02:00
71da9a1a23 Separate help pages from scripts by default
Fixes #4199
(cherry picked from commit 9c89d3e042)
2016-04-06 18:47:22 +02:00
44daccc861 Change toggle comment behaviour. Fixes #4198
(cherry picked from commit 1b6f14d810)
2016-04-06 18:47:18 +02:00
MSC
4220ffbd8e memdelete 'joy_thread' + 'joy_mutex' on ::~joystick_linux()
(cherry picked from commit 391095e0ef)
2016-04-06 18:46:53 +02:00
MSC
43c74056b1 free Material 'shadow_material_double_sided' on ::finish()
(cherry picked from commit 7a9998370f)
2016-04-06 18:46:46 +02:00
48438e4f3b Fixed insert mode interaction with auto complete
(cherry picked from commit a984adb5a6)
2016-04-06 18:46:36 +02:00
5f901e2b27 Fixed insert mode removing first unselected character
(cherry picked from commit fe779d4386)
2016-04-06 18:46:32 +02:00
22ef9673dd Added insert mode to text editor
(cherry picked from commit 2b57cb94da)
2016-04-06 18:45:56 +02:00
5b1aa3a5cd Progress bar minsize now checks percent_visible
Allows for really thin progress bars such as for pixel-art styles.

(cherry picked from commit 0bba09c4cb)
2016-04-06 18:45:33 +02:00
f06f574735 Fix building against 2.0 API
812de22 used a method from the new plugin API in master,
so it failed building.
2016-04-02 23:11:38 +02:00
aac3b9db5c Add support for gnu-libstc++-4.9 needed by recent NDK versions
The 4.9 version is the default one, people can still build using 4.8
with older NDK versions by setting the (optional) NDK_TARGET
and NDK_TARGET_X86 environment variables.

(cherry picked from commit a0fb5b5f95)
2016-04-02 23:05:18 +02:00
9fdc1279cc Make hardcoded Mac version 2.0.x
To avoid having to bump it up every time.
2016-04-02 22:22:38 +02:00
01471e4c09 Function syntax highlighting
(cherry picked from commit 50aa78210c)
2016-04-02 22:19:54 +02:00
bac8248316 Remove trailing spaces
(cherry picked from commit 0a5472e697)
2016-04-02 22:19:40 +02:00
69e67d51c7 Port 2D demos to TSCN/TRES formats
Part of #4196.

(cherry picked from commit 23cf6a85bd)
2016-04-02 22:19:30 +02:00
c6ccd05fed Fix last two bindings in input_mapping demo
Also connect the signal from script, as it makes it easier to understand
than by having to check the connected signals via the GUI.

(cherry picked from commit 4eb49cc732)
2016-04-02 22:15:58 +02:00
937a96b26b Option to toggle line numbers
(cherry picked from commit 474911c533)
2016-04-02 22:15:38 +02:00
a52b1e866d inherit PKG_CONFIG_PATH from environment
(cherry picked from commit 32391ffd73)
2016-04-02 22:15:32 +02:00
fed11a662a doc/base/classes.xml: String.match, Node.find_node
Clarify wildcard behavior.

(cherry picked from commit ef08fed277)
2016-04-02 22:15:20 +02:00
26f2b7415c Fixed numbers not highlighting after space
(cherry picked from commit cd07badee3)
2016-04-02 22:15:11 +02:00
729dc5da83 Stopped save scene flicker, issue 4118
(cherry picked from commit 9d74b76a69)
2016-04-02 22:15:06 +02:00
54625bb771 Fix GDScript crash when call show/hide in func _exit_tree
(cherry picked from commit 0c6f089ce4)
2016-04-02 22:14:49 +02:00
523625a3d1 Syntax highlighting for numbers
(cherry picked from commit c844c2d604)
2016-04-02 22:14:27 +02:00
5caf6ad8b9 Expose android/shutdown_adb_on_exit parameter and default to true
It was added in 30d0ca9 for the Steam build but only enabled
when parsing a ._sc_ file that would define it.
It is now available for all users to toggle, in and outside of Steam.

Fixes #4073.

(cherry picked from commit c584940387)
2016-04-02 22:14:20 +02:00
7ddc17b18e BoxContainer: Bind method add_spacer(bool)
(cherry picked from commit 0571f961a8)
2016-04-02 22:13:58 +02:00
cf0a586a3e TextEdit: Fix Shift+Delete shortcut not calling cut()
(cherry picked from commit abb720438f)
2016-04-02 22:13:26 +02:00
41cc4ffe98 Fixes #3942 - Throws an error when exporting for X11 with no filename
(cherry picked from commit fb58bafc54)
2016-04-02 22:13:14 +02:00
0ea354c12a Fix issues with tilemap covering child nodes and old quadrants
Closes #4070

(cherry picked from commit 2a581835ca)
2016-04-02 22:12:53 +02:00
2bc4049b9b Fix for #4014, changed to 2 instead of 3 chars to trigger search
(cherry picked from commit 4e59d1c51f)
2016-04-02 22:12:41 +02:00
64a8fe6ad7 Option to toggle tab drawing
(cherry picked from commit 0fc7be89d3)
2016-04-02 22:12:29 +02:00
05c620b7ad Add -r flag to adb install for keep app user data
(cherry picked from commit 9e026fecef)
2016-04-02 22:12:12 +02:00
ca1ca6c7df Fix cursor getting locked on tree control if tree is cleared while modifying numerical element.
(cherry picked from commit 44fe74bfc3)
2016-04-02 22:12:02 +02:00
1369b38d85 Fixed highlighting when word occurs as substring first
(cherry picked from commit 9c0e1524e5)
2016-04-02 22:11:37 +02:00
68b7f9d87a Fixed highliting with shift and mouse
(cherry picked from commit 4cc3fbeaff)
2016-04-02 22:11:30 +02:00
8a78112e5b Highlight all occurrences of selected word
(cherry picked from commit b0488cacf2)
2016-04-02 22:10:41 +02:00
41326781d2 Fix editors panels, of the bottom panel, not resizing in some cases
(cherry picked from commit 4a0f835ece)
2016-04-02 22:10:31 +02:00
cacf7d136f LineEdit/TextEdit: Add Shift+Delete shortcut for cut
(cherry picked from commit fac027cb14)
2016-04-02 22:10:20 +02:00
a701c6ff68 TextEdit: Fix inconsistent copy, cut and paste behaviour
(cherry picked from commit 4dfd0c1863)
2016-04-02 22:10:15 +02:00
812de22194 Fix file dialog, of Particles2D plugin, showing "Error" icons
(cherry picked from commit 8d2a957e36)
2016-04-02 22:09:33 +02:00
8de0405032 Automatically create input node when creating a ShaderGraph
(cherry picked from commit 5ee67ba498)
2016-04-02 22:09:26 +02:00
e59c0610ca Fix crash when importing sub-scenes
(cherry picked from commit cb7db2d430)
2016-04-02 22:09:01 +02:00
8fd4c78caf Added configuable tab size
(cherry picked from commit 9234bd3ff9)
2016-04-02 22:08:41 +02:00
85820434de Correct spot light size conversion in Blender exporter.
The collada falloff angle is the angle from the center of the spot
light projection, whereas Blender's point light size is the angle from
one side to the opposite, meaning it's twice as much.

(cherry picked from commit 1f4a214987)
2016-04-02 22:08:23 +02:00
d0151daa69 Undo and redo commands on text editor now affect internal version which fixes inconsistent file saving validation.
(cherry picked from commit b2e471fd7c)
2016-04-02 22:07:40 +02:00
763b29ed18 Remove redundant buttons
Now the Load button is alone on its line,
we probably need to find it a better place.

(cherry picked from commit d36333b648)
2016-04-02 22:06:37 +02:00
1d096471dc Add stop and delete buttons to sample library
Based on the work by @rdcklinux in #3339.
The play button becomes a stop button while playing.
A delete button is added in the last column.

(cherry picked from commit 533b9b7342)
2016-04-02 22:06:30 +02:00
7c44cbee67 Fix link error when disable_3d=yes
(cherry picked from commit a638af886e)
2016-04-02 22:05:49 +02:00
d950a13c10 TileSet Export: Avoid invalid error when merge is enabled but file does not exist
(cherry picked from commit 897b33ce77)
2016-04-02 22:05:36 +02:00
6ce273b329 Fix crash when resizing ConcavePolygonShape2D segments
(cherry picked from commit 3fc16d4025)
2016-04-02 22:04:41 +02:00
0635a639e9 TimeScale node: return +inf remaining for 0 scale.
(cherry picked from commit 65b7791263)
2016-04-02 22:04:35 +02:00
424a104666 remove trailing whitespace
(cherry picked from commit 4a4f247914)
2016-04-02 22:03:48 +02:00
830947feaf AnimationTreePlayer: distinguish value tracks.
If the node had a 3D Transform, the transform would always get written,
even if the tracks on that node were supposed to be value tracks.

(cherry picked from commit 2fa200ff53)
2016-04-02 22:00:40 +02:00
ee20365f7c Variant::blend: add Quat, fix Vector3.
(cherry picked from commit f7fad32188)
2016-04-02 22:00:18 +02:00
0a24f562fb Update version in Info.plist
Getting info on Godot.app still shows version 1.0.0.  Would be nice to have this reflect the real version number via the build system.
(cherry picked from commit 3d9e26bfce)
2016-04-02 21:59:49 +02:00
60e4cfbcb7 TimeScale node: scale return value (time remaining).
(cherry picked from commit 2e1b1234a3)
2016-04-02 21:59:07 +02:00
656aa0a501 fix InputMap::action_erase_event()
fixes #3976

(cherry picked from commit 9544042adb)
2016-04-02 21:58:26 +02:00
7ad50eaea8 This will disable png arm neon optimizing for android template if compile on windows, but make compiling successful.
And arm neon opt is enabled if not on windows.

(cherry picked from commit db89a47e28)
2016-04-02 21:58:09 +02:00
83887ae16d migrate to container-based Travis CI
(cherry picked from commit 1f83ae9b5a)
2016-04-02 21:57:38 +02:00
827f4a895a osx: fix inverted horizontal scrolling
(cherry picked from commit 02eddbf7da)
2016-04-02 21:57:26 +02:00
da356eca0f Enabled scrolling past end of file
(cherry picked from commit f19eea2f2d)
2016-04-02 21:57:10 +02:00
53aa9cd51a Release 2.0.1 2016-03-06 19:05:45 +01:00
706d576f7b Add support for patch versions (2.0.x) 2016-03-06 19:05:27 +01:00
226e0a7f4f Fix Project Settings dialog add/delete global variable
(cherry picked from commit 48524384d6)
2016-03-06 18:07:42 +01:00
c44060bb82 doc: fix joystick left/right trigger axis description (index 6/7 instead of 4/5)
(cherry picked from commit 1b806ef54e)
2016-03-06 18:06:47 +01:00
4fee5f3915 Add more verbose build-in functions descriptions
Add descriptions for some global constants

(cherry picked from commit ff7c89ebaf)
2016-03-06 10:39:21 +01:00
e69c9021b5 The help page now show the entire object hierarchy
(cherry picked from commit fdd1209276)
2016-03-06 09:48:26 +01:00
edb3716da7 Fix Sprite doesn't updating region_rect value in certain conditions
(cherry picked from commit 1d188c1c7b)
2016-03-06 09:48:20 +01:00
1bdd5d24cb Removed "__editor_plugin_screen__" metadata creation
(cherry picked from commit b79e83ad6f)
2016-03-06 09:48:15 +01:00
a1a1c0b9f6 Added search box in Class List dialog (Script Editor)
(cherry picked from commit cc6a6ef08c)
2016-03-06 09:48:06 +01:00
450a7a9120 Write GDScript documentation
(cherry picked from commit cd1184d56c)
2016-03-05 15:12:24 +01:00
c850fa7331 Added relative paths for DirAccess::remove()
Follows similar behaviour to DirAccess::rename()

(cherry picked from commit d7052ddba3)
2016-03-05 13:35:48 +01:00
afd75013f9 html5: workaround for echo key events.
(cherry picked from commit 352db6b17e)
2016-03-05 13:35:36 +01:00
848c7378fd Add editor settings for call hint placement
Added settings: text_editor/put_callhint_tooltip_below_current_line
and text_editor/callhint_tooltip_offset

(cherry picked from commit 47206b409d)
2016-03-05 12:58:01 +01:00
4b2fcabb74 Hide hint if completion is active
(cherry picked from commit 26cc14e839)
2016-03-05 12:57:56 +01:00
cb7693c533 Move the call hint under the current line
(cherry picked from commit 03025f60b6)
2016-03-05 12:57:52 +01:00
7fea990b1b set_time_scale docs
This is correct?

(cherry picked from commit 6b7ec5de69)
2016-03-05 12:56:27 +01:00
95e46e6eac fix gradle build on windows
(cherry picked from commit d6cc887627)
2016-03-05 12:56:19 +01:00
bea8e1654e AnimationTreePlayer (Blend3): process all inputs.
Always call _process_node on all three inputs so that looped animations
don't get out of sync.

(cherry picked from commit b79351aa45)
2016-03-05 12:55:54 +01:00
cafcdb015d AnimationTreePlayer: blend value tracks (closes #2299)
Variant:
- zero() sets a Variant to the appropriate type of zero value
- blend() blends part of one Variant on top of another.

(cherry picked from commit 391ce81c5e)
2016-03-05 12:55:43 +01:00
459b914d9c Quick fixes to tween documentation formatting
Maybe the reST parser should be improved instead though ;)

(cherry picked from commit a12c63ef9e)
2016-03-01 08:38:23 +01:00
9ed3d21d5a Sync classes 2016-03-01 08:25:04 +01:00
82d06b0027 use joystick name from mapping-db if available 2016-03-01 08:16:27 +01:00
e0a66b6e56 deleted files added accidentally
(cherry picked from commit 96b60c281f)
2016-02-29 09:03:31 +01:00
186b82c350 Document Tween class
(cherry picked from commit 49e1cc6fa9)
2016-02-29 09:03:06 +01:00
1af2e1101d Remove grey capsule on official logo
It had been added by a contributor without prior discussion
with the rest of the team, but the grey capsule did not look
so good. Closes #3848.

Also renamed godot_{icon,logo} to just {icon,logo}.

(cherry picked from commit eb5f9ed89b)
2016-02-29 09:01:02 +01:00
a55f41e3d9 screen_shaders: convert demo images to JPG
(cherry picked from commit a97c1ca8f9)
2016-02-29 09:00:55 +01:00
439e29ea95 normalmap demo: convert images to JPG
To make the demos lighter

(cherry picked from commit 2fd177b2a5)
2016-02-29 09:00:48 +01:00
f5e8e89f50 Remove Noto Sans font from translation demo (heavy!)
(cherry picked from commit 0f087755cc)
2016-02-29 09:00:43 +01:00
f619b05751 added [presets] to ._sc_ and "android/shutdown_adb_on_exit" to editor_settings
(cherry picked from commit 30d0ca9766)
2016-02-29 09:00:35 +01:00
aa94ff6dae fix transform localization event in mouse motion
(cherry picked from commit 08e0e64a19)
2016-02-29 09:00:14 +01:00
ee5c250b63 OUYA gamepad mappings fix
Fix gamepad mappings for OUYA revision 4
2016-02-27 15:28:34 +01:00
e4d367e7a1 theora on server build 2016-02-27 15:28:22 +01:00
45a0bbe56e adds -pm and -project_manager command line options to start project manager
fixes bug where the user has an engine.cfg on the executable directory so it runs the game instead of opening the project manager
2016-02-27 15:27:33 +01:00
d86b12a397 Fixed closing a scene tab when it was not the CURRENT tab. Fixes #3810 2016-02-27 15:27:25 +01:00
f0ba9c7e78 x11: fix joysticks not recognizing some buttons
dpad on x360 pads with kernel < 4.3 is working now
2016-02-27 15:27:15 +01:00
61f17fb1bb applied some typo fixes. see godotengine/godot-docs#18 2016-02-27 15:27:10 +01:00
a43af20f31 added more Android gamepad mappings 2016-02-27 15:26:59 +01:00
7ba92ae9eb Fix typo in error 2016-02-27 15:26:27 +01:00
b05c27a27f Fix allocation bug if compiled with modern clang or gcc
* Add overflow checked intrinsic abstractions that check on overflow.
* Use them for memory allocation code.
* Use size_t type for memory allocation code to support full platform dependent width.

Fixes #3756.
2016-02-27 15:26:18 +01:00
e30cbc3b36 added a couple more Linux mappings, tweaked Ouya Linux mapping 2016-02-27 15:25:51 +01:00
6667 changed files with 420385 additions and 484067 deletions

5
.gitattributes vendored
View File

@ -1,8 +1,3 @@
# Properly detect languages on Github
*.h linguist-language=cpp
*.inc linguist-language=cpp
drivers/* linguist-vendored
*.cpp eol=lf
*.h eol=lf
*.py eol=lf

27
.gitignore vendored
View File

@ -17,10 +17,8 @@ core/global_defaults.cpp
drivers/unix/os_unix_global_settings_path.cpp
tools/editor/register_exporters.cpp
tools/editor/doc_data_compressed.h
tools/editor/certs_compressed.h
tools/editor/editor_icons.cpp
tools/editor/translations.h
tools/editor/builtin_fonts.h
-fpic
.fscache
make.bat
log.txt
@ -32,15 +30,21 @@ doc/_build/
*.bc
# Android specific
platform/android/java/build.gradle
platform/android/java/.gradle
platform/android/java/.gradletasknamecache
platform/android/java/local.properties
platform/android/java/project.properties
platform/android/java/build.gradle
platform/android/java/AndroidManifest.xml
platform/android/java/bin/*
platform/android/java/libs/*
platform/android/java/gen/*
platform/android/java/assets
platform/android/libs/apk_expansion/bin/*
platform/android/libs/apk_expansion/gen/*
platform/android/libs/google_play_services/bin/*
platform/android/libs/google_play_services/gen/*
platform/android/libs/play_licensing/bin/*
platform/android/libs/play_licensing/gen/*
# General c++ generated files
*.lib
@ -53,14 +57,12 @@ platform/android/java/assets
*.os
*.Plo
*.lo
*.Po
# Libs generated files
.deps/*
.dirstamp
# Vim temp files
*.swo
*.swp
# QT project files
*.config
@ -142,8 +144,6 @@ ipch/
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
@ -240,9 +240,6 @@ node_modules/
# KDE
.directory
#Kdevelop project files
*.kdev4
# RIA/Silverlight projects
Generated_Code/
@ -299,7 +296,3 @@ godot.creator.*
projects/
platform/windows/godot_res.res
# Visual Studio Code folder (and files) that are created
# when the C/C++ extension (https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) is used
/.vscode

View File

@ -54,7 +54,7 @@ addons:
- libglu1-mesa-dev
- libssl-dev
- libxinerama-dev
- libxrandr-dev
- libudev-dev
# For cross-compiling to Windows.
- binutils-mingw-w64-i686
@ -68,11 +68,7 @@ addons:
before_script:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install scons; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$GODOT_TARGET" = "android" ]; then
brew update; travis_wait 20 brew install -v android-sdk;
travis_wait 20 brew install -v android-ndk | grep -v "inflating:" | grep -v "creating:";
export ANDROID_HOME=/usr/local/opt/android-sdk; export ANDROID_NDK_ROOT=/usr/local/opt/android-ndk;
fi
- if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$GODOT_TARGET" = "android" ]; then brew update; brew install android-sdk android-ndk; export ANDROID_HOME=/usr/local/opt/android-sdk; export ANDROID_NDK_ROOT=/usr/local/opt/android-ndk; fi
script:
- scons platform=$GODOT_TARGET CXX=$CXX openssl=builtin

View File

@ -1,4 +1,4 @@
**Operating system or device - Godot version:**
**Operating system or device:**
**Issue description** (what happened, and what was expected):

View File

@ -3,7 +3,7 @@
************************************************************************
Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.
Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -1,66 +1,29 @@
[![GODOT](/logo.png)](https://godotengine.org)
![GODOT](/logo.png)
## Godot Engine
http://www.godotengine.org
Homepage: https://godotengine.org
### The Engine
#### 2D and 3D cross-platform game engine
Godot is a fully featured, open source, MIT licensed, game engine. It focuses on having great tools, and a visual oriented workflow that can export to PC, Mobile and Web platforms with no hassle.
The editor, language and APIs are feature rich, yet simple to learn, allowing you to become productive in a matter of hours.
Godot Engine is a feature-packed, cross-platform game engine to create 2D and
3D games from a unified interface. It provides a comprehensive set of common
tools, so that users can focus on making games without having to reinvent the
wheel. Games can be exported in one click to a number of platforms, including
the major desktop platforms (Linux, Mac OSX, Windows) as well as mobile
(Android, iOS) and web-based (HTML5) platforms.
### About
#### Free, open source and community-driven
Godot has been developed by Juan Linietsky and Ariel Manzur for several years, and was born as an in-house engine, used to publish several work-for-hire titles. Godot is a member project of the [Software Freedom Conservancy](https://sfconservancy.org)
Godot is completely free and open source under the very permissive MIT license.
No strings attached, no royalties, nothing. The users' games are theirs, down
to the last line of engine code. Godot's development is fully independent and
community-driven, empowering users to help shape their engine to match their
expectations. It is supported by the Software Freedom Conservancy
not-for-profit.
### Documentation
Before being open sourced in February 2014, Godot had been developed by Juan
Linietsky and Ariel Manzur (both still maintaining the project) for several
years as an in-house engine, used to publish several work-for-hire titles.
Documentation has been moved to [ReadTheDocs](http://docs.godotengine.org).
### Getting the engine
### Binary Downloads, Community, etc.
#### Binary downloads
Binary downloads, community, etc. can be found in Godot homepage:
Official binaries for the Godot editor and the export templates can be found
[on the homepage](https://godotengine.org/download).
http://www.godotengine.org
#### Compiling from source
### Compiling from Source
[See the official docs](http://docs.godotengine.org/en/latest/reference/_compiling.html)
for compilation instructions for every supported platform.
### Community
Godot is not only an engine but an ever-growing community of users and engine
developers. The main community channels are listed [on the homepage](https://godotengine.org/community).
To get in touch with the developers, the best way is to join the
[#godotengine IRC channel](https://webchat.freenode.net/?channels=godotengine)
on Freenode.
### Documentation and demos
The official documentation is hosted on [ReadTheDocs](http://docs.godotengine.org).
It is maintained by the Godot community in its own [GitHub repository](https://github.com/godotengine/godot-docs).
The [class reference](http://docs.godotengine.org/en/latest/classes/_classes.html)
is also accessible from within the engine.
The official demos are maintained in their own [GitHub repository](https://github.com/godotengine/godot-demo-projects)
as well.
There are also a number of other learning resources provided by the community,
such as text and video tutorials, demos, etc. Consult the [community channels](https://godotengine.org/community)
for more info.
Compilation instructions for every platform can be found in the Wiki:
http://docs.godotengine.org/en/latest/reference/_compiling.html
[![Build Status](https://travis-ci.org/godotengine/godot.svg?branch=master)](https://travis-ci.org/godotengine/godot)
[![Code Triagers Badge](http://www.codetriage.com/godotengine/godot/badges/users.svg)](http://www.codetriage.com/godotengine/godot)

View File

@ -1,7 +1,4 @@
#!/usr/bin/env python
EnsureSConsVersion(0, 14)
EnsureSConsVersion(0,14);
import string
@ -15,85 +12,87 @@ methods.update_version()
# scan possible build platforms
platform_list = [] # list of platforms
platform_opts = {} # options for each platform
platform_flags = {} # flags for each platform
platform_list = [] # list of platforms
platform_opts = {} # options for each platform
platform_flags = {} # flags for each platform
active_platforms = []
active_platform_ids = []
platform_exporters = []
global_defaults = []
active_platforms=[]
active_platform_ids=[]
platform_exporters=[]
global_defaults=[]
for x in glob.glob("platform/*"):
if (not os.path.isdir(x) or not os.path.exists(x + "/detect.py")):
continue
tmppath = "./" + x
if (not os.path.isdir(x) or not os.path.exists(x+"/detect.py")):
continue
tmppath="./"+x
sys.path.append(tmppath)
import detect
sys.path.append(tmppath)
import detect
if (os.path.exists(x + "/export/export.cpp")):
platform_exporters.append(x[9:])
if (os.path.exists(x + "/globals/global_defaults.cpp")):
global_defaults.append(x[9:])
if (detect.is_active()):
active_platforms.append(detect.get_name())
active_platform_ids.append(x)
if (detect.can_build()):
x = x.replace("platform/", "") # rest of world
x = x.replace("platform\\", "") # win32
platform_list += [x]
platform_opts[x] = detect.get_opts()
platform_flags[x] = detect.get_flags()
sys.path.remove(tmppath)
sys.modules.pop('detect')
if (os.path.exists(x+"/export/export.cpp")):
platform_exporters.append(x[9:])
if (os.path.exists(x+"/globals/global_defaults.cpp")):
global_defaults.append(x[9:])
if (detect.is_active()):
active_platforms.append( detect.get_name() )
active_platform_ids.append(x);
if (detect.can_build()):
x=x.replace("platform/","") # rest of world
x=x.replace("platform\\","") # win32
platform_list+=[x]
platform_opts[x]=detect.get_opts()
platform_flags[x]=detect.get_flags()
sys.path.remove(tmppath)
sys.modules.pop('detect')
module_list = methods.detect_modules()
module_list=methods.detect_modules()
# print "Detected Platforms: "+str(platform_list)
#print "Detected Platforms: "+str(platform_list)
methods.save_active_platforms(active_platforms, active_platform_ids)
methods.save_active_platforms(active_platforms,active_platform_ids)
custom_tools = ['default']
custom_tools=['default']
platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False))
platform_arg = ARGUMENTS.get("platform", False)
if (os.name == "posix"):
pass
elif (os.name == "nt"):
if (os.getenv("VSINSTALLDIR") == None or platform_arg == "android"):
custom_tools = ['mingw']
if (os.name=="posix"):
pass
elif (os.name=="nt"):
if (os.getenv("VSINSTALLDIR")==None or platform_arg=="android"):
custom_tools=['mingw']
env_base = Environment(tools=custom_tools)
if 'TERM' in os.environ:
env_base['ENV']['TERM'] = os.environ['TERM']
env_base.AppendENVPath('PATH', os.getenv('PATH'))
env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
env_base.global_defaults = global_defaults
env_base.android_maven_repos = []
env_base.android_dependencies = []
env_base.android_java_dirs = []
env_base.android_res_dirs = []
env_base.android_aidl_dirs = []
env_base.android_jni_dirs = []
env_base.android_default_config = []
env_base.android_manifest_chunk = ""
env_base.android_permission_chunk = ""
env_base.android_appattributes_chunk = ""
env_base.disabled_modules = []
env_base.use_ptrcall = False
env_base.split_drivers = False
env_base=Environment(
tools=custom_tools,
ENV={
'PATH' : os.getenv('PATH'),
'PKG_CONFIG_PATH' : os.getenv('PKG_CONFIG_PATH')
});
#env_base=Environment(tools=custom_tools);
env_base.global_defaults=global_defaults
env_base.android_maven_repos=[]
env_base.android_dependencies=[]
env_base.android_java_dirs=[]
env_base.android_res_dirs=[]
env_base.android_aidl_dirs=[]
env_base.android_jni_dirs=[]
env_base.android_manifest_chunk=""
env_base.android_permission_chunk=""
env_base.android_appattributes_chunk=""
env_base.disabled_modules=[]
env_base.split_drivers=False
env_base.__class__.android_add_maven_repository = methods.android_add_maven_repository
env_base.__class__.android_add_dependency = methods.android_add_dependency
env_base.__class__.android_add_java_dir = methods.android_add_java_dir
env_base.__class__.android_add_res_dir = methods.android_add_res_dir
env_base.__class__.android_add_aidl_dir = methods.android_add_aidl_dir
env_base.__class__.android_add_jni_dir = methods.android_add_jni_dir
env_base.__class__.android_add_default_config = methods.android_add_default_config
env_base.__class__.android_add_maven_repository=methods.android_add_maven_repository
env_base.__class__.android_add_dependency=methods.android_add_dependency
env_base.__class__.android_add_java_dir=methods.android_add_java_dir
env_base.__class__.android_add_res_dir=methods.android_add_res_dir
env_base.__class__.android_add_aidl_dir=methods.android_add_aidl_dir
env_base.__class__.android_add_jni_dir=methods.android_add_jni_dir
env_base.__class__.android_add_to_manifest = methods.android_add_to_manifest
env_base.__class__.android_add_to_permissions = methods.android_add_to_permissions
env_base.__class__.android_add_to_attributes = methods.android_add_to_attributes
@ -101,92 +100,76 @@ env_base.__class__.disable_module = methods.disable_module
env_base.__class__.add_source_files = methods.add_source_files
env_base.__class__.use_windows_spawn_fix = methods.use_windows_spawn_fix
env_base.__class__.split_lib = methods.split_lib
env_base["x86_libtheora_opt_gcc"] = False
env_base["x86_libtheora_opt_vc"] = False
# Build options
env_base["x86_opt_gcc"]=False
env_base["x86_opt_vc"]=False
env_base["armv7_opt_gcc"]=False
customs = ['custom.py']
profile = ARGUMENTS.get("profile", False)
if profile:
import os.path
if os.path.isfile(profile):
customs.append(profile)
elif os.path.isfile(profile + ".py"):
customs.append(profile + ".py")
opts = Variables(customs, ARGUMENTS)
# Target build options
opts.Add('arch', "Platform-dependent architecture (arm/arm64/x86/x64/mips/etc)", '')
opts.Add('bits', "Target platform bits (default/32/64/fat)", 'default')
opts.Add('p', "Platform (alias for 'platform')", '')
opts.Add('platform', "Target platform: any in " + str(platform_list), '')
opts.Add('target', "Compilation target (debug/release_debug/release)", 'debug')
opts.Add('tools', "Build the tools a.k.a. the Godot editor (yes/no)", 'yes')
# Components
opts.Add('deprecated', "Enable deprecated features (yes/no)", 'yes')
opts.Add('gdscript', "Build GDSCript support (yes/no)", 'yes')
opts.Add('minizip', "Build minizip archive support (yes/no)", 'yes')
opts.Add('xml', "XML format support for resources (yes/no)", 'yes')
# Advanced options
opts.Add('disable_3d', "Disable 3D nodes for smaller executable (yes/no)", 'no')
opts.Add('disable_advanced_gui', "Disable advance 3D gui nodes and behaviors (yes/no)", 'no')
opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')
opts.Add('unix_global_settings_path', "UNIX-specific path to system-wide settings. Currently only used for templates", '')
opts.Add('verbose', "Enable verbose output for the compilation (yes/no)", 'yes')
opts.Add('vsproj', "Generate Visual Studio Project. (yes/no)", 'no')
# Thirdparty libraries
opts.Add('builtin_freetype', "Use the builtin freetype library (yes/no)", 'yes')
opts.Add('builtin_glew', "Use the builtin glew library (yes/no)", 'yes')
opts.Add('builtin_libmpcdec', "Use the builtin libmpcdec library (yes/no)", 'yes')
opts.Add('builtin_libogg', "Use the builtin libogg library (yes/no)", 'yes')
opts.Add('builtin_libpng', "Use the builtin libpng library (yes/no)", 'yes')
opts.Add('builtin_libtheora', "Use the builtin libtheora library (yes/no)", 'yes')
opts.Add('builtin_libvorbis', "Use the builtin libvorbis library (yes/no)", 'yes')
opts.Add('builtin_libwebp', "Use the builtin libwebp library (yes/no)", 'yes')
opts.Add('builtin_openssl', "Use the builtin openssl library (yes/no)", 'yes')
opts.Add('builtin_opus', "Use the builtin opus library (yes/no)", 'yes')
# (akien) Unbundling would require work in audio_stream_speex.{cpp,h}, but since speex was
# removed in 3.0+ and this is only to preserve compatibility in 2.1, I haven't worked on it.
# Patches welcome if anyone cares :)
opts.Add('builtin_speex', "Use the builtin speex library (yes/no)", 'yes')
opts.Add('builtin_squish', "Use the builtin squish library (yes/no)", 'yes')
opts.Add('builtin_zlib', "Use the builtin zlib library (yes/no)", 'yes')
# Environment setup
opts.Add("CXX", "C++ compiler")
opts.Add("CC", "C compiler")
opts.Add("CCFLAGS", "Custom flags for the C and C++ compilers")
opts.Add("CFLAGS", "Custom flags for the C compiler")
opts.Add("LINKFLAGS", "Custom flags for the linker")
import os.path
if os.path.isfile(profile):
customs.append(profile)
elif os.path.isfile(profile+".py"):
customs.append(profile+".py")
opts=Variables(customs, ARGUMENTS)
opts.Add('target', 'Compile Target (debug/release_debug/release).', "debug")
opts.Add('bits', 'Compile Target Bits (default/32/64).', "default")
opts.Add('platform','Platform: '+str(platform_list)+'.',"")
opts.Add('p','Platform (same as platform=).',"")
opts.Add('tools','Build Tools (Including Editor): (yes/no)','yes')
opts.Add('gdscript','Build GDSCript support: (yes/no)','yes')
opts.Add('vorbis','Build Ogg Vorbis Support: (yes/no)','yes')
opts.Add('opus','Build Opus Audio Format Support: (yes/no)','yes')
opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes')
opts.Add('squish','Squish BC Texture Compression in editor (yes/no)','yes')
opts.Add('theora','Theora Video (yes/no)','yes')
opts.Add('theoralib','Theora Video (yes/no)','no')
opts.Add('freetype','Freetype support in editor','yes')
opts.Add('speex','Speex Audio (yes/no)','yes')
opts.Add('xml','XML Save/Load support (yes/no)','yes')
opts.Add('png','PNG Image loader support (yes/no)','yes')
opts.Add('jpg','JPG Image loader support (yes/no)','yes')
opts.Add('webp','WEBP Image loader support (yes/no)','yes')
opts.Add('dds','DDS Texture loader support (yes/no)','yes')
opts.Add('pvr','PVR (PowerVR) Texture loader support (yes/no)','yes')
opts.Add('etc1','etc1 Texture compression support (yes/no)','yes')
opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no')
opts.Add('musepack','Musepack Audio (yes/no)','yes')
opts.Add("CXX", "Compiler");
opts.Add("CCFLAGS", "Custom flags for the C++ compiler");
opts.Add("CFLAGS", "Custom flags for the C compiler");
opts.Add("LINKFLAGS", "Custom flags for the linker");
opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.','')
opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no')
opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '')
opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no')
# add platform specific options
for k in platform_opts.keys():
opt_list = platform_opts[k]
for o in opt_list:
opts.Add(o[0], o[1], o[2])
opt_list = platform_opts[k]
for o in opt_list:
opts.Add(o[0],o[1],o[2])
for x in module_list:
opts.Add('module_' + x + '_enabled', "Enable module '" + x + "' (yes/no)", "yes")
opts.Add('module_'+x+'_enabled', "Enable module '"+x+"'.", "yes")
opts.Update(env_base) # update environment
Help(opts.GenerateHelpText(env_base)) # generate help
opts.Update(env_base) # update environment
Help(opts.GenerateHelpText(env_base)) # generate help
# add default include paths
env_base.Append(CPPPATH=['#core', '#core/math', '#tools', '#drivers', '#'])
env_base.Append(CPPPATH=['#core','#core/math','#tools','#drivers','#'])
# configure ENV for platform
env_base.platform_exporters = platform_exporters
env_base.platform_exporters=platform_exporters
"""
sys.path.append("./platform/"+env_base["platform"])
@ -196,222 +179,246 @@ sys.path.remove("./platform/"+env_base["platform"])
sys.modules.pop('detect')
"""
if (env_base['target'] == 'debug'):
env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
if (env_base['deprecated'] != 'no'):
env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED'])
if (env_base['target']=='debug'):
env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']);
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
env_base.platforms = {}
selected_platform = ""
selected_platform =""
if env_base['platform'] != "":
selected_platform = env_base['platform']
selected_platform=env_base['platform']
elif env_base['p'] != "":
selected_platform = env_base['p']
env_base["platform"] = selected_platform
selected_platform=env_base['p']
env_base["platform"]=selected_platform
if selected_platform in platform_list:
sys.path.append("./platform/" + selected_platform)
import detect
if "create" in dir(detect):
env = detect.create(env_base)
else:
env = env_base.Clone()
sys.path.append("./platform/"+selected_platform)
import detect
if "create" in dir(detect):
env = detect.create(env_base)
else:
env = env_base.Clone()
if env['vsproj'] == "yes":
env.vs_incs = []
env.vs_srcs = []
if env['vsproj']=="yes":
env.vs_incs = []
env.vs_srcs = []
def AddToVSProject(sources):
for x in sources:
if type(x) == type(""):
fname = env.File(x).path
else:
fname = env.File(x)[0].path
pieces = fname.split(".")
if len(pieces) > 0:
basename = pieces[0]
basename = basename.replace('\\\\', '/')
env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
env.vs_incs = env.vs_incs + [basename + ".h"]
# print basename
env.AddToVSProject = AddToVSProject
def AddToVSProject( sources ):
for x in sources:
if type(x) == type(""):
fname = env.File(x).path
else:
fname = env.File(x)[0].path
pieces = fname.split(".")
if len(pieces)>0:
basename = pieces[0]
basename = basename.replace('\\\\','/')
env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
env.vs_incs = env.vs_incs + [basename + ".h"]
#print basename
env.AddToVSProject = AddToVSProject
env.extra_suffix = ""
env.extra_suffix=""
if env["extra_suffix"] != '':
env.extra_suffix += '.' + env["extra_suffix"]
if env["extra_suffix"] != '' :
env.extra_suffix += '.'+env["extra_suffix"]
CCFLAGS = env.get('CCFLAGS', '')
env['CCFLAGS'] = ''
CCFLAGS = env.get('CCFLAGS', '')
env['CCFLAGS'] = ''
env.Append(CCFLAGS=string.split(str(CCFLAGS)))
env.Append(CCFLAGS=string.split(str(CCFLAGS)))
CFLAGS = env.get('CFLAGS', '')
env['CFLAGS'] = ''
CFLAGS = env.get('CFLAGS', '')
env['CFLAGS'] = ''
env.Append(CFLAGS=string.split(str(CFLAGS)))
env.Append(CFLAGS=string.split(str(CFLAGS)))
LINKFLAGS = env.get('LINKFLAGS', '')
env['LINKFLAGS'] = ''
LINKFLAGS = env.get('LINKFLAGS', '')
env['LINKFLAGS'] = ''
env.Append(LINKFLAGS=string.split(str(LINKFLAGS)))
env.Append(LINKFLAGS=string.split(str(LINKFLAGS)))
flag_list = platform_flags[selected_platform]
for f in flag_list:
if not (f[0] in ARGUMENTS): # allow command line to override platform flags
env[f[0]] = f[1]
flag_list = platform_flags[selected_platform]
for f in flag_list:
if not (f[0] in ARGUMENTS): # allow command line to override platform flags
env[f[0]] = f[1]
# must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
detect.configure(env)
#must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
detect.configure(env)
#env['platform_libsuffix'] = env['LIBSUFFIX']
#env['platform_libsuffix'] = env['LIBSUFFIX']
suffix = "." + selected_platform
suffix="."+selected_platform
if (env["target"] == "release"):
if (env["tools"] == "yes"):
print("Tools can only be built with targets 'debug' and 'release_debug'.")
sys.exit(255)
suffix += ".opt"
if (env["target"]=="release"):
if (env["tools"]=="yes"):
print("Tools can only be built with targets 'debug' and 'release_debug'.")
sys.exit(255)
suffix+=".opt"
env.Append(CCFLAGS=['-DNDEBUG'])
elif (env["target"]=="release_debug"):
if (env["tools"]=="yes"):
suffix+=".opt.tools"
else:
suffix+=".opt.debug"
else:
if (env["tools"]=="yes"):
suffix+=".tools"
else:
suffix+=".debug"
elif (env["target"] == "release_debug"):
if (env["tools"] == "yes"):
suffix += ".opt.tools"
else:
suffix += ".opt.debug"
else:
if (env["tools"] == "yes"):
suffix += ".tools"
else:
suffix += ".debug"
if (env["bits"]=="32"):
suffix+=".32"
elif (env["bits"]=="64"):
suffix+=".64"
if env["arch"] != "":
suffix += "." + env["arch"]
elif (env["bits"] == "32"):
suffix += ".32"
elif (env["bits"] == "64"):
suffix += ".64"
elif (env["bits"] == "fat"):
suffix += ".fat"
suffix+=env.extra_suffix
suffix += env.extra_suffix
env["PROGSUFFIX"]=suffix+env["PROGSUFFIX"]
env["OBJSUFFIX"]=suffix+env["OBJSUFFIX"]
env["LIBSUFFIX"]=suffix+env["LIBSUFFIX"]
env["SHLIBSUFFIX"]=suffix+env["SHLIBSUFFIX"]
env["PROGSUFFIX"] = suffix + env["PROGSUFFIX"]
env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"]
env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"]
env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"]
sys.path.remove("./platform/"+selected_platform)
sys.modules.pop('detect')
sys.path.remove("./platform/" + selected_platform)
sys.modules.pop('detect')
env.module_list = []
env.module_list=[]
for x in module_list:
if env['module_' + x + '_enabled'] != "yes":
continue
tmppath = "./modules/" + x
sys.path.append(tmppath)
env.current_module = x
import config
if (config.can_build(selected_platform)):
config.configure(env)
env.module_list.append(x)
sys.path.remove(tmppath)
sys.modules.pop('config')
for x in module_list:
if env['module_'+x+'_enabled'] != "yes":
continue
tmppath="./modules/"+x
sys.path.append(tmppath)
env.current_module=x
import config
if (config.can_build(selected_platform)):
config.configure(env)
env.module_list.append(x)
sys.path.remove(tmppath)
sys.modules.pop('config')
if (env.use_ptrcall):
env.Append(CPPFLAGS=['-DPTRCALL_ENABLED'])
# to test 64 bits compiltion
# env.Append(CPPFLAGS=['-m64'])
if (env['musepack']=='yes'):
env.Append(CPPFLAGS=['-DMUSEPACK_ENABLED']);
if (env['tools'] == 'yes'):
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
if (env['disable_3d'] == 'yes'):
env.Append(CPPFLAGS=['-D_3D_DISABLED'])
if (env['gdscript'] == 'yes'):
env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
if (env['disable_advanced_gui'] == 'yes'):
env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
#if (env['openssl']!='no'):
# env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
# if (env['openssl']=="builtin"):
# env.Append(CPPPATH=['#drivers/builtin_openssl2'])
if (env['minizip'] == 'yes'):
env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
if (env["builtin_zlib"]=='yes'):
env.Append(CPPPATH=['#drivers/builtin_zlib/zlib'])
if (env['xml'] == 'yes'):
env.Append(CPPFLAGS=['-DXML_ENABLED'])
# to test 64 bits compiltion
# env.Append(CPPFLAGS=['-m64'])
if (env['verbose'] == 'no'):
methods.no_verbose(sys, env)
if (env_base['squish']=='yes'):
env.Append(CPPFLAGS=['-DSQUISH_ENABLED']);
Export('env')
if (env['vorbis']=='yes'):
env.Append(CPPFLAGS=['-DVORBIS_ENABLED']);
if (env['opus']=='yes'):
env.Append(CPPFLAGS=['-DOPUS_ENABLED']);
# build subdirs, the build order is dependent on link order.
SConscript("core/SCsub")
SConscript("servers/SCsub")
SConscript("scene/SCsub")
SConscript("tools/SCsub")
SConscript("drivers/SCsub")
if (env['theora']=='yes'):
env['theoralib']='yes'
env.Append(CPPFLAGS=['-DTHEORA_ENABLED']);
if (env['theoralib']=='yes'):
env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']);
SConscript("modules/SCsub")
SConscript("main/SCsub")
if (env['png']=='yes'):
env.Append(CPPFLAGS=['-DPNG_ENABLED']);
if (env['dds']=='yes'):
env.Append(CPPFLAGS=['-DDDS_ENABLED']);
if (env['pvr']=='yes'):
env.Append(CPPFLAGS=['-DPVR_ENABLED']);
if (env['jpg']=='yes'):
env.Append(CPPFLAGS=['-DJPG_ENABLED']);
if (env['webp']=='yes'):
env.Append(CPPFLAGS=['-DWEBP_ENABLED']);
SConscript("platform/" + selected_platform + "/SCsub") # build selected platform
if (env['speex']=='yes'):
env.Append(CPPFLAGS=['-DSPEEX_ENABLED']);
# Microsoft Visual Studio Project Generation
if (env['vsproj']) == "yes":
if (env['tools']=='yes'):
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
if (env['disable_3d']=='yes'):
env.Append(CPPFLAGS=['-D_3D_DISABLED'])
if (env['gdscript']=='yes'):
env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
if (env['disable_advanced_gui']=='yes'):
env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
AddToVSProject(env.core_sources)
AddToVSProject(env.main_sources)
AddToVSProject(env.modules_sources)
AddToVSProject(env.scene_sources)
AddToVSProject(env.servers_sources)
AddToVSProject(env.tool_sources)
if (env['minizip'] == 'yes'):
env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
# this env flag won't work, it needs to be set in env_base=Environment(MSVC_VERSION='9.0')
# Even then, SCons still seems to ignore it and builds with the latest MSVC...
# That said, it's not needed to be set so far but I'm leaving it here so that this comment
# has a purpose.
# env['MSVS_VERSION']='9.0'
if (env['xml']=='yes'):
env.Append(CPPFLAGS=['-DXML_ENABLED'])
# Calls a CMD with /C(lose) and /V(delayed environment variable expansion) options.
# And runs vcvarsall bat for the propper arhitecture and scons for propper configuration
env['MSVSBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! -j2'
env['MSVSREBUILDCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) & call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons platform=windows target=$(Configuration) tools=!tools! vsproj=yes -j2'
env['MSVSCLEANCOM'] = 'cmd /V /C set "plat=$(PlatformTarget)" ^& (if "$(PlatformTarget)"=="x64" (set "plat=x86_amd64")) ^& set "tools=yes" ^& (if "$(Configuration)"=="release" (set "tools=no")) ^& call "$(VCInstallDir)vcvarsall.bat" !plat! ^& scons --clean platform=windows target=$(Configuration) tools=!tools! -j2'
if (env['colored']=='yes'):
methods.colored(sys,env)
# This version information (Win32, x64, Debug, Release, Release_Debug seems to be
# required for Visual Studio to understand that it needs to generate an NMAKE
# project. Do not modify without knowing what you are doing.
debug_variants = ['debug|Win32'] + ['debug|x64']
release_variants = ['release|Win32'] + ['release|x64']
release_debug_variants = ['release_debug|Win32'] + ['release_debug|x64']
variants = debug_variants + release_variants + release_debug_variants
debug_targets = ['bin\\godot.windows.tools.32.exe'] + ['bin\\godot.windows.tools.64.exe']
release_targets = ['bin\\godot.windows.opt.32.exe'] + ['bin\\godot.windows.opt.64.exe']
release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe'] + ['bin\\godot.windows.opt.tools.64.exe']
targets = debug_targets + release_targets + release_debug_targets
msvproj = env.MSVSProject(target=['#godot' + env['MSVSPROJECTSUFFIX']],
incs=env.vs_incs,
srcs=env.vs_srcs,
runfile=targets,
buildtarget=targets,
auto_build_solution=1,
variant=variants)
if (env['etc1']=='yes'):
env.Append(CPPFLAGS=['-DETC1_ENABLED'])
Export('env')
#build subdirs, the build order is dependent on link order.
SConscript("core/SCsub")
SConscript("servers/SCsub")
SConscript("scene/SCsub")
SConscript("tools/SCsub")
SConscript("drivers/SCsub")
SConscript("bin/SCsub")
SConscript("modules/SCsub")
SConscript("main/SCsub")
SConscript("platform/"+selected_platform+"/SCsub"); # build selected platform
# Microsoft Visual Studio Project Generation
if (env['vsproj'])=="yes":
AddToVSProject(env.core_sources)
AddToVSProject(env.main_sources)
AddToVSProject(env.modules_sources)
AddToVSProject(env.scene_sources)
AddToVSProject(env.servers_sources)
AddToVSProject(env.tool_sources)
#env['MSVS_VERSION']='9.0'
env['MSVSBUILDCOM'] = "scons platform=" + selected_platform + " target=" + env["target"] + " bits=" + env["bits"] + " tools=yes"
env['MSVSREBUILDCOM'] = "scons platform=" + selected_platform + " target=" + env["target"] + " bits=" + env["bits"] + " tools=yes vsproj=true"
env['MSVSCLEANCOM'] = "scons --clean platform=" + selected_platform + " target=" + env["target"] + " bits=" + env["bits"] + " tools=yes"
debug_variants = ['Debug|Win32']+['Debug|x64']
release_variants = ['Release|Win32']+['Release|x64']
release_debug_variants = ['Release_Debug|Win32']+['Release_Debug|x64']
variants = debug_variants + release_variants + release_debug_variants
debug_targets = ['Debug']+['Debug']
release_targets = ['Release']+['Release']
release_debug_targets = ['ReleaseDebug']+['ReleaseDebug']
targets = debug_targets + release_targets + release_debug_targets
msvproj = env.MSVSProject(target = ['#godot' + env['MSVSPROJECTSUFFIX'] ],
incs = env.vs_incs,
srcs = env.vs_srcs,
runfile = targets,
buildtarget = targets,
auto_build_solution=1,
variant = variants)
else:
print("No valid target platform selected.")
print("The following were detected:")
for x in platform_list:
print("\t" + x)
print("\nPlease run scons again with argument: platform=<string>")
print("No valid target platform selected.")
print("The following were detected:")
for x in platform_list:
print("\t"+x)
print("\nPlease run scons again with argument: platform=<string>")

4
bin/SCsub Normal file
View File

@ -0,0 +1,4 @@
Import('env')
Export('env')
SConscript('tests/SCsub');

12
bin/tests/SCsub Normal file
View File

@ -0,0 +1,12 @@
Import('env')
env.tests_sources=[]
env.add_source_files(env.tests_sources,"*.cpp")
Export('env')
#SConscript('math/SCsub');
lib = env.Library("tests",env.tests_sources)
env.Prepend(LIBS=[lib])

View File

@ -487,12 +487,12 @@ static String _disassemble_addr(const Ref<GDScript>& p_script,const GDFunction&
static void _disassemble_class(const Ref<GDScript>& p_class,const Vector<String>& p_code) {
const Map<StringName,GDFunction*>& mf = p_class->debug_get_member_functions();
const Map<StringName,GDFunction>& mf = p_class->debug_get_member_functions();
for(const Map<StringName,GDFunction*>::Element *E=mf.front();E;E=E->next()) {
for(const Map<StringName,GDFunction>::Element *E=mf.front();E;E=E->next()) {
const GDFunction &func=*E->get();
const GDFunction &func=E->get();
const int *code = func.get_code();
int codelen=func.get_code_size();
String defargs;

View File

@ -40,9 +40,6 @@
#include "scene/resources/texture.h"
#include "vmap.h"
#include "os/os.h"
#include "method_ptrcall.h"
namespace TestMath {
@ -108,13 +105,8 @@ uint32_t ihash3( uint32_t a)
return a;
}
MainLoop* test() {
print_line(itos(Math::step_decimals( 0.0001 )));
return NULL;
{
@ -126,7 +118,10 @@ MainLoop* test() {
for (List<StringName>::Element *E=tl.front();E;E=E->next()) {
Vector<uint8_t> m5b = E->get().operator String().md5_buffer();
uint32_t *ub = (uint32_t*)m5b.ptr();
//hashes.push_back(ihash(ihash2(ihash3(*ub))));
hashes.push_back(hashes.size());
//hashes.push_back(E->get().hash());
}

View File

@ -53,4 +53,4 @@ void test() {
}
#endif
#endif

View File

@ -32,7 +32,6 @@
#include <stdio.h>
#include "os/os.h"
#include "drivers/nrex/regex.h"
#include "core/io/ip_address.h"
#include "test_string.h"
@ -844,62 +843,6 @@ bool test_28() {
return state;
}
bool test_29() {
bool error = false;
bool state = true;
bool success = false;
IP_Address ip0("2001:0db8:85a3:0000:0000:8a2e:0370:7334");
OS::get_singleton()->print("ip0 is %ls\n", String(ip0).c_str());
IP_Address ip(0x0123, 0x4567, 0x89ab, 0xcdef, true);
OS::get_singleton()->print("ip6 is %ls\n", String(ip).c_str());
IP_Address ip2("fe80::52e5:49ff:fe93:1baf");
OS::get_singleton()->print("ip6 is %ls\n", String(ip2).c_str());
IP_Address ip3("::ffff:192.168.0.1");
OS::get_singleton()->print("ip6 is %ls\n", String(ip3).c_str());
String ip4 = "192.168.0.1";
success = ip4.is_valid_ip_address();
OS::get_singleton()->print("Is valid ipv4: %ls, %s\n", ip4.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
ip4 = "192.368.0.1";
success = (!ip4.is_valid_ip_address());
OS::get_singleton()->print("Is invalid ipv4: %ls, %s\n", ip4.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
String ip6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
success = ip6.is_valid_ip_address();
OS::get_singleton()->print("Is valid ipv6: %ls, %s\n", ip6.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
ip6 = "2001:0db8:85j3:0000:0000:8a2e:0370:7334";
success = (!ip6.is_valid_ip_address());
OS::get_singleton()->print("Is invalid ipv6: %ls, %s\n", ip6.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
ip6 = "2001:0db8:85f345:0000:0000:8a2e:0370:7334";
success = (!ip6.is_valid_ip_address());
OS::get_singleton()->print("Is invalid ipv6: %ls, %s\n", ip6.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
ip6 = "2001:0db8::0:8a2e:370:7334";
success = (ip6.is_valid_ip_address());
OS::get_singleton()->print("Is valid ipv6: %ls, %s\n", ip6.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
ip6 = "::ffff:192.168.0.1";
success = (ip6.is_valid_ip_address());
OS::get_singleton()->print("Is valid ipv6: %ls, %s\n", ip6.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
return state;
};
typedef bool (*TestFunc)(void);
TestFunc test_funcs[] = {
@ -932,7 +875,6 @@ TestFunc test_funcs[] = {
test_26,
test_27,
test_28,
test_29,
0
};

View File

@ -1,67 +1,65 @@
#!/usr/bin/env python
Import('env')
env.core_sources = []
env.core_sources=[]
gd_call = ""
gd_inc = ""
gd_call=""
gd_inc=""
for x in env.global_defaults:
env.core_sources.append("#platform/" + x + "/globals/global_defaults.cpp")
gd_inc += '#include "platform/' + x + '/globals/global_defaults.h"\n'
gd_call += "\tregister_" + x + "_global_defaults();\n"
env.core_sources.append("#platform/"+x+"/globals/global_defaults.cpp")
gd_inc+='#include "platform/'+x+'/globals/global_defaults.h"\n'
gd_call+="\tregister_"+x+"_global_defaults();\n"
gd_cpp = '#include "globals.h"\n'
gd_cpp += gd_inc
gd_cpp += "void Globals::register_global_defaults() {\n" + gd_call + "\n}\n"
gd_cpp='#include "globals.h"\n'
gd_cpp+=gd_inc
gd_cpp+="void Globals::register_global_defaults() {\n"+gd_call+"\n}\n"
f = open("global_defaults.cpp", "wb")
f = open("global_defaults.cpp","wb")
f.write(gd_cpp)
f.close()
import os
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
if ("SCRIPT_AES256_ENCRYPTION_KEY" in os.environ):
e = os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
txt = ""
ec_valid = True
if (len(e) != 64):
ec_valid = False
else:
e=os.environ["SCRIPT_AES256_ENCRYPTION_KEY"]
txt = ""
ec_valid=True
if (len(e)!=64):
ec_valid=False
else:
for i in range(len(e) >> 1):
if (i > 0):
txt += ","
txts = "0x" + e[i * 2:i * 2 + 2]
try:
int(txts, 16)
except:
ec_valid = False
txt += txts
if (not ec_valid):
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
print("Invalid AES256 encryption key, not 64 bits hex: " + e)
for i in range(len(e)>>1):
if (i>0):
txt+=","
txts="0x"+e[i*2:i*2+2]
try:
int(txts,16)
except:
ec_valid=False
txt+=txts
if (not ec_valid):
txt = "0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0"
print("Invalid AES256 encryption key, not 64 bits hex: "+e)
f = open("script_encryption_key.cpp", "wb")
f.write("#include \"globals.h\"\nuint8_t script_encryption_key[32]={" + txt + "};\n")
f.close()
env.add_source_files(env.core_sources, "*.cpp")
env.add_source_files(env.core_sources,"*.cpp")
Export('env')
import make_binders
env.Command(['method_bind.inc', 'method_bind_ext.inc'], 'make_binders.py', make_binders.run)
env.Command(['method_bind.inc','method_bind_ext.inc'], 'make_binders.py', make_binders.run)
SConscript('os/SCsub')
SConscript('math/SCsub')
SConscript('io/SCsub')
SConscript('bind/SCsub')
SConscript('os/SCsub');
SConscript('math/SCsub');
SConscript('io/SCsub');
SConscript('bind/SCsub');
lib = env.Library("core", env.core_sources)
lib = env.Library("core",env.core_sources)
env.Prepend(LIBS=[lib])

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -150,68 +150,9 @@ void Array::erase(const Variant& p_value) {
_p->array.erase(p_value);
}
Variant Array::front() const {
ERR_FAIL_COND_V(_p->array.size() == 0, Variant());
return operator[](0);
}
int Array::find(const Variant& p_value) const {
Variant Array::back() const {
ERR_FAIL_COND_V(_p->array.size() == 0, Variant());
return operator[](_p->array.size() - 1);
}
int Array::find(const Variant& p_value, int p_from) const {
return _p->array.find(p_value, p_from);
}
int Array::rfind(const Variant& p_value, int p_from) const {
if (_p->array.size() == 0)
return -1;
if (p_from < 0) {
// Relative offset from the end
p_from = _p->array.size() + p_from;
}
if (p_from < 0 || p_from >= _p->array.size()) {
// Limit to array boundaries
p_from = _p->array.size() - 1;
}
for (int i=p_from; i>=0; i--) {
if(_p->array[i] == p_value){
return i;
};
};
return -1;
}
int Array::find_last(const Variant& p_value) const {
return rfind(p_value);
}
int Array::count(const Variant& p_value) const {
if(_p->array.size() == 0)
return 0;
int amount=0;
for (int i=0; i<_p->array.size(); i++) {
if(_p->array[i] == p_value){
amount++;
};
};
return amount;
}
bool Array::has(const Variant& p_value) const {
return _p->array.find(p_value, 0) != -1;
return _p->array.find(p_value);
}
void Array::remove(int p_pos) {

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -67,18 +67,11 @@ public:
void insert(int p_pos, const Variant& p_value);
void remove(int p_pos);
Variant front() const;
Variant back() const;
void sort();
void sort_custom(Object *p_obj,const StringName& p_function);
void invert();
int find(const Variant& p_value, int p_from=0) const;
int rfind(const Variant& p_value, int p_from=-1) const;
int find_last(const Variant& p_value) const;
int count(const Variant& p_value) const;
bool has(const Variant& p_value) const;
int find(const Variant& p_value) const;
void erase(const Variant& p_value);

35
core/balloon_allocator.h Normal file
View File

@ -0,0 +1,35 @@
/*************************************************************************/
/* balloon_allocator.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* 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 BALLOON_ALLOCATOR_H
#define BALLOON_ALLOCATOR_H
#include "os/memory.h"
#include "allocators.h"
#endif // BALLOON_ALLOCATOR_H

View File

@ -1,7 +1,5 @@
#!/usr/bin/env python
Import('env')
env.add_source_files(env.core_sources, "*.cpp")
env.add_source_files(env.core_sources,"*.cpp")
Export('env')

View File

@ -1,31 +1,3 @@
/*************************************************************************/
/* core_bind.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* 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_bind.h"
#include "os/os.h"
#include "geometry.h"
@ -34,29 +6,6 @@
#include "core/globals.h"
#include "io/file_access_encrypted.h"
#include "os/keyboard.h"
/**
* Time constants borrowed from loc_time.h
*/
#define EPOCH_YR 1970 /* EPOCH = Jan 1 1970 00:00:00 */
#define SECS_DAY (24L * 60L * 60L)
#define LEAPYEAR(year) (!((year) % 4) && (((year) % 100) || !((year) % 400)))
#define YEARSIZE(year) (LEAPYEAR(year) ? 366 : 365)
#define SECOND_KEY "second"
#define MINUTE_KEY "minute"
#define HOUR_KEY "hour"
#define DAY_KEY "day"
#define MONTH_KEY "month"
#define YEAR_KEY "year"
#define WEEKDAY_KEY "weekday"
#define DST_KEY "dst"
/// Table of number of days in each month (for regular year and leap year)
static const unsigned int MONTH_DAYS_TABLE[2][12] = {
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
};
_ResourceLoader *_ResourceLoader::singleton=NULL;
Ref<ResourceInteractiveLoader> _ResourceLoader::load_interactive(const String& p_path,const String& p_type_hint) {
@ -106,17 +55,11 @@ bool _ResourceLoader::has(const String &p_path) {
return ResourceCache::has(local_path);
};
Ref<ResourceImportMetadata> _ResourceLoader::load_import_metadata(const String& p_path) {
return ResourceLoader::load_import_metadata(p_path);
}
void _ResourceLoader::_bind_methods() {
ObjectTypeDB::bind_method(_MD("load_interactive:ResourceInteractiveLoader","path","type_hint"),&_ResourceLoader::load_interactive,DEFVAL(""));
ObjectTypeDB::bind_method(_MD("load:Resource","path","type_hint", "p_no_cache"),&_ResourceLoader::load,DEFVAL(""), DEFVAL(false));
ObjectTypeDB::bind_method(_MD("load_import_metadata:ResourceImportMetadata","path"),&_ResourceLoader::load_import_metadata);
ObjectTypeDB::bind_method(_MD("get_recognized_extensions_for_type","type"),&_ResourceLoader::get_recognized_extensions_for_type);
ObjectTypeDB::bind_method(_MD("set_abort_on_missing_resources","abort"),&_ResourceLoader::set_abort_on_missing_resources);
ObjectTypeDB::bind_method(_MD("get_dependencies","path"),&_ResourceLoader::get_dependencies);
@ -254,11 +197,6 @@ Size2 _OS::get_screen_size(int p_screen) const {
return OS::get_singleton()->get_screen_size(p_screen);
}
int _OS::get_screen_dpi(int p_screen) const {
return OS::get_singleton()->get_screen_dpi(p_screen);
}
Point2 _OS::get_window_position() const {
return OS::get_singleton()->get_window_position();
}
@ -307,13 +245,6 @@ bool _OS::is_window_maximized() const {
return OS::get_singleton()->is_window_maximized();
}
void _OS::set_borderless_window(bool p_borderless) {
OS::get_singleton()->set_borderless_window(p_borderless);
}
bool _OS::get_borderless_window() const {
return OS::get_singleton()->get_borderless_window();
}
void _OS::set_use_file_access_save_and_swap(bool p_enable) {
@ -435,18 +366,6 @@ String _OS::get_locale() const {
return OS::get_singleton()->get_locale();
}
String _OS::get_latin_keyboard_variant() const {
switch( OS::get_singleton()->get_latin_keyboard_variant() ) {
case OS::LATIN_KEYBOARD_QWERTY: return "QWERTY";
case OS::LATIN_KEYBOARD_QWERTZ: return "QWERTZ";
case OS::LATIN_KEYBOARD_AZERTY: return "AZERTY";
case OS::LATIN_KEYBOARD_QZERTY: return "QZERTY";
case OS::LATIN_KEYBOARD_DVORAK: return "DVORAK";
case OS::LATIN_KEYBOARD_NEO : return "NEO";
default: return "ERROR";
}
}
String _OS::get_model_name() const {
return OS::get_singleton()->get_model_name();
@ -476,15 +395,6 @@ Error _OS::set_thread_name(const String& p_name) {
return Thread::set_name(p_name);
};
void _OS::set_use_vsync(bool p_enable) {
OS::get_singleton()->set_use_vsync(p_enable);
}
bool _OS::is_vsync_enabled() const {
return OS::get_singleton()->is_vsync_enabled();
}
/*
enum Weekday {
@ -553,208 +463,28 @@ void _OS::set_icon(const Image& p_icon) {
OS::get_singleton()->set_icon(p_icon);
}
int _OS::get_exit_code() const {
return OS::get_singleton()->get_exit_code();
}
void _OS::set_exit_code(int p_code) {
OS::get_singleton()->set_exit_code(p_code);
}
/**
* Get current datetime with consideration for utc and
* dst
*/
Dictionary _OS::get_datetime(bool utc) const {
Dictionary dated = get_date(utc);
Dictionary timed = get_time(utc);
List<Variant> keys;
timed.get_key_list(&keys);
for(int i = 0; i < keys.size(); i++) {
dated[keys[i]] = timed[keys[i]];
}
return dated;
}
Dictionary _OS::get_date(bool utc) const {
OS::Date date = OS::get_singleton()->get_date(utc);
Dictionary dated;
dated[YEAR_KEY]=date.year;
dated[MONTH_KEY]=date.month;
dated[DAY_KEY]=date.day;
dated[WEEKDAY_KEY]=date.weekday;
dated[DST_KEY]=date.dst;
dated["year"]=date.year;
dated["month"]=date.month;
dated["day"]=date.day;
dated["weekday"]=date.weekday;
dated["dst"]=date.dst;
return dated;
}
}
Dictionary _OS::get_time(bool utc) const {
OS::Time time = OS::get_singleton()->get_time(utc);
Dictionary timed;
timed[HOUR_KEY]=time.hour;
timed[MINUTE_KEY]=time.min;
timed[SECOND_KEY]=time.sec;
timed["hour"]=time.hour;
timed["minute"]=time.min;
timed["second"]=time.sec;
return timed;
}
/**
* Get a epoch time value from a dictionary of time values
* @p datetime must be populated with the following keys:
* day, hour, minute, month, second, year. (dst is ignored).
*
* You can pass the output from
* get_datetime_from_unix_time directly into this function
*
* @param datetime dictionary of date and time values to convert
*
* @return epoch calculated
*/
uint64_t _OS::get_unix_time_from_datetime(Dictionary datetime) const {
// Bunch of conversion constants
static const unsigned int SECONDS_PER_MINUTE = 60;
static const unsigned int MINUTES_PER_HOUR = 60;
static const unsigned int HOURS_PER_DAY = 24;
static const unsigned int SECONDS_PER_HOUR = MINUTES_PER_HOUR *
SECONDS_PER_MINUTE;
static const unsigned int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
// Get all time values from the dictionary, set to zero if it doesn't exist.
// Risk incorrect calculation over throwing errors
unsigned int second = ((datetime.has(SECOND_KEY))?
static_cast<unsigned int>(datetime[SECOND_KEY]): 0);
unsigned int minute = ((datetime.has(MINUTE_KEY))?
static_cast<unsigned int>(datetime[MINUTE_KEY]): 0);
unsigned int hour = ((datetime.has(HOUR_KEY))?
static_cast<unsigned int>(datetime[HOUR_KEY]): 0);
unsigned int day = ((datetime.has(DAY_KEY))?
static_cast<unsigned int>(datetime[DAY_KEY]): 0);
unsigned int month = ((datetime.has(MONTH_KEY))?
static_cast<unsigned int>(datetime[MONTH_KEY]) -1: 0);
unsigned int year = ((datetime.has(YEAR_KEY))?
static_cast<unsigned int>(datetime[YEAR_KEY]):0);
/// How many days come before each month (0-12)
static const unsigned short int DAYS_PAST_THIS_YEAR_TABLE[2][13] =
{
/* Normal years. */
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
/* Leap years. */
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
};
ERR_EXPLAIN("Invalid second value of: " + itos(second));
ERR_FAIL_COND_V( second > 59, 0);
ERR_EXPLAIN("Invalid minute value of: " + itos(minute));
ERR_FAIL_COND_V( minute > 59, 0);
ERR_EXPLAIN("Invalid hour value of: " + itos(hour));
ERR_FAIL_COND_V( hour > 23, 0);
ERR_EXPLAIN("Invalid month value of: " + itos(month+1));
ERR_FAIL_COND_V( month+1 > 12, 0);
// Do this check after month is tested as valid
ERR_EXPLAIN("Invalid day value of: " + itos(day) + " which is larger "
"than "+ itos(MONTH_DAYS_TABLE[LEAPYEAR(year)][month]));
ERR_FAIL_COND_V( day > MONTH_DAYS_TABLE[LEAPYEAR(year)][month], 0);
// Calculate all the seconds from months past in this year
uint64_t SECONDS_FROM_MONTHS_PAST_THIS_YEAR =
DAYS_PAST_THIS_YEAR_TABLE[LEAPYEAR(year)][month] * SECONDS_PER_DAY;
uint64_t SECONDS_FROM_YEARS_PAST = 0;
for(unsigned int iyear = EPOCH_YR; iyear < year; iyear++) {
SECONDS_FROM_YEARS_PAST += YEARSIZE(iyear) *
SECONDS_PER_DAY;
}
uint64_t epoch =
second +
minute * SECONDS_PER_MINUTE +
hour * SECONDS_PER_HOUR +
// Subtract 1 from day, since the current day isn't over yet
// and we cannot count all 24 hours.
(day-1) * SECONDS_PER_DAY +
SECONDS_FROM_MONTHS_PAST_THIS_YEAR +
SECONDS_FROM_YEARS_PAST;
return epoch;
}
/**
* Get a dictionary of time values when given epoch time
*
* Dictionary Time values will be a union if values from #get_time
* and #get_date dictionaries (with the exception of dst =
* day light standard time, as it cannot be determined from epoch)
*
* @param unix_time_val epoch time to convert
*
* @return dictionary of date and time values
*/
Dictionary _OS::get_datetime_from_unix_time( uint64_t unix_time_val) const {
// Just fail if unix time is negative (when interpreted as an int).
// This means the user passed in a negative value by accident
ERR_EXPLAIN("unix_time_val was really huge!"+ itos(unix_time_val) +
" You probably passed in a negative value!");
ERR_FAIL_COND_V( (int64_t)unix_time_val < 0, Dictionary());
OS::Date date;
OS::Time time;
unsigned long dayclock, dayno;
int year = EPOCH_YR;
dayclock = (unsigned long)unix_time_val % SECS_DAY;
dayno = (unsigned long)unix_time_val / SECS_DAY;
time.sec = dayclock % 60;
time.min = (dayclock % 3600) / 60;
time.hour = dayclock / 3600;
/* day 0 was a thursday */
date.weekday = static_cast<OS::Weekday>((dayno + 4) % 7);
while (dayno >= YEARSIZE(year)) {
dayno -= YEARSIZE(year);
year++;
}
date.year = year;
size_t imonth = 0;
while (dayno >= MONTH_DAYS_TABLE[LEAPYEAR(year)][imonth]) {
dayno -= MONTH_DAYS_TABLE[LEAPYEAR(year)][imonth];
imonth++;
}
/// Add 1 to month to make sure months are indexed starting at 1
date.month = static_cast<OS::Month>(imonth+1);
date.day = dayno + 1;
Dictionary timed;
timed[HOUR_KEY]=time.hour;
timed[MINUTE_KEY]=time.min;
timed[SECOND_KEY]=time.sec;
timed[YEAR_KEY]=date.year;
timed[MONTH_KEY]=date.month;
timed[DAY_KEY]=date.day;
timed[WEEKDAY_KEY]=date.weekday;
return timed;
}
Dictionary _OS::get_time_zone_info() const {
@ -768,7 +498,7 @@ Dictionary _OS::get_time_zone_info() const {
uint64_t _OS::get_unix_time() const {
return OS::get_singleton()->get_unix_time();
}
};
uint64_t _OS::get_system_time_secs() const {
return OS::get_singleton()->get_system_time_secs();
@ -867,6 +597,7 @@ void _OS::print_all_textures_by_size() {
for(List<_OSCoreBindImg>::Element *E=imgs.front();E;E=E->next()) {
print_line(E->get().path+" - "+String::humanize_size(E->get().vram)+" ("+E->get().size+") - total:"+String::humanize_size(total) );
total-=E->get().vram;
}
}
@ -900,21 +631,23 @@ void _OS::print_resources_by_type(const Vector<String>& p_types) {
type_count[r->get_type()]++;
print_line(r->get_type()+": "+r->get_path());
List<String> metas;
r->get_meta_list(&metas);
for (List<String>::Element* me = metas.front(); me; me = me->next()) {
print_line(" "+String(me->get()) + ": " + r->get_meta(me->get()));
};
}
for(Map<String,int>::Element *E=type_count.front();E;E=E->next()) {
print_line(E->key()+" count: "+itos(E->get()));
}
};
bool _OS::has_virtual_keyboard() const {
return OS::get_singleton()->has_virtual_keyboard();
}
void _OS::show_virtual_keyboard(const String& p_existing_text) {
OS::get_singleton()->show_virtual_keyboard(p_existing_text, Rect2());
}
void _OS::hide_virtual_keyboard() {
OS::get_singleton()->hide_virtual_keyboard();
}
void _OS::print_all_resources(const String& p_to_file ) {
@ -965,11 +698,6 @@ void _OS::native_video_stop() {
OS::get_singleton()->native_video_stop();
};
void _OS::request_attention() {
OS::get_singleton()->request_attention();
}
bool _OS::is_debug_build() const {
#ifdef DEBUG_ENABLED
@ -1028,11 +756,6 @@ void _OS::alert(const String& p_alert,const String& p_title) {
OS::get_singleton()->alert(p_alert,p_title);
}
Dictionary _OS::get_engine_version() const {
return OS::get_singleton()->get_engine_version();
}
_OS *_OS::singleton=NULL;
void _OS::_bind_methods() {
@ -1055,7 +778,6 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_current_screen","screen"),&_OS::set_current_screen);
ObjectTypeDB::bind_method(_MD("get_screen_position","screen"),&_OS::get_screen_position,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("get_screen_size","screen"),&_OS::get_screen_size,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("get_screen_dpi","screen"),&_OS::get_screen_dpi,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("get_window_position"),&_OS::get_window_position);
ObjectTypeDB::bind_method(_MD("set_window_position","position"),&_OS::set_window_position);
ObjectTypeDB::bind_method(_MD("get_window_size"),&_OS::get_window_size);
@ -1068,10 +790,6 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("is_window_minimized"),&_OS::is_window_minimized);
ObjectTypeDB::bind_method(_MD("set_window_maximized", "enabled"),&_OS::set_window_maximized);
ObjectTypeDB::bind_method(_MD("is_window_maximized"),&_OS::is_window_maximized);
ObjectTypeDB::bind_method(_MD("request_attention"), &_OS::request_attention);
ObjectTypeDB::bind_method(_MD("set_borderless_window", "borderless"), &_OS::set_borderless_window);
ObjectTypeDB::bind_method(_MD("get_borderless_window"), &_OS::get_borderless_window);
ObjectTypeDB::bind_method(_MD("set_screen_orientation","orientation"),&_OS::set_screen_orientation);
ObjectTypeDB::bind_method(_MD("get_screen_orientation"),&_OS::get_screen_orientation);
@ -1109,28 +827,19 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_cmdline_args"),&_OS::get_cmdline_args);
ObjectTypeDB::bind_method(_MD("get_main_loop"),&_OS::get_main_loop);
ObjectTypeDB::bind_method(_MD("get_datetime","utc"),&_OS::get_datetime,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_date","utc"),&_OS::get_date,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_time","utc"),&_OS::get_time,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_time_zone_info"),&_OS::get_time_zone_info);
ObjectTypeDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time);
ObjectTypeDB::bind_method(_MD("get_datetime_from_unix_time", "unix_time_val"),
&_OS::get_datetime_from_unix_time);
ObjectTypeDB::bind_method(_MD("get_unix_time_from_datetime", "datetime"),
&_OS::get_unix_time_from_datetime);
ObjectTypeDB::bind_method(_MD("get_system_time_secs"), &_OS::get_system_time_secs);
ObjectTypeDB::bind_method(_MD("set_icon","icon"),&_OS::set_icon);
ObjectTypeDB::bind_method(_MD("get_exit_code"),&_OS::get_exit_code);
ObjectTypeDB::bind_method(_MD("set_exit_code","code"),&_OS::set_exit_code);
ObjectTypeDB::bind_method(_MD("delay_usec","usec"),&_OS::delay_usec);
ObjectTypeDB::bind_method(_MD("delay_msec","msec"),&_OS::delay_msec);
ObjectTypeDB::bind_method(_MD("get_ticks_msec"),&_OS::get_ticks_msec);
ObjectTypeDB::bind_method(_MD("get_splash_tick_msec"),&_OS::get_splash_tick_msec);
ObjectTypeDB::bind_method(_MD("get_locale"),&_OS::get_locale);
ObjectTypeDB::bind_method(_MD("get_latin_keyboard_variant"),&_OS::get_latin_keyboard_variant);
ObjectTypeDB::bind_method(_MD("get_model_name"),&_OS::get_model_name);
ObjectTypeDB::bind_method(_MD("get_custom_level"),&_OS::get_custom_level);
@ -1147,9 +856,6 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("dump_memory_to_file","file"),&_OS::dump_memory_to_file);
ObjectTypeDB::bind_method(_MD("dump_resources_to_file","file"),&_OS::dump_resources_to_file);
ObjectTypeDB::bind_method(_MD("has_virtual_keyboard"),&_OS::has_virtual_keyboard);
ObjectTypeDB::bind_method(_MD("show_virtual_keyboard", "existing_text"),&_OS::show_virtual_keyboard,DEFVAL(""));
ObjectTypeDB::bind_method(_MD("hide_virtual_keyboard"),&_OS::hide_virtual_keyboard);
ObjectTypeDB::bind_method(_MD("print_resources_in_use","short"),&_OS::print_resources_in_use,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("print_all_resources","tofile"),&_OS::print_all_resources,DEFVAL(""));
@ -1184,10 +890,6 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_thread_name","name"),&_OS::set_thread_name);
ObjectTypeDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync);
ObjectTypeDB::bind_method(_MD("is_vsync_enabled"),&_OS::is_vsync_enabled);
ObjectTypeDB::bind_method(_MD("get_engine_version"),&_OS::get_engine_version);
BIND_CONSTANT( DAY_SUNDAY );
BIND_CONSTANT( DAY_MONDAY );
@ -1605,12 +1307,7 @@ DVector<uint8_t> _File::get_buffer(int p_length) const{
String _File::get_as_text() const {
ERR_FAIL_COND_V(!f, String());
String text;
size_t original_pos = f->get_pos();
f->seek(0);
String l = get_line();
while(!eof_reached()) {
text+=l+"\n";
@ -1618,27 +1315,10 @@ String _File::get_as_text() const {
}
text+=l;
f->seek(original_pos);
return text;
}
String _File::get_md5(const String& p_path) const {
return FileAccess::get_md5(p_path);
}
String _File::get_sha256(const String& p_path) const {
return FileAccess::get_sha256(p_path);
}
String _File::get_line() const{
ERR_FAIL_COND_V(!f,String());
@ -1827,8 +1507,6 @@ void _File::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_buffer","len"),&_File::get_buffer);
ObjectTypeDB::bind_method(_MD("get_line"),&_File::get_line);
ObjectTypeDB::bind_method(_MD("get_as_text"),&_File::get_as_text);
ObjectTypeDB::bind_method(_MD("get_md5","path"),&_File::get_md5);
ObjectTypeDB::bind_method(_MD("get_sha256","path"),&_File::get_sha256);
ObjectTypeDB::bind_method(_MD("get_endian_swap"),&_File::get_endian_swap);
ObjectTypeDB::bind_method(_MD("set_endian_swap","enable"),&_File::set_endian_swap);
ObjectTypeDB::bind_method(_MD("get_error:Error"),&_File::get_error);
@ -1937,57 +1615,29 @@ String _Directory::get_current_dir() {
Error _Directory::make_dir(String p_dir){
ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED);
if (!p_dir.is_rel_path()) {
DirAccess *d = DirAccess::create_for_path(p_dir);
Error err = d->make_dir(p_dir);
memdelete(d);
return err;
}
return d->make_dir(p_dir);
}
Error _Directory::make_dir_recursive(String p_dir){
ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED);
if (!p_dir.is_rel_path()) {
DirAccess *d = DirAccess::create_for_path(p_dir);
Error err = d->make_dir_recursive(p_dir);
memdelete(d);
return err;
}
return d->make_dir_recursive(p_dir);
}
bool _Directory::file_exists(String p_file){
ERR_FAIL_COND_V(!d,false);
if (!p_file.is_rel_path()) {
return FileAccess::exists(p_file);
}
return d->file_exists(p_file);
}
bool _Directory::dir_exists(String p_dir) {
ERR_FAIL_COND_V(!d,false);
if (!p_dir.is_rel_path()) {
DirAccess *d = DirAccess::create_for_path(p_dir);
bool exists = d->dir_exists(p_dir);
memdelete(d);
return exists;
} else {
return d->dir_exists(p_dir);
}
return d->dir_exists(p_dir);
}
int _Directory::get_space_left(){
ERR_FAIL_COND_V(!d,0);
return d->get_space_left()/1024*1024; //return value in megabytes, given binding is int
return d->get_space_left();
}
Error _Directory::copy(String p_from,String p_to){
@ -1998,26 +1648,12 @@ Error _Directory::copy(String p_from,String p_to){
Error _Directory::rename(String p_from, String p_to){
ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED);
if (!p_from.is_rel_path()) {
DirAccess *d = DirAccess::create_for_path(p_from);
Error err = d->rename(p_from,p_to);
memdelete(d);
return err;
}
return d->rename(p_from,p_to);
}
Error _Directory::remove(String p_name){
ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED);
if (!p_name.is_rel_path()) {
DirAccess *d = DirAccess::create_for_path(p_name);
Error err = d->remove(p_name);
memdelete(d);
return err;
}
return d->remove(p_name);
}
@ -2343,6 +1979,7 @@ String _Thread::get_id() const {
return itos(thread->get_ID());
}
bool _Thread::is_active() const {
return active;

View File

@ -1,31 +1,3 @@
/*************************************************************************/
/* core_bind.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* 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 CORE_BIND_H
#define CORE_BIND_H
@ -54,7 +26,6 @@ public:
void set_abort_on_missing_resources(bool p_abort);
StringArray get_dependencies(const String& p_path);
bool has(const String& p_path);
Ref<ResourceImportMetadata> load_import_metadata(const String& p_path);
_ResourceLoader();
};
@ -109,9 +80,7 @@ public:
};
enum Month {
/// Start at 1 to follow Windows SYSTEMTIME structure
/// https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx
MONTH_JANUARY = 1,
MONTH_JANUARY,
MONTH_FEBRUARY,
MONTH_MARCH,
MONTH_APRIL,
@ -145,7 +114,6 @@ public:
virtual void set_current_screen(int p_screen);
virtual Point2 get_screen_position(int p_screen=0) const;
virtual Size2 get_screen_size(int p_screen=0) const;
virtual int get_screen_dpi(int p_screen=0) const;
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2& p_position);
virtual Size2 get_window_size() const;
@ -158,10 +126,7 @@ public:
virtual bool is_window_minimized() const;
virtual void set_window_maximized(bool p_enabled);
virtual bool is_window_maximized() const;
virtual void request_attention();
virtual void set_borderless_window(bool p_borderless);
virtual bool get_borderless_window() const;
Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
bool native_video_is_playing();
@ -193,8 +158,6 @@ public:
Vector<String> get_cmdline_args();
String get_locale() const;
String get_latin_keyboard_variant() const;
String get_model_name() const;
MainLoop *get_main_loop() const;
@ -205,10 +168,6 @@ public:
void dump_memory_to_file(const String& p_file);
void dump_resources_to_file(const String& p_file);
bool has_virtual_keyboard() const;
void show_virtual_keyboard(const String& p_existing_text="");
void hide_virtual_keyboard();
void print_resources_in_use(bool p_short=false);
void print_all_resources(const String& p_to_file);
void print_all_textures_by_size();
@ -246,14 +205,8 @@ public:
void set_use_file_access_save_and_swap(bool p_enable);
void set_icon(const Image& p_icon);
int get_exit_code() const;
void set_exit_code(int p_code);
Dictionary get_date(bool utc) const;
Dictionary get_time(bool utc) const;
Dictionary get_datetime(bool utc) const;
Dictionary get_datetime_from_unix_time(uint64_t unix_time_val) const;
uint64_t get_unix_time_from_datetime(Dictionary datetime) const;
Dictionary get_time_zone_info() const;
uint64_t get_unix_time() const;
uint64_t get_system_time_secs() const;
@ -320,11 +273,6 @@ public:
Error set_thread_name(const String& p_name);
void set_use_vsync(bool p_enable);
bool is_vsync_enabled() const;
Dictionary get_engine_version() const;
static _OS *get_singleton() { return singleton; }
_OS();
@ -419,8 +367,6 @@ public:
DVector<uint8_t> get_buffer(int p_length) const; ///< get an array of bytes
String get_line() const;
String get_as_text() const;
String get_md5(const String& p_path) const;
String get_sha256(const String& p_path) const;
/**< use this for files WRITTEN in _big_ endian machines (ie, amiga/mac)
* It's not about the current CPU type but file formats.

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -29,8 +29,6 @@
#include "color.h"
#include "math_funcs.h"
#include "print_string.h"
#include "map.h"
#include "color_names.inc"
uint32_t Color::to_ARGB32() const {
@ -329,25 +327,7 @@ bool Color::html_is_valid(const String& p_color) {
}
Color Color::named(const String &p_name) {
if (_named_colors.empty()) _populate_named_colors(); // from color_names.inc
String name = p_name;
// Normalize name
name = name.replace(" ", "");
name = name.replace("-", "");
name = name.replace("_", "");
name = name.replace("'", "");
name = name.replace(".", "");
name = name.to_lower();
const Map<String, Color>::Element* color = _named_colors.find(name);
if(color) {
return color->value();
} else {
ERR_EXPLAIN("Invalid Color Name: "+p_name);
ERR_FAIL_V(Color());
}
}
String _to_hex(float p_val) {

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -111,7 +111,6 @@ struct Color {
static Color hex(uint32_t p_hex);
static Color html(const String& p_color);
static bool html_is_valid(const String& p_color);
static Color named(const String& p_name);
String to_html(bool p_alpha=true) const;
_FORCE_INLINE_ bool operator<(const Color& p_color) const; //used in set keys

View File

@ -1,150 +0,0 @@
// Names from https://en.wikipedia.org/wiki/List_of_colors (through https://raw.githubusercontent.com/SuperUserNameMan/color_to_name/616a7cddafefda91478b7bc26167de97fb5badb1/godot_version.gd), slightly edited and normalized
static Map<String, Color> _named_colors;
static void _populate_named_colors() {
if(!_named_colors.empty()) return;
_named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00));
_named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84));
_named_colors.insert("aqua", Color(0.00, 1.00, 1.00));
_named_colors.insert("aquamarine", Color(0.50, 1.00, 0.83));
_named_colors.insert("azure", Color(0.94, 1.00, 1.00));
_named_colors.insert("beige", Color(0.96, 0.96, 0.86));
_named_colors.insert("bisque", Color(1.00, 0.89, 0.77));
_named_colors.insert("black", Color(0.00, 0.00, 0.00));
_named_colors.insert("blanchedalmond", Color(1.00, 0.92, 0.80));
_named_colors.insert("blue", Color(0.00, 0.00, 1.00));
_named_colors.insert("blueviolet", Color(0.54, 0.17, 0.89));
_named_colors.insert("brown", Color(0.65, 0.16, 0.16));
_named_colors.insert("burlywood", Color(0.87, 0.72, 0.53));
_named_colors.insert("cadetblue", Color(0.37, 0.62, 0.63));
_named_colors.insert("chartreuse", Color(0.50, 1.00, 0.00));
_named_colors.insert("chocolate", Color(0.82, 0.41, 0.12));
_named_colors.insert("coral", Color(1.00, 0.50, 0.31));
_named_colors.insert("cornflower", Color(0.39, 0.58, 0.93));
_named_colors.insert("cornsilk", Color(1.00, 0.97, 0.86));
_named_colors.insert("crimson", Color(0.86, 0.08, 0.24));
_named_colors.insert("cyan", Color(0.00, 1.00, 1.00));
_named_colors.insert("darkblue", Color(0.00, 0.00, 0.55));
_named_colors.insert("darkcyan", Color(0.00, 0.55, 0.55));
_named_colors.insert("darkgoldenrod", Color(0.72, 0.53, 0.04));
_named_colors.insert("darkgray", Color(0.66, 0.66, 0.66));
_named_colors.insert("darkgreen", Color(0.00, 0.39, 0.00));
_named_colors.insert("darkkhaki", Color(0.74, 0.72, 0.42));
_named_colors.insert("darkmagenta", Color(0.55, 0.00, 0.55));
_named_colors.insert("darkolivegreen", Color(0.33, 0.42, 0.18));
_named_colors.insert("darkorange", Color(1.00, 0.55, 0.00));
_named_colors.insert("darkorchid", Color(0.60, 0.20, 0.80));
_named_colors.insert("darkred", Color(0.55, 0.00, 0.00));
_named_colors.insert("darksalmon", Color(0.91, 0.59, 0.48));
_named_colors.insert("darkseagreen", Color(0.56, 0.74, 0.56));
_named_colors.insert("darkslateblue", Color(0.28, 0.24, 0.55));
_named_colors.insert("darkslategray", Color(0.18, 0.31, 0.31));
_named_colors.insert("darkturquoise", Color(0.00, 0.81, 0.82));
_named_colors.insert("darkviolet", Color(0.58, 0.00, 0.83));
_named_colors.insert("deeppink", Color(1.00, 0.08, 0.58));
_named_colors.insert("deepskyblue", Color(0.00, 0.75, 1.00));
_named_colors.insert("dimgray", Color(0.41, 0.41, 0.41));
_named_colors.insert("dodgerblue", Color(0.12, 0.56, 1.00));
_named_colors.insert("firebrick", Color(0.70, 0.13, 0.13));
_named_colors.insert("floralwhite", Color(1.00, 0.98, 0.94));
_named_colors.insert("forestgreen", Color(0.13, 0.55, 0.13));
_named_colors.insert("fuchsia", Color(1.00, 0.00, 1.00));
_named_colors.insert("gainsboro", Color(0.86, 0.86, 0.86));
_named_colors.insert("ghostwhite", Color(0.97, 0.97, 1.00));
_named_colors.insert("gold", Color(1.00, 0.84, 0.00));
_named_colors.insert("goldenrod", Color(0.85, 0.65, 0.13));
_named_colors.insert("gray", Color(0.75, 0.75, 0.75));
_named_colors.insert("webgray", Color(0.50, 0.50, 0.50));
_named_colors.insert("green", Color(0.00, 1.00, 0.00));
_named_colors.insert("webgreen", Color(0.00, 0.50, 0.00));
_named_colors.insert("greenyellow", Color(0.68, 1.00, 0.18));
_named_colors.insert("honeydew", Color(0.94, 1.00, 0.94));
_named_colors.insert("hotpink", Color(1.00, 0.41, 0.71));
_named_colors.insert("indianred", Color(0.80, 0.36, 0.36));
_named_colors.insert("indigo", Color(0.29, 0.00, 0.51));
_named_colors.insert("ivory", Color(1.00, 1.00, 0.94));
_named_colors.insert("khaki", Color(0.94, 0.90, 0.55));
_named_colors.insert("lavender", Color(0.90, 0.90, 0.98));
_named_colors.insert("lavenderblush", Color(1.00, 0.94, 0.96));
_named_colors.insert("lawngreen", Color(0.49, 0.99, 0.00));
_named_colors.insert("lemonchiffon", Color(1.00, 0.98, 0.80));
_named_colors.insert("lightblue", Color(0.68, 0.85, 0.90));
_named_colors.insert("lightcoral", Color(0.94, 0.50, 0.50));
_named_colors.insert("lightcyan", Color(0.88, 1.00, 1.00));
_named_colors.insert("lightgoldenrod", Color(0.98, 0.98, 0.82));
_named_colors.insert("lightgray", Color(0.83, 0.83, 0.83));
_named_colors.insert("lightgreen", Color(0.56, 0.93, 0.56));
_named_colors.insert("lightpink", Color(1.00, 0.71, 0.76));
_named_colors.insert("lightsalmon", Color(1.00, 0.63, 0.48));
_named_colors.insert("lightseagreen", Color(0.13, 0.70, 0.67));
_named_colors.insert("lightskyblue", Color(0.53, 0.81, 0.98));
_named_colors.insert("lightslategray", Color(0.47, 0.53, 0.60));
_named_colors.insert("lightsteelblue", Color(0.69, 0.77, 0.87));
_named_colors.insert("lightyellow", Color(1.00, 1.00, 0.88));
_named_colors.insert("lime", Color(0.00, 1.00, 0.00));
_named_colors.insert("limegreen", Color(0.20, 0.80, 0.20));
_named_colors.insert("linen", Color(0.98, 0.94, 0.90));
_named_colors.insert("magenta", Color(1.00, 0.00, 1.00));
_named_colors.insert("maroon", Color(0.69, 0.19, 0.38));
_named_colors.insert("webmaroon", Color(0.50, 0.00, 0.00));
_named_colors.insert("mediumaquamarine", Color(0.40, 0.80, 0.67));
_named_colors.insert("mediumblue", Color(0.00, 0.00, 0.80));
_named_colors.insert("mediumorchid", Color(0.73, 0.33, 0.83));
_named_colors.insert("mediumpurple", Color(0.58, 0.44, 0.86));
_named_colors.insert("mediumseagreen", Color(0.24, 0.70, 0.44));
_named_colors.insert("mediumslateblue", Color(0.48, 0.41, 0.93));
_named_colors.insert("mediumspringgreen", Color(0.00, 0.98, 0.60));
_named_colors.insert("mediumturquoise", Color(0.28, 0.82, 0.80));
_named_colors.insert("mediumvioletred", Color(0.78, 0.08, 0.52));
_named_colors.insert("midnightblue", Color(0.10, 0.10, 0.44));
_named_colors.insert("mintcream", Color(0.96, 1.00, 0.98));
_named_colors.insert("mistyrose", Color(1.00, 0.89, 0.88));
_named_colors.insert("moccasin", Color(1.00, 0.89, 0.71));
_named_colors.insert("navajowhite", Color(1.00, 0.87, 0.68));
_named_colors.insert("navyblue", Color(0.00, 0.00, 0.50));
_named_colors.insert("oldlace", Color(0.99, 0.96, 0.90));
_named_colors.insert("olive", Color(0.50, 0.50, 0.00));
_named_colors.insert("olivedrab", Color(0.42, 0.56, 0.14));
_named_colors.insert("orange", Color(1.00, 0.65, 0.00));
_named_colors.insert("orangered", Color(1.00, 0.27, 0.00));
_named_colors.insert("orchid", Color(0.85, 0.44, 0.84));
_named_colors.insert("palegoldenrod", Color(0.93, 0.91, 0.67));
_named_colors.insert("palegreen", Color(0.60, 0.98, 0.60));
_named_colors.insert("paleturquoise", Color(0.69, 0.93, 0.93));
_named_colors.insert("palevioletred", Color(0.86, 0.44, 0.58));
_named_colors.insert("papayawhip", Color(1.00, 0.94, 0.84));
_named_colors.insert("peachpuff", Color(1.00, 0.85, 0.73));
_named_colors.insert("peru", Color(0.80, 0.52, 0.25));
_named_colors.insert("pink", Color(1.00, 0.75, 0.80));
_named_colors.insert("plum", Color(0.87, 0.63, 0.87));
_named_colors.insert("powderblue", Color(0.69, 0.88, 0.90));
_named_colors.insert("purple", Color(0.63, 0.13, 0.94));
_named_colors.insert("webpurple", Color(0.50, 0.00, 0.50));
_named_colors.insert("rebeccapurple", Color(0.40, 0.20, 0.60));
_named_colors.insert("red", Color(1.00, 0.00, 0.00));
_named_colors.insert("rosybrown", Color(0.74, 0.56, 0.56));
_named_colors.insert("royalblue", Color(0.25, 0.41, 0.88));
_named_colors.insert("saddlebrown", Color(0.55, 0.27, 0.07));
_named_colors.insert("salmon", Color(0.98, 0.50, 0.45));
_named_colors.insert("sandybrown", Color(0.96, 0.64, 0.38));
_named_colors.insert("seagreen", Color(0.18, 0.55, 0.34));
_named_colors.insert("seashell", Color(1.00, 0.96, 0.93));
_named_colors.insert("sienna", Color(0.63, 0.32, 0.18));
_named_colors.insert("silver", Color(0.75, 0.75, 0.75));
_named_colors.insert("skyblue", Color(0.53, 0.81, 0.92));
_named_colors.insert("slateblue", Color(0.42, 0.35, 0.80));
_named_colors.insert("slategray", Color(0.44, 0.50, 0.56));
_named_colors.insert("snow", Color(1.00, 0.98, 0.98));
_named_colors.insert("springgreen", Color(0.00, 1.00, 0.50));
_named_colors.insert("steelblue", Color(0.27, 0.51, 0.71));
_named_colors.insert("tan", Color(0.82, 0.71, 0.55));
_named_colors.insert("teal", Color(0.00, 0.50, 0.50));
_named_colors.insert("thistle", Color(0.85, 0.75, 0.85));
_named_colors.insert("tomato", Color(1.00, 0.39, 0.28));
_named_colors.insert("turquoise", Color(0.25, 0.88, 0.82));
_named_colors.insert("violet", Color(0.93, 0.51, 0.93));
_named_colors.insert("wheat", Color(0.96, 0.87, 0.70));
_named_colors.insert("white", Color(1.00, 1.00, 1.00));
_named_colors.insert("whitesmoke", Color(0.96, 0.96, 0.96));
_named_colors.insert("yellow", Color(1.00, 1.00, 0.00));
_named_colors.insert("yellowgreen", Color(0.60, 0.80, 0.20));
}

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -152,23 +152,6 @@ class CommandQueueMT {
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7); }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7,class P8>
struct Command8 : public CommandBase {
T*instance;
M method;
typename GetSimpleTypeT<P1>::type_t p1;
typename GetSimpleTypeT<P2>::type_t p2;
typename GetSimpleTypeT<P3>::type_t p3;
typename GetSimpleTypeT<P4>::type_t p4;
typename GetSimpleTypeT<P5>::type_t p5;
typename GetSimpleTypeT<P6>::type_t p6;
typename GetSimpleTypeT<P7>::type_t p7;
typename GetSimpleTypeT<P8>::type_t p8;
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7,p8); }
};
/* comands that return */
template<class T,class M,class R>
@ -287,25 +270,6 @@ class CommandQueueMT {
virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6,p7); sync->sem->post(); sync->in_use=false; ; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7,class P8,class R>
struct CommandRet8 : public CommandBase {
T*instance;
M method;
typename GetSimpleTypeT<P1>::type_t p1;
typename GetSimpleTypeT<P2>::type_t p2;
typename GetSimpleTypeT<P3>::type_t p3;
typename GetSimpleTypeT<P4>::type_t p4;
typename GetSimpleTypeT<P5>::type_t p5;
typename GetSimpleTypeT<P6>::type_t p6;
typename GetSimpleTypeT<P7>::type_t p7;
typename GetSimpleTypeT<P8>::type_t p8;
R* ret;
SyncSemaphore *sync;
virtual void call() { *ret = (instance->*method)(p1,p2,p3,p4,p5,p6,p7,p8); sync->sem->post(); sync->in_use=false; ; }
};
/** commands that don't return but sync */
/* comands that return */
@ -426,25 +390,6 @@ class CommandQueueMT {
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7); sync->sem->post(); sync->in_use=false; ; }
};
template<class T,class M,class P1,class P2,class P3,class P4,class P5,class P6,class P7,class P8>
struct CommandSync8 : public CommandBase {
T*instance;
M method;
typename GetSimpleTypeT<P1>::type_t p1;
typename GetSimpleTypeT<P2>::type_t p2;
typename GetSimpleTypeT<P3>::type_t p3;
typename GetSimpleTypeT<P4>::type_t p4;
typename GetSimpleTypeT<P5>::type_t p5;
typename GetSimpleTypeT<P6>::type_t p6;
typename GetSimpleTypeT<P7>::type_t p7;
typename GetSimpleTypeT<P8>::type_t p8;
SyncSemaphore *sync;
virtual void call() { (instance->*method)(p1,p2,p3,p4,p5,p6,p7,p8); sync->sem->post(); sync->in_use=false; ; }
};
/***** BASE *******/
enum {
@ -694,27 +639,6 @@ public:
if (sync) sync->post();
}
template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7,class P8>
void push( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8 ) {
Command8<T,M,P1,P2,P3,P4,P5,P6,P7,P8> * cmd = allocate_and_lock< Command8<T,M,P1,P2,P3,P4,P5,P6,P7,P8> >();
cmd->instance=p_instance;
cmd->method=p_method;
cmd->p1=p1;
cmd->p2=p2;
cmd->p3=p3;
cmd->p4=p4;
cmd->p5=p5;
cmd->p6=p6;
cmd->p7=p7;
cmd->p8=p8;
unlock();
if (sync) sync->post();
}
/*** PUSH AND RET COMMANDS ***/
@ -882,31 +806,6 @@ public:
ss->sem->wait();
}
template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6,class P7,class P8,class R>
void push_and_ret( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,P7 p7,P8 p8, R* r_ret ) {
CommandRet8<T,M,P1,P2,P3,P4,P5,P6,P7,P8,R> * cmd = allocate_and_lock< CommandRet8<T,M,P1,P2,P3,P4,P5,P6,P7,P8,R> >();
cmd->instance=p_instance;
cmd->method=p_method;
cmd->p1=p1;
cmd->p2=p2;
cmd->p3=p3;
cmd->p4=p4;
cmd->p5=p5;
cmd->p6=p6;
cmd->p7=p7;
cmd->p8=p8;
cmd->ret=r_ret;
SyncSemaphore *ss=_alloc_sync_sem();
cmd->sync=ss;
unlock();
if (sync) sync->post();
ss->sem->wait();
}
template<class T, class M>
void push_and_sync( T * p_instance, M p_method) {
@ -1072,31 +971,6 @@ public:
ss->sem->wait();
}
template<class T, class M, class P1, class P2, class P3, class P4, class P5, class P6,class P7,class P8>
void push_and_sync( T * p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6,P7 p7,P8 p8) {
CommandSync8<T,M,P1,P2,P3,P4,P5,P6,P7,P8> * cmd = allocate_and_lock< CommandSync8<T,M,P1,P2,P3,P4,P5,P6,P7,P8> >();
cmd->instance=p_instance;
cmd->method=p_method;
cmd->p1=p1;
cmd->p2=p2;
cmd->p3=p3;
cmd->p4=p4;
cmd->p5=p5;
cmd->p6=p6;
cmd->p7=p7;
cmd->p8=p8;
SyncSemaphore *ss=_alloc_sync_sem();
cmd->sync=ss;
unlock();
if (sync) sync->post();
ss->sem->wait();
}
void wait_and_flush_one() {
ERR_FAIL_COND(!sync);
sync->wait();

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -199,18 +199,6 @@ Array Dictionary::keys() const {
}
Array Dictionary::values() const {
Array varr;
varr.resize(size());
const Variant *key=NULL;
int i=0;
while((key=next(key))){
varr[i++] = _p->variant_map[*key];
}
return varr;
}
const Variant* Dictionary::next(const Variant* p_key) const {
return _p->variant_map.next(p_key);
@ -262,3 +250,5 @@ Dictionary::~Dictionary() {
_unref();
}

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -81,7 +81,6 @@ public:
const Variant* next(const Variant* p_key=NULL) const;
Array keys() const;
Array values() const;
Dictionary(const Dictionary& p_from);
Dictionary(bool p_shared=false);

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -285,7 +285,6 @@ public:
Error resize(int p_size);
void invert();
void operator=(const DVector& p_dvector) { reference(p_dvector); }
DVector() {}
@ -425,18 +424,6 @@ Error DVector<T>::resize(int p_size) {
return OK;
}
template<class T>
void DVector<T>::invert() {
T temp;
Write w = write();
int s = size();
int half_s = s/2;
for(int i=0;i<half_s;i++) {
temp = w[i];
w[i] = w[s-i-1];
w[s-i-1] = temp;
}
}
#endif

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -57,33 +57,33 @@ enum Error {
ERR_FILE_MISSING_DEPENDENCIES,
ERR_FILE_EOF,
ERR_CANT_OPEN, ///< Can't open a resource/socket/file
ERR_CANT_CREATE, // (20)
ERROR_QUERY_FAILED,
ERR_CANT_CREATE,
ERROR_QUERY_FAILED, // (20)
ERR_ALREADY_IN_USE,
ERR_LOCKED, ///< resource is locked
ERR_TIMEOUT,
ERR_CANT_CONNECT, // (25)
ERR_CANT_RESOLVE,
ERR_CANT_CONNECT,
ERR_CANT_RESOLVE, // (25)
ERR_CONNECTION_ERROR,
ERR_CANT_AQUIRE_RESOURCE,
ERR_CANT_FORK,
ERR_INVALID_DATA, ///< Data passed is invalid (30)
ERR_INVALID_PARAMETER, ///< Parameter passed is invalid
ERR_INVALID_DATA, ///< Data passed is invalid
ERR_INVALID_PARAMETER, ///< Parameter passed is invalid (30)
ERR_ALREADY_EXISTS, ///< When adding, item already exists
ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist
ERR_DATABASE_CANT_READ, ///< database is full
ERR_DATABASE_CANT_WRITE, ///< database is full (35)
ERR_COMPILATION_FAILED,
ERR_DATABASE_CANT_WRITE, ///< database is full
ERR_COMPILATION_FAILED, // (35)
ERR_METHOD_NOT_FOUND,
ERR_LINK_FAILED,
ERR_SCRIPT_FAILED,
ERR_CYCLIC_LINK, // (40)
ERR_INVALID_DECLARATION,
ERR_CYCLIC_LINK,
ERR_INVALID_DECLARATION, // (40)
ERR_DUPLICATE_SYMBOL,
ERR_PARSE_ERROR,
ERR_BUSY,
ERR_SKIP, // (45)
ERR_HELP, ///< user requested help!!
ERR_SKIP,
ERR_HELP, ///< user requested help!! (45)
ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior.
ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames
ERR_OMFG_THIS_IS_VERY_VERY_BAD, ///< shit happens, has never been used, though

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -223,10 +223,5 @@ extern bool _err_error_exists;
} \
#define WARN_PRINTS(m_string) \
{ \
_err_print_error(FUNCTION_STR,__FILE__,__LINE__,String(m_string).utf8().get_data(),ERR_HANDLER_WARNING); \
_err_error_exists=false;\
} \
#endif

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -92,7 +92,7 @@ Error EventQueue::push_call(uint32_t p_instance_ID, const StringName& p_method,
*v=p_arg5;
}
if (buffer_end > buffer_max_used)
if (buffer_max_used>buffer_end);
buffer_max_used=buffer_end;
return OK;

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

28
core/fpstr.cpp Normal file
View File

@ -0,0 +1,28 @@
/*************************************************************************/
/* fpstr.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* 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. */
/*************************************************************************/

28
core/fpstr.h Normal file
View File

@ -0,0 +1,28 @@
/*************************************************************************/
/* fpstr.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* 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. */
/*************************************************************************/

View File

@ -1,31 +1,3 @@
/*************************************************************************/
/* func_ref.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* 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 "func_ref.h"
Variant FuncRef::call_func(const Variant** p_args, int p_argcount, Variant::CallError& r_error) {

View File

@ -1,31 +1,3 @@
/*************************************************************************/
/* func_ref.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* 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 FUNC_REF_H
#define FUNC_REF_H

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -432,7 +432,6 @@ static _GlobalConstant _global_constants[]={
BIND_GLOBAL_CONSTANT( ERR_FILE_EOF ),
BIND_GLOBAL_CONSTANT( ERR_CANT_OPEN ), ///< Can't open a resource/socket/file
BIND_GLOBAL_CONSTANT( ERR_CANT_CREATE ),
BIND_GLOBAL_CONSTANT( ERR_PARSE_ERROR ),
BIND_GLOBAL_CONSTANT( ERROR_QUERY_FAILED ),
BIND_GLOBAL_CONSTANT( ERR_ALREADY_IN_USE ),
BIND_GLOBAL_CONSTANT( ERR_LOCKED ), ///< resource is locked
@ -478,22 +477,7 @@ static _GlobalConstant _global_constants[]={
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_STORAGE ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_EDITOR ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_NETWORK ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_EDITOR_HELPER ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_CHECKABLE ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_CHECKED ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_INTERNATIONALIZED ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_BUNDLE ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_CATEGORY ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_STORE_IF_NONZERO ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_STORE_IF_NONONE ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_NO_INSTANCE_STATE ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_RESTART_IF_CHANGED ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_SCRIPT_VARIABLE ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_DEFAULT ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_DEFAULT_INTL ),
BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_NOEDITOR ),
BIND_GLOBAL_CONSTANT( METHOD_FLAG_NORMAL ),
BIND_GLOBAL_CONSTANT( METHOD_FLAG_EDITOR ),

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -54,8 +54,7 @@ String Globals::localize_path(const String& p_path) const {
if (resource_path=="")
return p_path; //not initialied yet
if (p_path.begins_with("res://") || p_path.begins_with("user://") ||
(p_path.is_abs_path() && !p_path.begins_with(resource_path)))
if (p_path.find(":/") != -1)
return p_path.simplify_path();
@ -83,8 +82,6 @@ String Globals::localize_path(const String& p_path) const {
if (sep == -1) {
return "res://"+path;
};
String parent = path.substr(0, sep);
String plocal = localize_path(parent);
@ -1376,25 +1373,6 @@ Vector<String> Globals::get_optimizer_presets() const {
}
void Globals::_add_property_info_bind(const Dictionary& p_info) {
ERR_FAIL_COND(!p_info.has("name"));
ERR_FAIL_COND(!p_info.has("type"));
PropertyInfo pinfo;
pinfo.name = p_info["name"];
ERR_FAIL_COND(!props.has(pinfo.name));
pinfo.type = Variant::Type(p_info["type"].operator int());
ERR_FAIL_INDEX(pinfo.type, Variant::VARIANT_MAX);
if (p_info.has("hint"))
pinfo.hint = PropertyHint(p_info["hint"].operator int());
if (p_info.has("hint_string"))
pinfo.hint_string = p_info["hint_string"];
set_custom_property_info(pinfo.name, pinfo);
}
void Globals::set_custom_property_info(const String& p_prop,const PropertyInfo& p_info) {
ERR_FAIL_COND(!props.has(p_prop));
@ -1419,7 +1397,6 @@ void Globals::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_order","name"),&Globals::get_order);
ObjectTypeDB::bind_method(_MD("set_persisting","name","enable"),&Globals::set_persisting);
ObjectTypeDB::bind_method(_MD("is_persisting","name"),&Globals::is_persisting);
ObjectTypeDB::bind_method(_MD("add_property_info", "hint"),&Globals::_add_property_info_bind);
ObjectTypeDB::bind_method(_MD("clear","name"),&Globals::clear);
ObjectTypeDB::bind_method(_MD("localize_path","path"),&Globals::localize_path);
ObjectTypeDB::bind_method(_MD("globalize_path","path"),&Globals::globalize_path);
@ -1450,7 +1427,7 @@ Globals::Globals() {
set("application/name","" );
set("application/main_scene","");
custom_prop_info["application/main_scene"]=PropertyInfo(Variant::STRING,"application/main_scene",PROPERTY_HINT_FILE,"tscn,scn,xscn,xml,res");
custom_prop_info["application/main_scene"]=PropertyInfo(Variant::STRING,"application/main_scene",PROPERTY_HINT_FILE,"scn,res,xscn,xml,tscn");
set("application/disable_stdout",false);
set("application/use_shared_user_dir",true);
@ -1549,7 +1526,6 @@ Globals::Globals() {
custom_prop_info["render/thread_model"]=PropertyInfo(Variant::INT,"render/thread_model",PROPERTY_HINT_ENUM,"Single-Unsafe,Single-Safe,Multi-Threaded");
custom_prop_info["physics_2d/thread_model"]=PropertyInfo(Variant::INT,"physics_2d/thread_model",PROPERTY_HINT_ENUM,"Single-Unsafe,Single-Safe,Multi-Threaded");
set("debug/profiler_max_functions",16384);
using_datapack=false;
}

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -96,8 +96,6 @@ protected:
bool _load_resource_pack(const String& p_pack);
void _add_property_info_bind(const Dictionary& p_info);
protected:
static void _bind_methods();

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -74,10 +74,7 @@ static inline uint32_t hash_djb2_one_float(float p_in,uint32_t p_prev=5381) {
float f;
uint32_t i;
} u;
// handle -0 case
if (p_in==0.0f) u.f=0.0f;
else u.f=p_in;
u.f=p_in;
return ((p_prev<<5)+p_prev)+u.i;
}

View File

@ -1,43 +0,0 @@
/*************************************************************************/
/* value_evaluator.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* 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 VALUE_EVALUATOR_H
#define VALUE_EVALUATOR_H
#include "core/object.h"
class ValueEvaluator : public Object {
OBJ_TYPE(ValueEvaluator, Object);
public:
virtual double eval(const String& p_text) {
return p_text.to_double();
}
};
#endif // VALUE_EVALUATOR_H

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
#ifndef HQ2X_H
#define HQ2X_H
#include "typedefs.h"
uint32_t *hq2x_resize(
const uint32_t *image,
uint32_t width,
uint32_t height,
uint32_t *output,
uint32_t trY = 0x30,
uint32_t trU = 0x07,
uint32_t trV = 0x06,
uint32_t trA = 0x50,
bool wrapX = false,
bool wrapY = false );
#endif // HQ2X_H

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -30,7 +30,7 @@
#include "hash_map.h"
#include "core/io/image_loader.h"
#include "core/os/copymem.h"
#include "hq2x.h"
#include "print_string.h"
#include <stdio.h>
@ -901,44 +901,6 @@ static void _generate_po2_mipmap(const uint8_t* p_src, uint8_t* p_dst, uint32_t
}
void Image::expand_x2_hq2x() {
ERR_FAIL_COND(format>=FORMAT_INDEXED);
Format current = format;
bool mipmaps=get_mipmaps();
if (mipmaps) {
clear_mipmaps();
}
if (current!=FORMAT_RGBA)
convert(FORMAT_RGBA);
DVector<uint8_t> dest;
dest.resize(width*2*height*2*4);
{
DVector<uint8_t>::Read r = data.read();
DVector<uint8_t>::Write w = dest.write();
hq2x_resize((const uint32_t*)r.ptr(),width,height,(uint32_t*)w.ptr());
}
width*=2;
height*=2;
data=dest;
if (current!=FORMAT_RGBA)
convert(current);
if (mipmaps) {
generate_mipmaps();
}
}
void Image::shrink_x2() {
ERR_FAIL_COND(format==FORMAT_INDEXED || format==FORMAT_INDEXED_ALPHA);
@ -1735,17 +1697,8 @@ Error Image::_decompress_bc() {
print_line("decompressing bc");
int wd=width,ht=height;
if (wd%4!=0) {
wd+=4-(wd%4);
}
if (ht%4!=0) {
ht+=4-(ht%4);
}
int mm;
int size = _get_dst_image_size(wd,ht,FORMAT_RGBA,mm,mipmaps);
int size = _get_dst_image_size(width,height,FORMAT_RGBA,mm,mipmaps);
DVector<uint8_t> newdata;
newdata.resize(size);
@ -1755,8 +1708,7 @@ Error Image::_decompress_bc() {
int rofs=0;
int wofs=0;
//print_line("width: "+itos(wd)+" height: "+itos(ht));
int wd=width,ht=height;
for(int i=0;i<=mm;i++) {
@ -2061,11 +2013,6 @@ Error Image::_decompress_bc() {
data=newdata;
format=FORMAT_RGBA;
if (wd!=width || ht!=height) {
//todo, crop
width=wd;
height=ht;
}
return OK;
}
@ -2327,8 +2274,6 @@ void Image::blit_rect(const Image& p_src, const Rect2& p_src_rect,const Point2&
Image (*Image::_png_mem_loader_func)(const uint8_t*,int)=NULL;
Image (*Image::_jpg_mem_loader_func)(const uint8_t*,int)=NULL;
void (*Image::_image_compress_bc_func)(Image *)=NULL;
void (*Image::_image_compress_pvrtc2_func)(Image *)=NULL;
void (*Image::_image_compress_pvrtc4_func)(Image *)=NULL;
@ -2503,7 +2448,7 @@ String Image::get_format_name(Format p_format) {
return format_names[p_format];
}
Image::Image(const uint8_t* p_mem_png_jpg, int p_len) {
Image::Image(const uint8_t* p_png,int p_len) {
width=0;
height=0;
@ -2511,13 +2456,8 @@ Image::Image(const uint8_t* p_mem_png_jpg, int p_len) {
format=FORMAT_GRAYSCALE;
if (_png_mem_loader_func) {
*this = _png_mem_loader_func(p_mem_png_jpg,p_len);
*this = _png_mem_loader_func(p_png,p_len);
}
if (empty() && _jpg_mem_loader_func) {
*this = _jpg_mem_loader_func(p_mem_png_jpg,p_len);
}
}
Image::Image() {

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -97,7 +97,6 @@ public:
};
static Image (*_png_mem_loader_func)(const uint8_t* p_png,int p_size);
static Image (*_jpg_mem_loader_func)(const uint8_t* p_png,int p_size);
static void (*_image_compress_bc_func)(Image *);
static void (*_image_compress_pvrtc2_func)(Image *);
static void (*_image_compress_pvrtc4_func)(Image *);
@ -250,7 +249,6 @@ public:
void resize( int p_width, int p_height, Interpolation p_interpolation=INTERPOLATE_BILINEAR );
Image resized( int p_width, int p_height, int p_interpolation=INTERPOLATE_BILINEAR );
void shrink_x2();
void expand_x2_hq2x();
/**
* Crop the image to a specific size, if larger, then the image is filled by black
*/
@ -358,7 +356,7 @@ public:
static void set_compress_bc_func(void (*p_compress_func)(Image *));
static String get_format_name(Format p_format);
Image(const uint8_t* p_mem_png_jpg, int p_len=-1);
Image(const uint8_t* p_mem_png, int p_len=-1);
Image(const char **p_xpm);
~Image();

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -59,6 +59,7 @@ int Image::MCBlock::get_longest_axis_index() const {
for(int i=0;i<4;i++) {
int d = max_color.color.col[i]-min_color.color.col[i];
//printf(" ai:%i - %i\n",i,d);
if (d>max_dist) {
max_index=i;
max_dist=d;
@ -70,11 +71,13 @@ int Image::MCBlock::get_longest_axis_index() const {
int Image::MCBlock::get_longest_axis_length() const {
int max_dist=-1;
int max_index=0;
for(int i=0;i<4;i++) {
int d = max_color.color.col[i]-min_color.color.col[i];
if (d>max_dist) {
max_index=i;
max_dist=d;
}
}
@ -114,6 +117,8 @@ void Image::MCBlock::shrink() {
void Image::quantize() {
Image::Format orig_format=format;
bool has_alpha = detect_alpha()!=ALPHA_NONE;
bool quantize_fast=OS::get_singleton()->has_environment("QUANTIZE_FAST");

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -28,7 +28,6 @@
/*************************************************************************/
#include "input_map.h"
#include "globals.h"
#include "os/keyboard.h"
InputMap *InputMap::singleton=NULL;
@ -37,7 +36,6 @@ void InputMap::_bind_methods() {
ObjectTypeDB::bind_method(_MD("has_action","action"),&InputMap::has_action);
ObjectTypeDB::bind_method(_MD("get_action_id","action"),&InputMap::get_action_id);
ObjectTypeDB::bind_method(_MD("get_action_from_id","id"),&InputMap::get_action_from_id);
ObjectTypeDB::bind_method(_MD("get_actions"),&InputMap::_get_actions);
ObjectTypeDB::bind_method(_MD("add_action","action"),&InputMap::add_action);
ObjectTypeDB::bind_method(_MD("erase_action","action"),&InputMap::erase_action);
@ -77,35 +75,6 @@ StringName InputMap::get_action_from_id(int p_id) const {
return input_id_map[p_id];
}
Array InputMap::_get_actions() {
Array ret;
List<StringName> actions = get_actions();
if(actions.empty())
return ret;
for(const List<StringName>::Element *E=actions.front();E;E=E->next()) {
ret.push_back(E->get());
}
return ret;
}
List<StringName> InputMap::get_actions() const {
List<StringName> actions = List<StringName>();
if(input_map.empty()){
return actions;
}
for (Map<StringName, Action>::Element *E=input_map.front();E;E=E->next()) {
actions.push_back(E->key());
}
return actions;
}
List<InputEvent>::Element *InputMap::_find_event(List<InputEvent> &p_list,const InputEvent& p_event) const {
for (List<InputEvent>::Element *E=p_list.front();E;E=E->next()) {
@ -232,6 +201,64 @@ bool InputMap::event_is_action(const InputEvent& p_event, const StringName& p_ac
return _find_event(E->get().inputs,p_event)!=NULL;
}
bool InputMap::event_is_joy_motion_action_pressed(const InputEvent& p_event) const {
ERR_FAIL_COND_V(p_event.type!=InputEvent::JOYSTICK_MOTION,false);
bool pressed=false;
//this could be optimized by having a separate list of joymotions?
for (Map<StringName, Action>::Element *A=input_map.front();A;A=A->next()) {
for (List<InputEvent>::Element *E=A->get().inputs.front();E;E=E->next()) {
const InputEvent& e=E->get();
if(e.type!=p_event.type)
continue;
if (e.type!=InputEvent::KEY && e.device!=p_event.device)
continue;
switch(p_event.type) {
case InputEvent::KEY: {
if (e.key.scancode==p_event.key.scancode && e.key.mod == p_event.key.mod)
return e.key.pressed;
} break;
case InputEvent::JOYSTICK_BUTTON: {
if (e.joy_button.button_index==p_event.joy_button.button_index) {
return e.joy_button.pressed;
}
} break;
case InputEvent::MOUSE_BUTTON: {
if (e.mouse_button.button_index==p_event.mouse_button.button_index) {
return e.mouse_button.pressed;
}
} break;
case InputEvent::JOYSTICK_MOTION: {
if (e.joy_motion.axis==p_event.joy_motion.axis) {
if (
(e.joy_motion.axis_value * p_event.joy_motion.axis_value >0) && //same axis
ABS(e.joy_motion.axis_value)>0.5 && ABS(p_event.joy_motion.axis_value)>0.5 )
pressed=true;
}
} break;
}
}
}
return pressed;
}
void InputMap::load_from_globals() {
input_map.clear();;
@ -262,67 +289,6 @@ void InputMap::load_from_globals() {
}
}
void InputMap::load_default() {
InputEvent key;
key.type=InputEvent::KEY;
add_action("ui_accept");
key.key.scancode=KEY_RETURN;
action_add_event("ui_accept",key);
key.key.scancode=KEY_ENTER;
action_add_event("ui_accept",key);
key.key.scancode=KEY_SPACE;
action_add_event("ui_accept",key);
add_action("ui_select");
key.key.scancode=KEY_SPACE;
action_add_event("ui_select",key);
add_action("ui_cancel");
key.key.scancode=KEY_ESCAPE;
action_add_event("ui_cancel",key);
add_action("ui_focus_next");
key.key.scancode=KEY_TAB;
action_add_event("ui_focus_next",key);
add_action("ui_focus_prev");
key.key.scancode=KEY_TAB;
key.key.mod.shift=true;
action_add_event("ui_focus_prev",key);
key.key.mod.shift=false;
add_action("ui_left");
key.key.scancode=KEY_LEFT;
action_add_event("ui_left",key);
add_action("ui_right");
key.key.scancode=KEY_RIGHT;
action_add_event("ui_right",key);
add_action("ui_up");
key.key.scancode=KEY_UP;
action_add_event("ui_up",key);
add_action("ui_down");
key.key.scancode=KEY_DOWN;
action_add_event("ui_down",key);
add_action("ui_page_up");
key.key.scancode=KEY_PAGEUP;
action_add_event("ui_page_up",key);
add_action("ui_page_down");
key.key.scancode=KEY_PAGEDOWN;
action_add_event("ui_page_down",key);
// set("display/orientation", "landscape");
}
InputMap::InputMap() {

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@ -47,7 +47,6 @@ class InputMap : public Object {
List<InputEvent>::Element *_find_event(List<InputEvent> &p_list,const InputEvent& p_event) const;
Array _get_action_list(const StringName& p_action);
Array _get_actions();
protected:
@ -60,7 +59,6 @@ public:
bool has_action(const StringName& p_action) const;
int get_action_id(const StringName& p_action) const;
StringName get_action_from_id(int p_id) const;
List<StringName> get_actions() const;
void add_action(const StringName& p_action);
void erase_action(const StringName& p_action);
@ -70,10 +68,10 @@ public:
const List<InputEvent> *get_action_list(const StringName& p_action);
bool event_is_action(const InputEvent& p_event, const StringName& p_action) const;
bool event_is_joy_motion_action_pressed(const InputEvent& p_event) const;
void load_from_globals();
void load_default();
InputMap();
};

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -1,60 +0,0 @@
This is version 2007-Mar-4 of the Info-ZIP license.
The definitive version of this document should be available at
ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and
a copy at http://www.info-zip.org/pub/infozip/license.html.
Copyright (c) 1990-2007 Info-ZIP. All rights reserved.
For the purposes of this copyright and license, "Info-ZIP" is defined as
the following set of individuals:
Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois,
Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth,
Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz,
David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko,
Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs,
Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda,
Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren,
Rich Wales, Mike White.
This software is provided "as is," without warranty of any kind, express
or implied. In no event shall Info-ZIP or its contributors be held liable
for any direct, indirect, incidental, special or consequential damages
arising out of the use of or inability to use this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the above disclaimer and the following restrictions:
1. Redistributions of source code (in whole or in part) must retain
the above copyright notice, definition, disclaimer, and this list
of conditions.
2. Redistributions in binary form (compiled executables and libraries)
must reproduce the above copyright notice, definition, disclaimer,
and this list of conditions in documentation and/or other materials
provided with the distribution. The sole exception to this condition
is redistribution of a standard UnZipSFX binary (including SFXWiz) as
part of a self-extracting archive; that is permitted without inclusion
of this license, as long as the normal SFX banner has not been removed
from the binary or disabled.
3. Altered versions--including, but not limited to, ports to new operating
systems, existing ports with new graphical interfaces, versions with
modified or added functionality, and dynamic, shared, or static library
versions not from Info-ZIP--must be plainly marked as such and must not
be misrepresented as being the original source or, if binaries,
compiled from the original source. Such altered versions also must not
be misrepresented as being Info-ZIP releases--including, but not
limited to, labeling of the altered versions with the names "Info-ZIP"
(or any variation thereof, including, but not limited to, different
capitalizations), "Pocket UnZip," "WiZ" or "MacZip" without the
explicit permission of Info-ZIP. Such altered versions are further
prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP
e-mail addresses or the Info-ZIP URL(s), such as to imply Info-ZIP
will provide support for the altered versions.
4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip,"
"UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its
own source and binary releases.

View File

@ -1,32 +0,0 @@
Credits
Gilles Vollant - Original MiniZip author
Even Rouault - ZIP64 unzip Support
Daniel Borca - BZip Compression method support in unzip
Mathias Svensson - ZIP64 zip support
Mathias Svensson - BZip Compression method support in zip
This version has been modified for Godot Engine
License
----------------------------------------------------------------------------
Condition of use and distribution are the same than zlib :
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
----------------------------------------------------------------------------

View File

@ -1,9 +1,7 @@
#!/usr/bin/env python
Import('env')
env.add_source_files(env.core_sources, "*.cpp")
env.add_source_files(env.core_sources, "*.c")
# env.core_sources.append("io/fastlz.c")
env.add_source_files(env.core_sources,"*.cpp")
env.add_source_files(env.core_sources,"*.c")
#env.core_sources.append("io/fastlz.c")
Export('env')

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */

Some files were not shown because too many files have changed in this diff Show More