PHP code example of quasilyte / kphp-sdlite
1. Go to this page and download the library: Download quasilyte/kphp-sdlite library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
quasilyte / kphp-sdlite example snippets
uasilyte\SDLite\SDL;
// Perform a FFI::load() for the libraries.
// For KPHP you can do it anywhere, for PHP you need to do it in your preaload.php file.
SDL::loadCoreLib();
SDL::loadImageLib();
SDL::loadMixerLib();
SDL::loadTTFLib();
$sdl = new SDL();
$ok = $sdl->init() && $sdl->initTTF());
if (!$ok) {
die('SDL init error: ' . $sdl->getError());
}
$window = $sdl->createWindow("Main", SDL::WINDOWPOS_CENTERED, SDL::WINDOWPOS_CENTERED, 1000, 1000);
sleep(2);