Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Runer112 on June 24, 2010, 09:57:50 pm

Title: Sprite Editor
Post by: Runer112 on June 24, 2010, 09:57:50 pm
I made a post for the sprite editor I made a while back, but it was in the middle of a topic that has since floated to the bottom of the list and is hard to find in that topic even if you found the topic itself. So, I'm making a new topic just for my sprite editor! It's a whopping 8060 bytes, but that's because it has all of this:


><FEATURES><

-8x8 or 16x16
-Black and white, 3-scale grayscale, or 4-scale grayscale
-Multiple zoom views visible at once
-Realtime sprite hex display
-Hex input
-Invert colors
-Flipping horizontally or veritcally
-Rotating clockwise or counterclockwise
-Create, edit, and save as many sprites as memory allows
-Delete sprites


><INTERFACE><

In the top-left corner will be the number of the current sprite being edited. If a grayscale sprite is being edited, below that will be an indicator as to which buffer is currently active. In 8x8 mode, the sprite will be displayed at 1x, 2x, and 6x, zoom, with the hex data for the active buffer displayed at the bottom of the screen. In 16x16 mode, the sprite will be displayed at 1x and 4x zoom, with the hex data for the active buffer being displayed on the right side of the screen.


><COMMANDS><

Code: [Select]
|A| = Works in all modes
|G| = Works only in grayscale modes
|4| = Works only in 4-scale grayscale mode

Arrow keys |A| Move cursor
2nd |A| Alternate current pixel between black and white
ALPHA |G| Alternate current pixel between gray and white
X,T,θ,n |4| Alternate current pixel between dark gray and white
MODE |A| Alternate part of current pixel on active buffer
^ |G| change active buffer
TAN |A| Invert active buffer
DEL |A| Back up one hex character
STAT |A| Advance one hex character
0-F |A| Hex input on current buffer
x |A| Flip horizontally
÷ |A| Flip vertically
( |A| Rotate counterclockwise
) |A| Rotate clockwise
+/- |A| Change active sprite
F2 |A| New 8x8 sprite
F3 |A| New 16x16 sprite
F5 |A| Delete sprite

** If you find any bugs, want to suggest any features/changes, or just want to say how great of a guy I am for making this, please post here and tell me about it! **
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 24, 2010, 09:59:45 pm
Cool, glad you made a new topic about it. I'll try it asap! ^^

By color inverting, do you mean we can swap light gray with dark, white, black, etc?
Title: Re: Sprite Editor
Post by: Runer112 on June 24, 2010, 10:06:34 pm
Inverting colors works for each buffer individually, flipping all the bits corresponding to that buffer. That means in a black and white image, it will simply invert the colors. However, in images like 4-level grayscale sprites, you can either invert all the colors (black to white, white to black, gray to dark gray, dark gray to gray) by inverting both buffers, or you can invert only one buffer.

EDIT: I just realized, I never tested color inverting for 16x16 sprites, only 8x8. I need to check to make sure it works for 16x16.

EDIT 2: It works for 16x16 black and white sprites, but not grayscale... Hmm, let me try to fix that.

EDIT 3: Fixed.
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 24, 2010, 10:35:31 pm
Aaaah I see ^^

Now that I am back from Unreal Tournament 2004 I will check it out :)
Title: Re: Sprite Editor
Post by: ztrumpet on June 24, 2010, 10:41:00 pm
Excellent!  Is this the same one from the other topic? :)
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 24, 2010, 10:41:49 pm
I think it is the same, altough updated. He should probably make new screenshots, though, because like the other versions, the screenies got lost in the many pages too ;D
Title: Re: Sprite Editor
Post by: calcdude84se on June 24, 2010, 10:42:46 pm
Hurray, updates! Yeah, this definitely deserves more attention than its place in the middle of another topic.
This is going on my calc. Now. (Or tomorrow, actually...)
Title: Re: Sprite Editor
Post by: Mighty Moose on June 24, 2010, 11:09:32 pm
I tried your original one on my calc, but every time I ran it, it would only run up to the "Grayscale level (2-4):" screen and then quit working.  After several ram clears, it became clear to me that it was not going to work.  It worked fine on WabbitEmu, though.  I am so confused ???
Title: Re: Sprite Editor
Post by: Runer112 on June 24, 2010, 11:26:33 pm
Try it again maybe? It's had some bug/compatibility fixes since the first release.
Title: Re: Sprite Editor
Post by: Mighty Moose on June 24, 2010, 11:36:06 pm
Cool.  I'll try it tomorrow then (Maybe I'll get it to work this time :)).
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 12:07:48 am
WOW! I must say I am impressed, and this gotta be the best sprite editor I ever tried on my calc. It has most stuff someone would need. I am going to make a screenshot soon. There is only one thing I wonder, though:

