Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions added to Rectangle, and less verbose enums #50

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4de31b1
Added funtions to `Rectangle` struct. Moved existing example, and add…
LiamM32 Mar 11, 2024
743c0c1
Added functions to `Rectangle` struct.
LiamM32 Mar 26, 2024
3ddf67b
Made less verbose enum `Key` equivalent to `KeyboardKey`. (#8)
LiamM32 Mar 26, 2024
e9d5ea0
Started work on making less verbose enums while keeping the current o…
LiamM32 Mar 26, 2024
c9e0545
All enums now come in shorter versions. (#8)
LiamM32 Mar 27, 2024
b96e268
Added operator overloads to `Rectangle` that accept a `Vector2` for o…
LiamM32 Mar 27, 2024
49a8f2a
Changed `old_enums` module to `raylibd_templates`.
LiamM32 Mar 29, 2024
9501221
Renamed `Key` enum back to `KeyboardKey`.
LiamM32 Apr 9, 2024
cf27ce6
Apply suggestions from code review
LiamM32 Apr 10, 2024
fa06ebd
Made Rectangle unittests deterministic.
LiamM32 Apr 10, 2024
995f601
Merged remote and local
LiamM32 Apr 10, 2024
cfc0932
Fixed error in rayguiexample
LiamM32 Apr 10, 2024
84542bb
Added my name to list of authors.
LiamM32 Apr 11, 2024
269544d
Updated names in `dub.json`
LiamM32 Apr 14, 2024
d6d9b84
Gave `Camera2D` struct better initial conditions in `enhancedD` confi…
LiamM32 Apr 14, 2024
a113ff9
Turned raygui into a subpackage.
LiamM32 Apr 18, 2024
74baff4
Updated names in `dub.json`
LiamM32 Apr 14, 2024
74a9912
Turned raygui into a subpackage.
LiamM32 Apr 18, 2024
a245f6a
Partially upgraded `raygui` module to version 3.5
LiamM32 Apr 19, 2024
3a9e2cf
Finished transitioning to raygui 3.5
LiamM32 Apr 19, 2024
61b9055
Removed some comments with instructions specific to C.
LiamM32 Apr 19, 2024
4bae7bc
Updated rayguiexample to match raygui 3.5.
LiamM32 Apr 19, 2024
9343bd8
Added back former RayGUI enum members under `deprecated`.
LiamM32 Apr 19, 2024
2948321
Set `raylib_types` module to `@safe`.
LiamM32 May 2, 2024
3b10653
Merge branch 'raygui_3.5+'
LiamM32 May 2, 2024
40687d6
Merge branch 'rectangle-functions'
LiamM32 May 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions example/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"libs": [
"raylib"
],
"description": "A minimal D application.",
"description": "'Hello World' example",
"license": "Zlib",
"name": "example"
"name": "example",
"mainSourceFile": "source/app.d"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be necessary.

}
2 changes: 1 addition & 1 deletion rayguiexample/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int main() {
//----------------------------------------------------------------------------------

// Custom GUI font loading
//Font font = LoadFontEx("fonts/rainyhearts16.ttf", 12, 0, 0);
//Font font = LoadFontEx("fonts/rainyhearts16.ttf".toStringz, 12, 0, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D string literals are compatible with C strings. This line works as-is in D.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have found that sometimes it works, and sometimes it doesn't. As an experiment, I just tried removing all the .toStringz uses in my code, and the only errors were for the functions MeasureTextEx and DrawTextEx. Having experienced this error before, I had added this use of toStringz for peace of mind, thinking that it might just suddenly stop working one day without it.

Do you know why using a D string works for some Raylib functions but not for others?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just figured it out. It works without toStringz when the string is known at compile-time, but fails when a variable is used. I will now keep this in mind.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, any string literals are implicitly convertible to const char * and will have proper zero termination. That is a part of the D language specification: https://dlang.org/spec/expression.html#string_literals

So please remove this change.

//GuiSetFont(font);

bool exitWindow = false;
Expand Down
Loading