Skip to content

wiretail/flappyphpant-nativephp

Repository files navigation

flappyphpant-nativephp

Testing flappyphpant (PHP-GLFW and the VISU framework) + NativePHP Electron

Smushed together with slight modification are:

It's a demo OpenGL graphical game, written in PHP.

FlappyPHPant 2D PHP Game

This is minimal brute-force example to execute php-glfw and electron together. And the entire Laravel stack to serve a static launch page, for good measure.

To run: run the installer in the latest release

To build:

git clone https://github.com/wiretail/flappyphpant-nativephp.git
cd flappyphpant-nativephp

composer install

php artisan native:install
# say yes to both questions

php artisan native:serve
# to run it locally again

php artisan native:build
# win-x64 only
# if you get an error popup, say ok, and it will probably build fine anyway

If it worked, the installer executable with be in ./dist/flappyphpant-nativephp-1.0.0-setup.exe Run it to install the electron app -- it may be very slow. (And it should still work even with an error/popup during the process.)

Note: When the app runs you'll get a demo warning from BoxedApp's Packer. Click OK.

This is because NativePHP expects a single "php.exe" file in php-bin's PHP zip, and will fail otherwise. Creating a real static build with GLFW included seems like a "fun" larger project, nor can nativephp/electron handle a zip with multiples files. So the PHP instance used here is a normal minimal many-file version that is then packed with trial version of Packer. That is then copied over the /vendor/nativephp/php-bin/bin/win/x64/php-8.3.zip file as a post composer install/update command.

One could fork nativephp/php-bin to add the new zip/exe file, and either actually build it statically, or also fork nativephp/electron and update nativephp\electron\resources\js\php.js to handle multiple files in it's currently hardcoded unzip routine.

It's very much a hack though, so...that's how it works right now. And it'll crash if you minimize the game window.

About

Testing flappyphpant + PHP-GLFW + Visu + NativePHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages