-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Samerion/margins
Implement margins; Prepare for 0.4.0
- Loading branch information
Showing
22 changed files
with
498 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import glui; | ||
import raylib; | ||
|
||
import std.array; | ||
import std.range; | ||
import std.format; | ||
|
||
void main() { | ||
|
||
SetConfigFlags(ConfigFlag.FLAG_WINDOW_RESIZABLE); | ||
SetTraceLogLevel(TraceLogType.LOG_NONE); | ||
InitWindow(800, 600, "Hello, World!"); | ||
SetTargetFPS(60); | ||
|
||
scope (exit) CloseWindow(); | ||
|
||
auto theme = makeTheme!q{ | ||
|
||
GluiFrame.styleAdd!q{ | ||
|
||
margin = 10; | ||
backgroundColor = Color(0xff, 0xff, 0xff, 0xaa); | ||
|
||
}; | ||
|
||
}; | ||
|
||
GluiFrame innerExpand; | ||
GluiSpace root, screen1, screen2; | ||
|
||
screen1 = vspace( | ||
.layout!(1, "fill"), | ||
theme, | ||
|
||
vframe( | ||
button("Switch to screen 2", { root = screen2; }), | ||
), | ||
vframe( | ||
.layout!"end", | ||
label("hello"), | ||
), | ||
vframe( | ||
.layout!"fill", | ||
label("hello"), | ||
), | ||
vframe( | ||
.layout!(1, "start"), | ||
label("hello"), | ||
), | ||
vframe( | ||
.layout!(1, "fill"), | ||
|
||
innerExpand = hframe( | ||
.layout!(1, "fill"), | ||
button("toggle expand", { | ||
|
||
innerExpand.layout.expand = !innerExpand.layout.expand; | ||
innerExpand.updateSize(); | ||
|
||
}), | ||
), | ||
|
||
label("hello"), | ||
), | ||
); | ||
|
||
screen2 = vspace( | ||
.layout!(1, "fill"), | ||
theme, | ||
|
||
vframe( | ||
button("Switch to screen 1", { root = screen1; }), | ||
), | ||
vscrollFrame( | ||
.layout!(1, "fill"), | ||
theme.makeTheme!q{ | ||
|
||
GluiFrame.styleAdd!q{ | ||
backgroundColor = Color(0xff, 0xff, 0xff, 0xaa); | ||
margin = 10; | ||
padding = 10; | ||
}; | ||
|
||
GluiScrollBar.styleAdd!q{ | ||
margin.sideLeft = 4; | ||
padding = 4; | ||
}; | ||
|
||
}, | ||
|
||
cast(GluiNode[]) generate(() => label("Line of text")).take(150).array, | ||
|
||
), | ||
); | ||
|
||
root = screen1; | ||
|
||
while (!WindowShouldClose) { | ||
|
||
BeginDrawing(); | ||
|
||
ClearBackground(Colors.BLACK); | ||
root.draw(); | ||
|
||
EndDrawing(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.