Skip to content

Commit 06434bc

Browse files
committed
Fixed checkboxes
1 parent 271e72e commit 06434bc

6 files changed

Lines changed: 86 additions & 4 deletions

File tree

examples/bootstrap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
define('VISU_PATH_VENDOR', VISU_PATH_ROOT . DS . '..' . DS . 'vendor');
2525
define('VISU_PATH_RESOURCES', VISU_PATH_ROOT . DS . 'resources');
2626
define('VISU_PATH_APPCONFIG', VISU_PATH_ROOT . DS . 'ctn');
27-
2827
define('VISU_APPCONFIG_ROOT', '/examples.ctn');
2928

3029
/**

examples/debug/debug_console_demo.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ public function setupDrawAfter(RenderContext $context, RenderTargetResource $ren
5050
*
5151
* ----------------------------------------------------------------------------
5252
*/
53-
$quickstart = new Quickstart(function(QuickstartOptions $app) use(&$demoState)
53+
$quickstart = new Quickstart(function(QuickstartOptions $app) use(&$demoState, $container)
5454
{
55+
// Initalize the application
56+
// --------------------------------------------------------------------
57+
$app->container = $container;
5558
$app->windowTitle = 'VISU Debug Console Demo';
5659
$app->appClass = DebugConsoleQuickstartApp::class;
5760

examples/flyui/flyui_demo.php

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,82 @@ function(string $option) {
212212
FlyUI::end(); // end section
213213
});
214214

215+
/**
216+
* Demo: Components - Checkboxes
217+
*
218+
* ----------------------------------------------------------------------------
219+
*/
220+
UIDemo("Components - Checkboxes", function(RenderContext $context, RenderTarget $target, FlyUiDemoState $state) : void
221+
{
222+
static $enableNotifications = true;
223+
static $darkMode = false;
224+
static $autoSave = true;
225+
static $showGrid = false;
226+
static $enableSounds = true;
227+
228+
FlyUI::beginSection('Basic Checkboxes');
229+
FlyUI::beginLayout()
230+
->flow(FUILayoutFlow::vertical)
231+
->spacing(5);
232+
233+
FlyUI::checkbox('Enable Notifications', $enableNotifications, function(bool $checked) {
234+
echo "Notifications " . ($checked ? "enabled" : "disabled") . "\n";
235+
});
236+
237+
FlyUI::checkbox('Dark Mode', $darkMode, function(bool $checked) {
238+
echo "Dark mode " . ($checked ? "enabled" : "disabled") . "\n";
239+
});
240+
241+
FlyUI::checkbox('Auto Save', $autoSave, function(bool $checked) {
242+
echo "Auto save " . ($checked ? "enabled" : "disabled") . "\n";
243+
});
244+
245+
FlyUI::end(); // end layout
246+
FlyUI::end(); // end section
247+
248+
FlyUI::spaceY(20);
249+
250+
FlyUI::beginSection('Settings Panel');
251+
FlyUI::beginLayout()
252+
->flow(FUILayoutFlow::vertical)
253+
->spacing(5);
254+
255+
FlyUI::text('Display Options:', VGColor::rgb(0.3, 0.3, 0.3))->fontSize(14);
256+
FlyUI::spaceY(5);
257+
258+
FlyUI::checkbox('Show Grid', $showGrid, function(bool $checked) {
259+
echo "Grid display " . ($checked ? "enabled" : "disabled") . "\n";
260+
});
261+
262+
FlyUI::spaceY(10);
263+
264+
FlyUI::text('Audio Options:', VGColor::rgb(0.3, 0.3, 0.3))->fontSize(14);
265+
FlyUI::spaceY(5);
266+
267+
FlyUI::checkbox('Enable Sounds', $enableSounds, function(bool $checked) {
268+
echo "Sounds " . ($checked ? "enabled" : "disabled") . "\n";
269+
});
270+
271+
FlyUI::end(); // end layout
272+
FlyUI::end(); // end section
273+
274+
FlyUI::spaceY(20);
275+
276+
FlyUI::beginSection('Current State');
277+
FlyUI::beginLayout()
278+
->flow(FUILayoutFlow::vertical)
279+
->spacing(3);
280+
281+
FlyUI::text("Notifications: " . ($enableNotifications ? "ON" : "OFF"));
282+
FlyUI::text("Dark Mode: " . ($darkMode ? "ON" : "OFF"));
283+
FlyUI::text("Auto Save: " . ($autoSave ? "ON" : "OFF"));
284+
FlyUI::text("Show Grid: " . ($showGrid ? "ON" : "OFF"));
285+
FlyUI::text("Enable Sounds: " . ($enableSounds ? "ON" : "OFF"));
286+
287+
FlyUI::end(); // end layout
288+
FlyUI::end(); // end section
289+
});
290+
215291
/**
216292
* Main Entry Point
217293
*

examples/profiling/render_pass_profiling.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
*
1414
* ----------------------------------------------------------------------------
1515
*/
16-
$quickstart = new Quickstart(function(QuickstartOptions $app) use(&$state)
16+
$quickstart = new Quickstart(function(QuickstartOptions $app) use(&$state, $container)
1717
{
18+
// Initalize the application
19+
// --------------------------------------------------------------------
20+
$app->container = $container;
1821
$app->ready = function(QuickstartApp $app) {
1922
$app->loadCompatGPUProfiler();
2023
};

src/FlyUI/FUITheme.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ public function applyGenerals() : void
248248
// checkboxes
249249
$this->checkboxBackgroundColor = new VGColor(0.902, 0.902, 0.901, 1.0);
250250
$this->checkboxHoverBackgroundColor = $this->checkboxBackgroundColor->lighten(0.05);
251+
$this->checkboxActiveBackgroundColor = $this->primaryButton->backgroundColor;
251252

252253
// button group
253254
// --------------------------------------------------------------------

src/Quickstart/QuickstartApp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function __construct(
142142

143143
// fetch or create the shader collection
144144
$this->shaders = $getOrCreateService('shaders', function() {
145-
$shaders = new ShaderCollection($this->gl, $this->container->getParameter('visu.path.resources.shader'));
145+
$shaders = new ShaderCollection($this->gl, VISU_PATH_RESOURCES_SHADER); // @phpstan-ignore-line
146146

147147
$shaders->enableVISUIncludes();
148148
$shaders->addVISUShaders();

0 commit comments

Comments
 (0)