Page 1 of 1

Snippet for Tileviewer

PostPosted: 04 Feb 2014, 16:58
by Sauer2
Hi,

Context: I earlier asked for an image viewer which shows images as tiles.
Charlie named a few editors with the capability, but that somehow wasn't ideal for my workflow since I mainly use Inkscape. So I created the most minimal tile viewer I could think of, which displays the image as a 5 x 5 grid and thought maybe you could use that C snippet, too, if that fits to your workflow.
You just put the image as the first parameter, which means you can drag and drop an image on the executable symbol, if your desktop supports it.
tv.png

It depends on SDL2 and SDL2_Image.
Using MINGW, you can compile it with:
{l Code}: {l Select All Code}
gcc tiledview.c -I "C:\PATH_TO_SDL_Image\include\SDL2" -I "C:\PATH_TO_SDL\include\SDL2" -L "C:\PATH_TO_SDL_Image\lib" -L "C:\PATH_TO_SDL\lib" -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -Os -Wall -Wextra -mwindows

On Linux it should be basically the same, minus the paths and the Windows/MINGW flags.

Feedback is welcome!

Re: Snippet for Tileviewer

PostPosted: 05 Feb 2014, 00:09
by c_xong
Nice utility. Is this mainly for making seamless tiles? If so (and I know this probably isn't easier), for inkscape there's this tutorial on how to get it to display cloned tiles for seamless tile editing: http://verysimpledesigns.com/vectors/in ... terns.html

I think https://gist.github.com/ is also a good place to share snippets like this.

Re: Snippet for Tileviewer

PostPosted: 05 Feb 2014, 05:23
by Sauer2
Hi cxong,

you are right, this is for seamless tiles, like the floor tiles in C-Dogs. Problem is, I never know if the borders are acceptable or too bold without checking out.
And while I'm not in the right state to look at complicated tutorials at the moment, I'll have a look at this.
About gists: Is that the pastebin of Github?

Also: I could deliver binaries for Windows on demand.

Re: Snippet for Tileviewer

PostPosted: 05 Feb 2014, 06:25
by acme_pjz
Hi Sauer2,

I think a simple html file with tiled background is better than a C program :)

Re: Snippet for Tileviewer

PostPosted: 05 Feb 2014, 06:31
by Sauer2
Hi, acme_pjz,

while this is true, you can't drag and drop \images into HTML pages/ without some programming/typing work.

Re: Snippet for Tileviewer

PostPosted: 05 Feb 2014, 11:02
by Sauer2

Re: Snippet for Tileviewer

PostPosted: 11 Feb 2014, 17:43
by Sauer2
Update: You can now control the grid size with the arrow keys.