How do you go back through previous sprites during editing? The only way I could figure out is to delete all sprites saved afterward, which would suck if I needed to edit an old sprite a bit.
Title: Re: Sprite Editor
Post by: Magic Banana on June 25, 2010, 12:10:51 am
Nice. This will definitely help me when viewing my sprites on calc.
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 12:18:05 am
Screenie!
Title: Re: Sprite Editor
Post by: Runer112 on June 25, 2010, 12:44:41 am
WOW! I must say I am impressed, and this gotta be the best sprite editor I ever tried on my calc. It has most stuff someone would need. I am going to make a screenshot soon. There is only one thing I wonder, though:

How do you go back through previous sprites during editing? The only way I could figure out is to delete all sprites saved afterward, which would suck if I needed to edit an old sprite a bit.

Oops, I forgot to document that! Use + and - to switch the active sprite.
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 12:48:53 am
OOoh ok thanks ^^
Title: Re: Sprite Editor
Post by: Runer112 on June 25, 2010, 12:52:30 am
By the way nice screenshot, I need to get around to making one of my own but I'm too lazy ;)
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 01:07:05 am
Thanks. I wish I could have got the grayscale looking better, though. In Wabbitemu it looked fine, but in the screenshot, for some reasons, it failed.
Title: Re: Sprite Editor
Post by: Builderboy on June 25, 2010, 01:28:37 am
this is a very epic sprite editor my friend ^^ Couldnt find any bugs with it myself :) And had quite fun making various sized sprites!

@Dj, hey did you know that you can make Wabbit emulate perfect greyscale by going to display options and selecting 'Game Grey' ? it makes emulation look very clean and neat :]
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 02:19:20 am
Yeah that's what I did and still got the result above. On the calc LCD it was looking perfect, but then in the screenshot it looked crappy :(
Title: Re: Sprite Editor
Post by: Builderboy on June 25, 2010, 02:22:29 am
:( Did you have the number of shades set to the right amount? 
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 02:22:52 am
all maxed out
Title: Re: Sprite Editor
Post by: Builderboy on June 25, 2010, 02:23:36 am
ah thats the problem, you only want 4 shades of grey if you are emulating a 4 shade sprite :)
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 02:27:06 am
Oh ok, but what about if I want to emulate both 3 and 4 at once? (such as the screenshot)
Title: Re: Sprite Editor
Post by: Builderboy on June 25, 2010, 02:30:26 am
hurm, i dont know of a way.  I guess you could just do it on 4, and get a small bit of dithering if you did 3 scale
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 02:35:12 am
I personally found it rather ugly at 4. I guess for multiple levels itmight be best to setup settings as high as possible to balance both
Title: Re: Sprite Editor
Post by: Builderboy on June 25, 2010, 02:36:34 am
yeah i guess when doing multiple different types of grey, you'll just have to fiddle with the settings to preference.
Title: Re: Sprite Editor
Post by: Quigibo on June 25, 2010, 04:31:42 am
The reason the gray looks bad on wabbit is that this grayscale was from an older version of Axe that had the slow routine.  I compiled it for 0.3.1 and the gray looks perfect on both settings with "Game Gray 7".  You have to remove the SetupEditor command to compile from source though since its not needed anymore.  It looks much nicer on calc as well.
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 08:59:05 am
Strange, the version I had was compiled with 0.3.1 (I used the source, which didn't contain any SetUpEditor command. I opened it in SourceCoder then did a CTRL+F partial match search on Setup and it said it couldn't find anything. Are you sure you downloaded the version from this topic Quigibo?), but yeah I didn't try Game Gray 7, I think it was set to 12 or whatever is the max
Title: Re: Sprite Editor
Post by: Mighty Moose on June 25, 2010, 10:16:52 am
It has most stuff someone would need.

