sdl3/examples/SimpleButtonExample.php
2025-10-23 10:14:41 +02:00

27 lines
620 B
PHP

<?php
require_once __DIR__ . '/../vendor/autoload.php';
use PHPNative\Framework\Application;
use PHPNative\Ui\Widget\Button;
use PHPNative\Ui\Widget\Container;
use PHPNative\Ui\Widget\Label;
// Check PHP version
if (PHP_VERSION_ID < 80100) {
die("This demo requires PHP 8.1+ for Fiber support.\nYour version: " . PHP_VERSION . "\n");
}
$app = new Application('Button Example', 800, 600);
// Button with different padding
$button2 = new Button(
text: 'Another Button',
style: 'm-5 p-15 hover:bg-green-200',
onClick: function () {
echo 'test2';
},
);
$app->setRoot($button2);
$app->run();