Log In  

I'm making a sexy little 16x16 sprite editor with playback and more that should rely on the D-Pad and Buttons. Doing so mainly for use on the Retroflag-GPi case, or any other handheld.


Cart #animate-14 | 2021-01-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

UPDATE 11.01.21

  • Added Move-tool
  • Added Palette-swapper
  • Added Tooltips on hover (disable in menu)
  • Added Save (cart overwrite? dunno?)
  • Added Export Spritesheet
  • Added Clear All (Default Empty Project)
  • Improved usability/ button press consistency


  • Improved Menu Items / File related Functions
  • Nerf the Mouse
  • Subtle Sound effects
  • General Debugging

Give it a go!
Any help/advice/ideas appreciated.

x Phume

thanks to @tjbynum, @paloblancogames, @shy, @mischa_u

P#85942 2020-12-30 21:29 ( Edited 2021-01-11 22:32)


For your quick but smooth cursor, you might want to check out the hardware addresses in memory. Poking values to 0x5f5c and 0x5f5d lets you set the framerate for first press and repeated presses for all btnp inputs.

P#85948 2020-12-31 01:22

@shy thanks! Will give it a shot.

EDIT: managed to get the mouse nice and snappy, so might not need to use += and -= on the D-Pad
problem was the 7x7 brush/cursor :-)

--mouse to brush position
P#85950 2020-12-31 01:40 ( Edited 2021-01-01 03:23)

Nice UI! To be able to choose colors "in-line", what do you think about adding X+◀️▶️ controls to pick from the color palette, without having to move to the bottom row?

P#85963 2020-12-31 08:31

@mischa_u danke schön. to be honest id rather get the mouse-dpad to feel right instead, you can also pipette with X like in the normal editor, so you dont have to go down as often. but ill try i out :-) maybe the scrolling feels good

P#85967 2020-12-31 12:47 ( Edited 2021-01-01 00:50)

this is awesome. can't wait to take a closer look at it when I get home this evening. thanks for this!

P#85984 2020-12-31 19:14

@mischa_u that pipette cycle idea feels fab, chapeau! x

P#86048 2021-01-02 00:22

@shy @mischa_u @tjbynum did a new version (see cart) changed the init post a bit too. try and figure it out! <3

there's a hole in the menu for.. I dunno... a palette switcher...
...or a d-pad on/off for 8-directional controls during playback.

still haven't looked into how to save projects, any suggestions?

P#86088 2021-01-03 04:26 ( Edited 2021-01-04 00:39)

i'm going to load this up this evening. i didn't have my handheld over the weekend. :(

P#86139 2021-01-04 17:28

@tjbynum lemme know what you think, its almost done i'd say.

  • needs a memory save function for project specific settings (atm its just the spitesheet)
  • and an 8th menu button
P#86187 2021-01-06 00:05 ( Edited 2021-01-06 00:13)

@Phume love it dude, great job! it's really snappy and quite fun to create with the Retroflag-GPi Case.
Edit: Help Screen is nice too :D

P#86247 2021-01-07 21:08 ( Edited 2021-01-07 21:10)

@tjbynum :-D thnx

added a move option to that hole in the menu (seemed like the best thing to do)
now it needs a good save function and some minor control tweaks for consistency.


P#86248 2021-01-08 00:34 ( Edited 2021-01-08 00:39)

@shy managed to implement a palette switcher,
including that new scanline trick :-/ what a slog ;-)
(X+arrows when in the palette tray, give it shot!)

I was meaning to ask you if you had any tips on saving carts?
in this case: sprite sheet, some ints, some bools and 3 tables (see post update).

Any ideas? Thx!

EDIT: Managed to implement a save function + sprite sheet overwrite using your bitwise tutorial (coincidence! haha) Question still applies though, I don't really get what I'm doing.

P#86347 2021-01-11 10:34 ( Edited 2021-01-11 19:26)

This tool is actually shaping up really well! Noticed one small glitch when you hold X and move the mouse up and down in the main area - it does undo / redo steps as you move the mouse, which felt very odd. And the only way I was able to get to the palette swapping menu was by moving the mouse to the bottom palette and then holding X while pressing arrow keys, but once I figured that out it was pretty intuitive. Nice work on that feature!

For saving carts, there are three methods (two listed in the manual, and one that's kind of a loophole): cstore, persistent data, and cartridge creation. cstore gives you 6kb of storage at the cost of replacing the cart data in ROM of some cartridge (0x0000-0x5fff in memory), persistent data only gives you 256 bytes (and also exists in the memory/ROM at addresses 0x5f00-0x5f3f), and cartridge creation theoretically gets you massive Lua-based storage at the cost of usability.

For your project, I'd recommend saving like this:

  • use cstore(0,0,0x2000) to save the spritesheet, optionally with a string to specify the cartridge file name.
  • save the other project data as raw numbers in persistent data. If you have <= 64 ints/bools in total, you can just use dset() and dget(). Otherwise you'll have to bit-shift the bools (and maybe ints too) to compress how much space each one takes. For tables, just save their contents one value at a time, and then load them back in in the exact same way.

If your projects have a huge amount of data to save, you can also look into writing new carts via printh(). I don't recommend this, but it is the most storage you'll get. This link explains the basics, and this link shows a fully implemented demo for saving tables of data to be loaded later.

It takes advantage of the fact that #include happens at runtime, so the next time the cart reboots or runs, the updated project settings data file would be injected into the Lua code right where the #include line is. This method won't work with BBS carts at all, though, so it's definitely a bit of a limited hack.

Good luck, that's all the advice I have on saving files!

P#86378 2021-01-11 21:48

@shy yeah it's still a bit of a mouse/d-pad mismatch in terms of the controls atm.
I do want to prioritise the d-pad so that it can be used on a handheld (hence the oversized 7x7 brush) so I think i'll remove mouse_move==d-pad usability when it comes to undo/palette, ect.
L/R Click==O/X Btns seems fine on the other hand.

I think I used roughly what you described for saving, but still kinda confused when it comes to BBS/Local saves/Export. Essentially I want a standalone little cart that you can just duplicate as if it was (is) also the project file. Hence my last qu: any way I can retrieve the cart filename from within the script? I found the file commond and file() function but couldn't isolate a string.

Amazing advice. Much Appreccio <3 Thanks!

P#86380 2021-01-11 22:21 ( Edited 2021-01-11 22:25)

[Please log in to post a comment]