What more could he add?  It looks pretty good already.
Title: Re: Sprite Editor
Post by: Runer112 on June 25, 2010, 10:31:43 am
The reason the gray looks bad on wabbit is that this grayscale was from an older version of Axe that had the slow routine.  I compiled it for 0.3.1 and the gray looks perfect on both settings with "Game Gray 7".  You have to remove the SetupEditor command to compile from source though since its not needed anymore.  It looks much nicer on calc as well.

My included compiled program was compiled with Axe 0.3.1
Title: Re: Sprite Editor
Post by: Quigibo on June 25, 2010, 02:05:24 pm
Oh wait, you're right  :-[  I must have accidentally clicked on the old copy.  I had both on my desktop.
Title: Re: Sprite Editor
Post by: Runer112 on June 25, 2010, 03:10:41 pm
If you're just looking at the sprite and not changing it, the only thing happening is checking keypresses and displaying the screen, so the grayscale updates pretty fast and looks pretty good on an actual calculator.
Title: Re: Sprite Editor
Post by: Mighty Moose on June 25, 2010, 03:18:09 pm
Sorry to put a bug in your ear again, Runer, but it seems I have encountered a problem (no pun intended).
I just tried your updated file on-calc, but I am still having the same problem.  I don't know if it's just my calc or TI-Connect or something else, but something wierd is going on here.
Title: Re: Sprite Editor
Post by: Runer112 on June 25, 2010, 04:55:32 pm
So you said you get to the gray level prompt screen? What happens then?
Title: Re: Sprite Editor
Post by: Mighty Moose on June 25, 2010, 04:58:30 pm
I get an epic pause, like it is loading or something epic will happen, and then I get a ram clear. (Good thing I have omnicalc :P)
btw, I am running from MirageOS.

EDIT: By using Mirage interrupt ON+Clear, I was able to get to other screens, like 16x16 sprites, (In the original version, at least) but they function horribly and they don't draw correctly.
Title: Re: Sprite Editor
Post by: ztrumpet on June 25, 2010, 05:04:10 pm
Awesome editor Runer!  I really like the ( and ) options. ;D
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 06:35:52 pm
It has most stuff someone would need.

What more could he add?  It looks pretty good already.
Yeah I agree, I wasn't saying it was bad. I just said this since it had pretty much what you needed for sprite making. The only improvement I can think about is filling areas of a sprite with a color or filling the entire sprite with black, white, light gray and dark gray, but I can't imagine how much of an hassle the former feature would be to implement, since everything works with hex rather than pixel by pixel

And obviously exporting to external string, but that's not available in Axe yet. Maybe through inline ASM or something later.
Title: Re: Sprite Editor
Post by: Runer112 on June 25, 2010, 09:08:40 pm
Yeah, the main drawing features I'd like to add are filling and lines, but with the program at something like 8060 bytes already and pushing the maximum size limit, it would be difficult to add them.
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 09:13:36 pm
Yeah that's what I guessed. Of course there could always be the option of making it an APP. It would have the tradeoff of taking several more KB, but not take any RAM when not executed (so no need to archive/unarchive stuff when doing sprite editing)
Title: Re: Sprite Editor
Post by: Runer112 on June 25, 2010, 09:55:31 pm
Yeah, I'd really like to make it an App. Then I can also add more features, like sprite copying, changing gray level, making project groups, adding back the help screen I had to remove to save space...
Title: Re: Sprite Editor
Post by: ztrumpet on June 25, 2010, 09:59:21 pm
I'd love this as an App that takes up most of a page, and since Runer's making it I'm sure it will be great! ;D

Runer, I just noticed I normally type "Runner". Sorry about that, and I'll try to change my ignorance. :)
Title: Re: Sprite Editor
Post by: DJ Omnimaga on June 25, 2010, 10:01:20 pm
Yeah I did that too often on IRC x.x. I guess it's because the nickname is close to the word Runner :P
Title: Re: Sprite Editor
Post by: Runer112 on June 25, 2010, 10:11:06 pm
Yeah everybody glances at the name and calls me Runner, after almost 6 years of being addressed as Runner I've gotten used to it.
Title: Re: Sprite Editor
Post by: Michael.3545 on June 25, 2010, 10:11:31 pm
It seems that there are several of you with this program.  Are you all beta testers, or is this already downloadable from somewhere?  

