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 all 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
42 changes: 25 additions & 17 deletions dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,33 @@
"description": "D binding for Raylib",
"license": "Zlib",
"authors": [
"ONROUNDIT"
"ONROUNDIT",
"Steven Schveighoffer",
"Liam McGillivray"
],
"configurations" : [
{
"name": "library"
},
{
"name": "unittest",
"versions" : ["raylib_test"],
"libs" : ["raylib"],
"lflags-posix": ["-L."],
"lflags-osx": ["-rpath", "@executable_path/"],
"lflags-linux" : ["-rpath=$$ORIGIN"]
}
],
"configurations" : [
{
"name": "library"
},
{
"name": "unittest",
"versions" : ["raylib_test"],
"libs" : ["raylib"],
"lflags-posix": ["-L."],
"lflags-osx": ["-rpath", "@executable_path/"],
"lflags-linux" : ["-rpath=$$ORIGIN"]
}
],
"copyright": "Copyright (c) Ramon Santamaria (@raysan5), Petro Romanovych (@onroundit), Jan Hoenig (@m3m0ry), Steven Schveighoffer (@schveiguy), Liam McGillivray (@LiamM32)",
"excludedSourceFiles": ["source/rlgl.d", "source/raymath.d", "source/easings.d", "source/raymathext.d", "source/raylib_types.d"],
"targetType": "sourceLibrary",
"subPackages" : [
"install"
]
"libs": ["raylib"],
"subPackages": [
{
"name": "raygui",
"targetType": "sourceLibrary",
"dependencies": {"raylib-d": {"path": "."}},
"sourceFiles": ["source/raygui.d"]
}
]
}
8 changes: 3 additions & 5 deletions example/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
"dependencies": {
"raylib-d": {"path": "../"}
},
"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.

}
4 changes: 3 additions & 1 deletion rayguiexample/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
"dependencies" : {
"raylib-d" : {
"path" : "../"
},
"raylib-d:raygui" : {
"path" : "../"
}
},
"description": "D port of raygui example controls_test_suite",
"license": "zlib",
"name": "rayguiexample",
"libs": ["raylib"],
"lflags-posix": ["-L."],
"lflags-osx": ["-rpath", "@executable_path/"],
"buildOptions": ["betterC"]
Expand Down
25 changes: 9 additions & 16 deletions rayguiexample/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,16 @@ extern(C): __gshared:
* - GuiComboBox()
* - GuiListView()
* - GuiToggleGroup()
* - GuiTextBoxMulti()
* - GuiColorPicker()
* - GuiSlider()
* - GuiSliderBar()
* - GuiProgressBar()
* - GuiColorBarAlpha()
* - GuiScrollPanel()
*
*
* DEPENDENCIES:
* raylib 4.0 - Windowing/input management and drawing.
* raygui 3.2 - Immediate-mode GUI controls.
*
* COMPILATION (Windows - MinGW):
* gcc -o $(NAME_PART).exe $(FILE_NAME) -I../../src -lraylib -lopengl32 -lgdi32 -std=c99
* Raylib-D
* raylib 4.5
*
* LICENSE: zlib/libpng
*
Expand All @@ -40,8 +35,6 @@ extern(C): __gshared:
import raylib;

version = RAYGUI_IMPLEMENTATION;
//#define RAYGUI_CUSTOM_ICONS // It requires providing gui_icons.h in the same directory
//#include "gui_icons.h" // External icons data provided, it can be generated with rGuiIcons tool
import raygui;

public import core.stdc.string; // Required for: strcpy()
Expand Down Expand Up @@ -124,9 +117,9 @@ int main() {
//----------------------------------------------------------------------------------
exitWindow = WindowShouldClose();

if (IsKeyPressed(KeyboardKey.KEY_ESCAPE)) showMessageBox = !showMessageBox;
if (IsKeyPressed(KeyboardKey.ESCAPE)) showMessageBox = !showMessageBox;

if (IsKeyDown(KeyboardKey.KEY_LEFT_CONTROL) && IsKeyPressed(KeyboardKey.KEY_S)) showTextInputBox = true;
if (IsKeyDown(KeyboardKey.LEFT_CONTROL) && IsKeyPressed(KeyboardKey.KEY_S)) showTextInputBox = true;

if (IsFileDropped())
{
Expand All @@ -146,9 +139,8 @@ int main() {

// raygui: controls drawing
//----------------------------------------------------------------------------------
// Check all possible events that require GuiLock
if (dropDown000EditMode || dropDown001EditMode) GuiLock();
else if (!dropDown000EditMode && !dropDown001EditMode) GuiUnlock();
//GuiDisable();

// First GUI column
//GuiSetStyle(CHECKBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
Expand Down Expand Up @@ -177,6 +169,7 @@ int main() {
comboBoxActive = GuiComboBox(Rectangle( 25, 470, 125, 30 ), "ONE;TWO;THREE;FOUR", comboBoxActive);

// NOTE: GuiDropdownBox must draw after any other control that can be covered on unfolding
GuiUnlock;
GuiSetStyle(DROPDOWNBOX, TEXT_ALIGNMENT, TEXT_ALIGN_LEFT);
if (GuiDropdownBox(Rectangle( 25, 65, 125, 30 ), "#01#ONE;#02#TWO;#03#THREE;#04#FOUR", &dropdownBox001Active, dropDown001EditMode)) dropDown001EditMode = !dropDown001EditMode;

Expand All @@ -190,19 +183,19 @@ int main() {
toggleGroupActive = GuiToggleGroup(Rectangle( 165, 400, 140, 25 ), "#1#ONE\n#3#TWO\n#8#THREE\n#23#", toggleGroupActive);

// Third GUI column
if (GuiTextBoxMulti(Rectangle( 320, 25, 225, 140 ), multiTextBoxText.ptr, 256, multiTextBoxEditMode)) multiTextBoxEditMode = !multiTextBoxEditMode;
GuiPanel(Rectangle( 320, 25, 225, 140 ), "Panel Info");
colorPickerValue = GuiColorPicker(Rectangle( 320, 185, 196, 192 ), null, colorPickerValue);

sliderValue = cast(int)GuiSlider(Rectangle( 355, 400, 165, 20 ), "TEST", TextFormat("%2.2f", cast(float)sliderValue), sliderValue, -50, 100);
sliderBarValue = cast(int)GuiSliderBar(Rectangle( 320, 430, 200, 20 ), null, TextFormat("%i", cast(int)sliderBarValue), sliderBarValue, 0, 100);
progressValue = GuiProgressBar(Rectangle( 320, 460, 200, 20 ), null, null, progressValue, 0, 1);

// NOTE: View rectangle could be used to perform some scissor test
Rectangle view = GuiScrollPanel(Rectangle( 560, 25, 100, 160 ), null, Rectangle( 560, 25, 200, 400 ), &viewScroll);
Rectangle view = GuiScrollPanel(Rectangle( 560, 25, 102, 354 ), null, Rectangle( 560, 25, 200, 400 ), &viewScroll);

GuiPanel(Rectangle( 560, 25 + 180, 100, 160 ), "Panel Info");

GuiGrid(Rectangle( 560, 25 + 180 + 180, 100, 120 ), null, 20, 2);
GuiGrid(Rectangle( 560, 25 + 195 + 180, 100, 120 ), null, 20, 2);

GuiStatusBar(Rectangle( 0, cast(float)GetScreenHeight() - 20, cast(float)GetScreenWidth(), 20 ), "This is a status bar");

Expand Down
Loading