Commit graph

52 commits

Author SHA1 Message Date
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
reduz f2397809a8 Refactored Variant Operators.
-Using classes to call and a table
-For typed code (GDS or GDNative), can obtain functions to call prevalidated or ptr.
2020-11-06 12:45:50 -03:00
Hugo Locurcio 7adb6b91b3
Remove Color.contrasted() as its behavior is barely useful
Returning the most contrasting color isn't a trivial task, as there
are often many possible choices. It's usually best left for the user
to implement using a script.
2020-11-03 04:46:08 -05:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Aaron Franke a6ff389a55
Simplify html_is_valid and allow it to work with 3 and 4 hex digits 2020-09-01 02:07:35 -04:00
Aaron Franke ecd6a893b4
Change Color HTML conversion from ARGB to RGBA
Also add support for 3 and 4 digit values in C#. Now it actually matches the HTML/CSS spec.
2020-09-01 02:07:35 -04:00
Rémi Verschelde 85220fec01 Style: Remove unnecessary semicolons from core
Semicolons are not necessary after function definitions or control flow
blocks, and having some code use them makes things inconsistent (and
occasionally can mess up `clang-format`'s formatting).

Removing them is tedious work though, I had to do this manually (regex
+ manual review) as I couldn't find a tool for that. All other code
folders would need to get the same treatment.
2020-05-19 15:57:56 +02:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Hanif Bin Ariffin 7bc1dc828f Remove deprecated Color::gray
It was marked to be removed in Godot 3.1.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-02-12 11:22:33 +01:00
Juan Linietsky 123ee5995c Visual GPU profiler and related profiling support in Vulkan. 2020-02-11 12:01:26 +01:00
Rémi Verschelde 505fee0b6d Color: Fix deprecation warning mentioning 'get_v()' instead of 'v'
Fixes #35657.
2020-01-28 12:41:04 +01:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

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

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Aaron Franke 86922ff70b
Make is_equal_approx separate for structures
This commit adds exposed behavior for C#
2019-10-14 16:46:54 -04:00
Braden Bodily 71d71d55b5 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'
Condensed some if and ERR statements. Added dots to end of error messages

Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?),
core/os/memory.cpp,
drivers/png/png_driver_common.cpp,
drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
2019-08-17 12:33:15 +02:00
qarmin 3c154eb93b Remove unnecessary code and add some error explanations 2019-07-01 12:59:42 +02:00
Rémi Verschelde 6d16f2f053 Fix error macro calls not ending with semicolon
It's not necessary, but the vast majority of calls of error macros
do have an ending semicolon, so it's best to be consistent.
Most WARN_DEPRECATED calls did *not* have a semicolon, but there's
no reason for them to be treated differently.
2019-06-11 14:49:34 +02:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
lupoDharkael 2380f320e0 Update GDNantive API
Add missing Rect2 methods to GDNative API
Add missing Quat methods to GDNative API
Add missing NodePath methods to GDNative API
Add missing String methods to GDNative API
Add missing Array methods to GDNative API
Add missing Basis methods to GDNative API
Add missing Color methods to GDNative API
Update gdnative_api.json
2018-10-26 17:25:57 +02:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
elasota 35f6ba5c5d BPTC support 2018-08-21 22:56:04 -04:00
Rémi Verschelde 2969dffbe3 Deprecate incorrect Color::gray()
This average is not a proper approximation of a grayscale value,
get_v() is better suited for that.

If we want a real to_grayscale() conversion, it's somewhat more
involved: https://en.wikipedia.org/wiki/Grayscale

Remove the deprecated Gray() from C# bindings as it conflicts
with new named color constants.
2018-08-21 17:48:31 +02:00
Aaron Franke de4b096898 [Core] 64-bit int Color methods 2018-07-25 15:34:24 -05:00
Max 83b98785b3 Fixed float Color conversions to int types 2018-06-19 22:19:08 +03:00
Bernhard Liebl 1d3b5d5a2f Fix mismatch between Color.h and Color.from_hsv() 2018-03-14 21:04:02 +01:00
Bernhard Liebl be55171231 Add Color.from_hsv() 2018-01-18 22:13:00 +01:00
Rémi Verschelde 09ca100658
Revert "Fix bad color to HTML conversion. Alpha channel was added before RGB." 2018-01-16 10:22:22 +01:00
Juan Linietsky 2cde466ebd -Remove color operator clamping, which is unnecesary. Fixes #15184, fixes #14686.
-Refresh progress bar less often, makes baking, exporting, etc. faster.
2018-01-12 00:08:32 -03:00
robfram 19915d674c Fix bad color to HTML conversion. Alpha channel was added befor RGB. 2018-01-09 22:34:00 +01:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Rémi Verschelde 27fb329c82 Merge pull request #11208 from kitsune/hex-color-shortcuts
Adds 3 and 4 digit html shortcuts to Color
2017-09-19 23:33:25 +02:00
bncastle 9d9cfc6f61 Implement +,-,/, * and negate operators for Color type. 2017-09-16 13:09:49 -04:00
Dylan Enloe 8bff891f3c Adds 3 and 4 digit html shortcuts to Color
Color::html now expands 3 and 4 digit hex values into 6 and 8 digit
values by repeating each digit. This is to bring it in line with how
html handles these values

fixes #10997
2017-09-12 14:05:33 -07:00
mrawlingst 6aa5bc2347 Change Color.to_32() to to_rgba32() and format as RGBA 2017-09-07 16:19:44 -04:00
toger5 426c6b2c49 added to_ABGR32() to core/Color 2017-08-30 21:20:01 +02:00
Rémi Verschelde bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Rémi Verschelde df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
Rémi Verschelde 5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Rémi Verschelde 3890256fc5 Style: Cleanups, added headers, renamed files
Made sure files in core/ and tools/ have a proper Godot license header
when written by us. Also renamed aabb.{cpp,h} and object_type_db.{cpp,h}
to rect3.{cpp,h} and class_db.{cpp,h} respectively.

Also added a proper header to core/io/base64.{c,h} after clarifying
the licensing with the original author (public domain).
2017-01-16 08:04:23 +01:00
Rémi Verschelde 57166cd292 Merge pull request #7093 from bojidar-bg/named-colors
Add named colors to GDScript/Visual Script/core.
2017-01-11 10:36:15 +01:00
Rémi Verschelde c7bc44d5ad Welcome in 2017, dear changelog reader!
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer
with state-of-the-art rendering techniques tuned to work as low as middle
end handheld devices - without compromising with the possibilities given
for higher end desktop games of course. Great times ahead for the Godot
community and the gamers that will play our games!
2017-01-01 22:03:33 +01:00
Bojidar Marinov 23381a530b
Add named colors to GDScript/Visual Script/core.
Names and values taken from https://en.wikipedia.org/wiki/X11_color_names
2016-12-17 11:14:53 +02:00
Hubert Jarosz 4a4f247914
remove trailing whitespace 2016-03-09 00:00:52 +01:00
Nuno Donato b51c720c80 fix color when hue is set to 1 2016-02-18 10:34:45 +00:00
George Marques 5be9ff7b67 Update copyright to 2016 in headers 2016-01-01 11:50:53 -02:00
choikwa b210f52f4a fix typo error in Color::invert 2015-05-24 19:07:26 -04:00
Juan Linietsky fdaa2920eb Updated copyright year in all headers 2015-04-18 14:38:54 -03:00