GFX-Shift-Tool

Tools which are useful for mod development.
YuokiTani
Smart Inserter
Smart Inserter
Posts: 1037
Joined: Thu May 08, 2014 7:57 pm
Contact:

GFX-Shift-Tool

Post by YuokiTani »

okay this is only interesting for modders who use own gfx and need shift-values but it's related to factorio.
it's not a mod and not a gfx-contributions or texture-request so it's here now.

the *.zip file contains the source-code and in bin/debug-folder the *.exe. you should check the code and compile a running version by yourself.
(you can get Microsoft Visual Studio Express 2013 - Desktop for free)

Improved PHP-version

C# Version

YT-Video shows both in Action
Last edited by YuokiTani on Wed Jun 03, 2015 1:40 pm, edited 1 time in total.
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: GFX-Shift-Tool

Post by L0771 »

Hi, could you post the code?

Is a good tool and a big help.
YuokiTani
Smart Inserter
Smart Inserter
Posts: 1037
Joined: Thu May 08, 2014 7:57 pm
Contact:

Re: GFX-Shift-Tool

Post by YuokiTani »

sure of course, i had yesterday corrected because it had a little error (i had thinking wrong) - now works fine

if you want download source with 5x example-pics and icons
Download here - 309 kB

to get the values - set the grid to size you have in selection-box then shift the yellow-grid in position you want. the yellow grid show how the game the image see's.

to run you need
- Apache or other Webserver with PHP - Support (if you not have index.php set in http-conf you need rename the index.php into index.html)
- enabled GD-Lib in PHP (should be standard-on)

i think about a entity/item/recipes generator with same simple code princip (php because in other language i think needs way more time), because it's painfull to copy & paste and have all options set right. i need only to think if i want a db-support (mysql or sqlite) or not. a db-support would allow handle the whole mod, calculate stuff automatic and also generate the complete mod-code from nothing, can make missing things and links between tech/items visible, rename stuff easier etc.

index.php (you know ;) to start things - can be renamed)
index.php
showoverlay.php (included by index.php) - can merged into main if you want
showoverlay.php
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: GFX-Shift-Tool

Post by L0771 »

I've uploaded here, i think is easier use a online server than make my own server.
The only problem is, temp.png doesn't refresh like the video, but is working.
YuokiTani
Smart Inserter
Smart Inserter
Posts: 1037
Joined: Thu May 08, 2014 7:57 pm
Contact:

Re: GFX-Shift-Tool

Post by YuokiTani »

no problem i think i can fix this. (for the moment you can use F5 to refresh your browser)

i have not uploaded because it needs still a upload-picture function at the moment :)
so the only one who can add images and know the names are you.

i will make a better version asap.
YuokiTani
Smart Inserter
Smart Inserter
Posts: 1037
Joined: Thu May 08, 2014 7:57 pm
Contact:

Re: GFX-Shift-Tool

Post by YuokiTani »

i have changed the php-version a little and have made a C# version.

the *.zip file contains the source-code and in bin/debug-folder the *.exe. you should check the code and compile a running version by yourself.
(you can get Microsoft Visual Studio Express 2013 - Desktop for free)


Improved PHP-version

C# Version

YT-Video shows both in Action
User avatar
L0771
Filter Inserter
Filter Inserter
Posts: 516
Joined: Tue Jan 14, 2014 1:51 pm
Contact:

Re: GFX-Shift-Tool

Post by L0771 »

I like c# version :)
Very useful tool, remember add links to the first post :D
YuokiTani
Smart Inserter
Smart Inserter
Posts: 1037
Joined: Thu May 08, 2014 7:57 pm
Contact:

Re: GFX-Shift-Tool

Post by YuokiTani »

L0771 wrote:Very useful tool, remember add links to the first post :D
Thanks for the hint -> changed.
User avatar
MagicLegend
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Tue Dec 30, 2014 6:17 pm
Contact:

Re: GFX-Shift-Tool

Post by MagicLegend »

I can't get the phpversion to work. I've uploaded the files to my personal website (http://www.elska.nl/misc/fpicshift/index.php), but the buttons don't seem to do anything?

~ML
Very good at pressing buttons.
YuokiTani
Smart Inserter
Smart Inserter
Posts: 1037
Joined: Thu May 08, 2014 7:57 pm
Contact:

Re: GFX-Shift-Tool

Post by YuokiTani »

MagicLegend wrote:I can't get the phpversion to work. I've uploaded the files to my personal website (http://www.elska.nl/misc/fpicshift/index.php), but the buttons don't seem to do anything?
~ML
You get a Warning on your Website ...

Code: Select all

Warning: imagepng() [function.imagepng]: Unable to open 'temp.png' for writing in /csr/www/www.elska.nl/website/misc/fpicshift/showoverlay.php on line 34
it's because how the php-version works (i'am not a pro so i choose the dirty way) ->
i take the orginal-image and paint over the grid and save this as new image and display this new temp.png ...

to fix your problem 2 ways are possible ...
1) allow the script writing the temp.png
2) make a sub-directory and allow writing into this subdirectory, change then the paths for create and show the temp.png

Note:
the Php-version is not intended for online(internet)-use ... best use is at your home-pc if you run a webserver for other reasons. then its most benefit is zoom in with a webbrowser, and easy change of images. ... so the php-version has also no upload-function and makes it useless on online-websites (upload allows possible intrusion)

i suggest using the c# -version ... should be also can compile with mono ... i had also a java-version started but arrange the GUI raise my blood-pressure and so it stops.
NightmareInfinity
Inserter
Inserter
Posts: 21
Joined: Mon Nov 17, 2014 3:53 pm
Contact:

Re: GFX-Shift-Tool

Post by NightmareInfinity »

The reason the PHP version doesn't update the picture is because you don't have an expiration time set on the image. The browser is caching the image. If you press Shift+f5 it clears the cache and shows you the updated image.
This is my Signature. There are others like it but this one is mine.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: GFX-Shift-Tool

Post by ssilk »

You don't need to install a webserver for this. PHP includes it's own webserver.

See how to use it:
http://symfony.com/doc/current/cookbook ... lt_in.html
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: GFX-Shift-Tool

Post by ssilk »

You can ask Yuoki directly... if you are friendly he will surely help. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
RalleYTN
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Wed Feb 01, 2017 7:14 am
Contact:

Re: GFX-Shift-Tool

Post by RalleYTN »

Mind if I implement this code in the Modding IDE I'm currently working on?
Link to it is in my signature.
I'm currently working on a tool that will allow everyone to create mods for Factorio without having to learn any of the complicated stuff.
Follow the development here: viewtopic.php?f=137&t=40830.
YuokiTani
Smart Inserter
Smart Inserter
Posts: 1037
Joined: Thu May 08, 2014 7:57 pm
Contact:

Re: GFX-Shift-Tool

Post by YuokiTani »

yes, feel free to include or improve this.
jazziebgd
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Aug 03, 2018 6:54 pm
Contact:

Re: GFX-Shift-Tool

Post by jazziebgd »

Hope you don't mind, I made a js implementation (works in browser without server) and improved upon it a little. It is tested in chrome, you can see collision and selection boxes, drag image to adjust shifts, use multiple layers etc. You can play with it on https://codepen.io/jazziebgd/full/jvwmEj/
Post Reply

Return to “Development tools”