Get the App
SLTechnology News&Howtos  ›  Development  › 

How to make a gluttonous snake game with PHP GUI

Shulou Source: shulou.com Published: 2022-06-01 19:42:40 10月18日 Update

This article introduces the relevant knowledge of "how to use PHP GUI to make a gluttonous snake game". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Install extension

The installation steps for the official manual are from linux:

Requirements: PHP 7 libui (use current master) Windows/MacOSX/Linux (GTK-3) Install re2c: sudo apt install re2cInstall libui: git clone https://github.com/andlabs/libui.git cd libui sudo cp * .h / usr/local/include/ cmake. Cd out sudo cp * / usr/lib/Install ui: Method one: use pecl: sudo pecl install channel://pecl.php.net/ui-2.0.0 Method two:build source code: git clone https://github.com/krakjoe/ui.git cd ui phpize make sudo make installEnable ui.so: sudo echo 'extension=ui.so' > / etc/php/7.0/mods-available/ Ui.ini sudo ln-s / etc/php/7.0/mods-available/ui.ini 20-ui.iniTest: php-m git clone https://github.com/krakjoe/ui.git cd ui/examples/ php snake.php requirements (written in the document)

PHP 7

Libui (use current master)

Windows/MacOSX/Linux (GTK-3)

Download windows's dll on PECL. I used php7 nts 64-bit, so I used this:

Download the file directory structure:

Next:

Php_ui.dll is placed in php's ext directory, and then php.ini joins extension=php_ui.dll

PthreadVC2.dll and libui.dll are placed in the php directory, that is, at the same level as the php.exe file

Run the php-m command in cmd to see if the module is loaded correctly

Test a gluttonous snake

There is a snake.php file (gluttonous Snake) in the folder downloaded by the ui extension. Run it in this directory:

Php snake.php

There is also a file for particle effects (starfield.php):

This is the end of the content of "how to make a Snake Game with PHP GUI". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Files directories next content more knowledge operation practicality learning up and down that is level command dilemma official actual situation manual effect folder Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Technology Shulou Information MySQL MariaDB