Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /homepages/6/d26582548/htdocs/clickandbuilds/SchipselCompendium/wp-content/plugins/a3-lazy-load/admin/admin-interface.php on line 364

Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d26582548/htdocs/clickandbuilds/SchipselCompendium/wp-content/plugins/a3-lazy-load/admin/admin-interface.php:364) in /homepages/6/d26582548/htdocs/clickandbuilds/SchipselCompendium/wp-includes/feed-rss2.php on line 8
Snippet Compendium http://project-sn.de Collecting snippets for a better tomorrow. Fri, 18 May 2018 18:20:08 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.22 http://project-sn.de/wp-content/uploads/2018/03/cropped-cropped-stockvault-red-paper-snippets130509-1-32x32.jpg Snippet Compendium http://project-sn.de 32 32 Add Parallax Background to a 2D Game http://project-sn.de/add-parallax-background-to-a-2d-game http://project-sn.de/add-parallax-background-to-a-2d-game#respond Fri, 18 May 2018 18:18:54 +0000 http://project-sn.de/?p=46 Add Parallax Background to a 2D Game

1. Create a ParallaxBackground node. (It doesn’t need to be a child of the Camera2D node, but making it a child of the Camera2D node won’t break it either)
2. Create a ParallaxLayer node as a child of the ParallaxBackground.
3. Add your sprite as a child of the ParallaxLayer node and make sure Centered is off.
4. Go back to the ParallaxLayer node.
5. Under Motion, set Mirroring to the size of your sprite (e.g. 640×640).
6. Under Motion, fiddle with the Scale setting. This is how fast that ParallaxLayer will move in relation to the camera. 0.1, 0.1 can be a good starting point for something like a sky.
7. Run your game, and you should have a background that infinitely loops and also has a parallax effect.

Source:
Comment by Michelle M. @ https://youtu.be/uV5WKocIycY

]]>
http://project-sn.de/add-parallax-background-to-a-2d-game/feed 0
How to run multiple php Versions in parallel on XAMPP http://project-sn.de/how-to-run-multiple-php-versions-in-parallel-on-xampp http://project-sn.de/how-to-run-multiple-php-versions-in-parallel-on-xampp#respond Thu, 15 Mar 2018 10:08:56 +0000 http://project-sn.de/?p=14 Sometimes it’s beneficial to run several php versions in parallel on one local xampp (WIN) installation.
At the end we are running the main php version as module and the side-versions as cgi.

Working as seen today, here is a step by step list
Do it on your own risk & create a backup before playing 😉

Tested XAMPP: xampp-win32-7.2.1-0-VC15

1. Install XAMPP with the PHP Version you want to run mainly, e.g. PHP 7.2 => resides by default in Installpath\xampp\php
2. Copy other php Versions in Installpath\xampp\, eg PHP 5.4 in => Installpath\xampp\php5
If you are lazy like me, just grab the other php folder from old xampp installations, => beneficial since the used dlls are already in the right place
3 Make sure every php version on her own has a working php.ini.

use individual error logs per version:

   error_log="D:\xampp\php5\logs\php_error_log"
   
   error_log="D:\xampp\php\logs\php_error_log"
   

point to the correct extensions folder:

   ; Directory in which the loadable extensions (modules) reside.
   ; http://php.net/extension-dir
   ; extension_dir = "./"
   ; On windows:
    extension_dir="D:\xampp\php5\ext"
   
   ; Directory in which the loadable extensions (modules) reside.
   ; http://php.net/extension-dir
   ; extension_dir = "./"
   ; On windows:
    extension_dir="D:\xampp\php\ext"
   

3. edit the following files

apache\conf\httpd.conf
add codelines at the bottom of the file, the phpvhosts.conf will house our custom config

##custom
Include conf/extra/phpvhosts.conf

apache\conf\extra\httpd-xampp.conf
find and comment the loading lines for the php module: depending on your php version

# PHP-Module setup
#
#LoadFile "D:/xampp/php/php7ts.dll"
#LoadFile "D:/xampp/php/libpq.dll"
#LoadModule php7_module "D:/xampp/php/php7apache2_4.dll"

apache\conf\extra\phpvhosts.conf
create this file with following content

# Port-based virtual hosting: every php install uses a vhost on a different port, the main php version will listen to port 80 (defined in httpd.conf)
# Port are 84xx with xx for php version
Listen 8472
Listen 8454

### BASE virtualhost
### set up the main php version we're using, loading the main php version as module
<VirtualHost *:80>
    LoadFile "D:/xampp/php/php7ts.dll" 
    LoadFile "D:/xampp/php/libpq.dll"
    LoadModule php7_module "D:/xampp/php/php7apache2_4.dll"
    PHPINIDir "D:/xampp/php"
    php_value extension_dir "D:/xampp/php/ext/"
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .php
</VirtualHost>

### call  php 7.2  via port 
<VirtualHost *:8472>
</VirtualHost>


###  call php 5.4 via port && cgi
<VirtualHost *:8454>

        SetEnv PHPRC "D:/xampp/php5/"
      
        ScriptAlias /php-cgi/ "D:/xampp/php5/"
        <Directory "D:/xampp/php5">
            AllowOverride None
            Options None
            Require all denied
            <Files "php-cgi.exe">
                  Require all granted
            </Files>
        </Directory>

        <Directory "D:/xampp/cgi-bin">
            <FilesMatch "\.php$">
                SetHandler cgi-script
            </FilesMatch>
            <FilesMatch "\.phps$">
                SetHandler None
            </FilesMatch>
        </Directory>

        <FilesMatch "\.php$">
            SetHandler application/x-httpd-php-cgi
        </FilesMatch>
        <IfModule actions_module>
            Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
        </IfModule>
</VirtualHost>

4. restart your XAMPP Server
our server listens now on different ports and uses the respective php version but serves from always the same htdocs folder

maybe run a small phpinfo() on different ports to check if everything is working as intended

localhost => php7
localhost:8474 => php7
localhost:8454 => php5

if you want to add more php versions, add them in the phpvhosts.conf file with an additional port

References:

GGGeek Tutorial
StackOverflow

5. Bonus:
If you want to access your different php installations not only via hostname:Port you can also set up some named virtual hosts

5.1 add the host names to your hosts file.

C:\Windows\System32\drivers\etc\hosts

add the following lines for new localhost names


127.0.0.1     php5.localhost
127.0.0.1     php7.localhost

5.2 edit the phpvhosts.conf file to tell apache what to do when the given hostname is called

add the Name VirtualHost:

Listen 8472
NameVirtualHost *:8472

Listen 8454
NameVirtualHost *:8454

In each Virtualhost tag add the name of the vhost with port 80
inside tag add the ServerName attribute

for php7

<VirtualHost *:8472 php7.localhost:80>
      ServerName php7.localhost
</VirtualHost>

for php5

<VirtualHost *:8454 php5.localhost:80>
      ServerName php5.localhost
      [...]
</VirtualHost>

5.3 Restart your xampp.

You can now call the pages in your htdocs folder with php5 or php7

localhost => php7
localhost:8474 => php7
php7.localhost => php7

localhost:8454 => php5
php5.localhost => php5

]]>
http://project-sn.de/how-to-run-multiple-php-versions-in-parallel-on-xampp/feed 0