EDIT:  Woah, there ARE two 'n's in his name.  How did I miss that?  It is voodo, I tell you.
Title: Re: Sprite Editor
Post by: ztrumpet on June 25, 2010, 10:12:48 pm
It seems that there are several of you with this program.  Are you all beta testers, or is this already downloadable from somewhere? 
Check the bottom of the first post of this topic. :)
Title: Re: Sprite Editor
Post by: Michael.3545 on June 25, 2010, 10:16:19 pm
I have no idea how I missed that.
Title: Re: Sprite Editor
Post by: Runer112 on June 25, 2010, 10:49:03 pm
Yeah, I'm the only one working on this project, though others help find bugs/suggest features. And yeah, there's only one "N" in my name. :P
Title: Re: Sprite Editor
Post by: nemo on July 02, 2010, 12:35:15 pm
runer, i'm not sure how you invert sprites but i have a suggestion, if you don't do this already. pretend your sprite data is in L1.
Code: [Select]
For(A,0,7
255-{L1+A}->{L1+A}
End

this "inverts" your sprite data, one byte at a time. thought i would share, just in case.
Title: Re: Sprite Editor
Post by: ztrumpet on July 02, 2010, 12:49:17 pm
Nemo, that's some really cool code!  Nice job! ;D
Title: Re: Sprite Editor
Post by: DJ Omnimaga on July 02, 2010, 05:24:43 pm
mhmm interesting trick, I guess it could also be useful for other stuff as well :)
Title: Re: Sprite Editor
Post by: nemo on July 03, 2010, 12:45:21 am
i use it in my tilemapper program. imaginary points to anyone who figures out how to modify that routine to make it invert sprites smaller than 8x8 (: anyway, i can't really think of any use besides inverting sprites/tiles, though. i just posted it in case runer was using two for loops with a pxl-change.
Title: Re: Sprite Editor
Post by: Runer112 on July 03, 2010, 12:50:34 am
Actually I was looping through bytes and inverting them, although I was using {pointer} xor 255→{pointer}. I forgot 255 xor X=255-X, but I'll use the subtraction because it's smaller and probably faster.
Title: Re: Sprite Editor
Post by: Builderboy on July 03, 2010, 12:54:32 am
if your sprite data is in L1 and your X width is in X (less than or equal to 8) and your Y width is in Y (less than or equal to 8)

Code: [Select]
255/(9-X)->A
For(F,0,Y-1
A xor {L1+F}->{L1+F}
End

Hypothetical but it should work :D
Title: Re: Sprite Editor
Post by: nemo on July 03, 2010, 01:01:50 am
builderboy: doesn't work. i tried to invert a blank 4x4 tile and got  3333333300000000 as my hex code. you can't just divide 255 by a number, you need to subtract from it. a 7x7 sprite needs to subtract uses 254, since each byte is a row in the sprite, to subtract 1 pixel (or 1 bit) you would subtract just 1. if you needed to subtract two bits to get a 6x6 sprite, you would subtract 3.
Title: Re: Sprite Editor
Post by: Quigibo on July 03, 2010, 01:05:02 am
What about e^(X)-1->A  That should work with X between 0-8
Title: Re: Sprite Editor
Post by: nemo on July 03, 2010, 01:10:42 am
i don't think so. here's a table.

sprite size      :      number to subtract from
8                         255
7                         254
6                         252
5                         248
4                         240

Title: Re: Sprite Editor
Post by: Builderboy on July 03, 2010, 01:12:06 am
Oh silly me i mixed up exponentiation and multiplication ;D And thats a better way than using a for loop Quigibo!  I didnt know powers of 2 had been implemented :)

And Nemo i believe Quigibo is doing the xor method. Unless its the same?
Title: Re: Sprite Editor
Post by: nemo on July 03, 2010, 01:15:48 am
they're the same, i think.
here:
Code: [Select]
For(A,0,S-1
256-e^(8-S)-{L1+A}->{L1+A}
End

S being the size 1-8.

edit: 200 posts (: