Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: meishe91 on August 10, 2010, 09:34:49 pm

Title: Sprite Maker
Post by: meishe91 on August 10, 2010, 09:34:49 pm
So finally I am getting a version that I'm quite satisfied with. As far as I know this there are no known bugs so please inform me if any are found.

So this spriter is quite revolutionary, I think and have been told. Some of the features may run a bit slow but that is only due to the limitations of TI-BASIC. These programs, depending which one you use, will pad the side/s of the sprite to the nearest multiple of eight. This means that if you are making a 5*7 sprite and happen to use the one that pads both sides then it will give you a hexadecimal code for a 8*8 sprite, padding zeros on. If you use the one that only pads width then it will give the hexadecimal code for a 8*7 sprite.

Features for this program include:
-Any sprite size (well from 1*1 to 88*63 (padding width only) or 88*56 (padding both sides))
-Gray cursor.
-Cursor wrap around.
-Invert the sprite.
-Clear the sprite.
-Rotate the sprite 90º to right and left.
-Flip the sprite horizontally or vertically.
-Single row or column filling or deleting.
-Single row or column inverting.
-Supports sprites from one pixel in size to a size of fifty-six pixels.

Arrows - Move the cursor around.
[2ND] - Turns the current pixel on or off.
[MODE] - Rotates the sprite 90º to the left.
[DEL] - Rotates the sprite 90º to the right.
[X,T,Θ,n] - Flips the sprite horizontally.
[STAT] - Flips the sprite vertically.
[ALPHA] - Inverts the sprite.
[MATH] - Inverts the current column.
[X-1] - Inverts the current row.
[APPS] - Turns the whole row on.
[SIN] - Turns the whole row off.
[PRGM] - Turns the whole column on.
[COS] - Turns the whole column off.

They Sprite2Hex_PadBothSides.8xp stands at 877 bytes and Sprite2Hex_PadWidthOnly.8xp is 868 bytes. (Unfortunately with the new updates them made it bigger :()
Title: Re: Sprite Maker
Post by: shmibs on August 11, 2010, 09:55:48 am
cool
add in a few more tools (mebbe rotation/flipping and saving the previous sprite) and that could be rather useful, especially because it's pure basic so anyone can use it
Title: Re: Sprite Maker
Post by: meishe91 on August 11, 2010, 10:07:08 pm
Ok, I added in rotation and flipping horizontally. Any other features before I release the next version?
Title: Re: Sprite Maker
Post by: meishe91 on August 12, 2010, 06:05:29 pm
Ok, here is the next release of my sprite maker. If anyone thinks of more features I will add them, or at least try to.

[2ND] - Turns a pixel on or off.
[ALPHA] - Inverts the sprite.
[MODE] - Rotates the sprite 90º (or π/2 radians :P)to the left.
[X,T,Θ,n] - Flips the sprite horizontally.
[CLEAR] - Clears the sprite.
[ENTER] - The "finish" button to get the hexadecimal code.

P.S. The only feature I can think of right now is making it so you can create multiple sprites in one go.
Title: Re: Sprite Maker
Post by: Hot_Dog on August 12, 2010, 07:04:12 pm
Wow, looks great!
Title: Re: Sprite Maker
Post by: SirCmpwn on August 12, 2010, 07:07:07 pm
If you are starved for features, how about 16x16 and vertical flipping?
Title: Re: Sprite Maker
Post by: meishe91 on August 12, 2010, 07:20:23 pm
Wow, looks great!

Thanks :)

If you are starved for features, how about 16x16 and vertical flipping?

Ya, I've thought about doing 16*16. I haven't decided though for sure yet but I might just make it so you can make any size sprite you want from 4*1 to 62*94 sprites (if you really needed). I don't know how possible that is but I could probably figure something similar out.

I can add vertical flipping it just will add that much more code when you can make the sprite any direction between the flipping and rotating in it right now. But I can if people want it. Thanks.
Title: Re: Sprite Maker
Post by: willrandship on August 12, 2010, 07:23:14 pm
What about grayscale? Is it written in axe or basic? I can't tell :P
Title: Re: Sprite Maker
Post by: SirCmpwn on August 12, 2010, 07:24:03 pm
If you are going to support 62*94 sprites, you need a different calculator ;).  However, if you meant 94*62 sprites, you will probably want to turn off the axis.
Title: Re: Sprite Maker
Post by: meishe91 on August 12, 2010, 07:35:06 pm
What about grayscale? Is it written in axe or basic? I can't tell :P

It's pure 100% TI-BASIC. Look at the sub-forum ;)

If you are going to support 62*94 sprites, you need a different calculator ;).  However, if you meant 94*62 sprites, you will probably want to turn off the axis.

Psh...details, details :P And ya I know. The axes are just always off on my calculator so I didn't think about turning it off.

I'm thinking I will make a plan with features tonight or something and then rewrite it all or something. I just would like to know what all I'm implementing before I do that. So, I would like to invite you all still to make suggestions :)

Features as of now:
-Rotation in both directions.
-Flip horizontally and vertically.
-Invert the sprite.
-Clear the sprite.

Possible features:
-Multiple sprite support.
Title: Re: Sprite Maker
Post by: SirCmpwn on August 12, 2010, 07:37:36 pm
The axes are just always off on my calculator so I didn't think about turning it off.
That's exactly the opposite of my calculator :P mine are almost always off.
Title: Re: Sprite Maker
Post by: meishe91 on August 12, 2010, 07:38:49 pm
The axes are just always off on my calculator so I didn't think about turning it off.
That's exactly the opposite of my calculator :P mine are almost always off.

Isn't that what I said I about mine? ??? Or did you mean on?
Title: Re: Sprite Maker
Post by: SirCmpwn on August 12, 2010, 07:39:21 pm
Oh, my mistake x.x
Title: Re: Sprite Maker
Post by: willrandship on August 12, 2010, 07:49:45 pm
Yeah. Who needs axes? Heck, when i graph stuff at school i never turn the axes back on, since I end up needing trace for anything that I can't solve in my head.
Title: Re: Sprite Maker
Post by: ztrumpet on August 16, 2010, 10:16:25 am
Looks nice.  How about using this code:
If K=45
Text(-1,0,0,"  // 2 spaces

Regardless, nice job! :)
Title: Re: Sprite Maker
Post by: meishe91 on August 16, 2010, 01:42:32 pm
Thanks. Won't that only clear seven rows though? I thought tokens were 5*7. But I don't think that'll work if I support different sprite sizes.
Title: Re: Sprite Maker
Post by: ztrumpet on August 16, 2010, 02:04:30 pm
Thanks. Won't that only clear seven rows though? I thought tokens were 5*7. But I don't think that'll work if I support different sprite sizes.
Right, "they are 5*7", plus a buffer row that makes them 6*8. :)
Title: Re: Sprite Maker
Post by: meishe91 on August 16, 2010, 02:25:45 pm
Oh ok, I thought that was just the small text that had the buffer row.
Title: Re: Sprite Maker
Post by: DJ Omnimaga on August 17, 2010, 09:52:28 am
Nice job so far Meishe91

As for Axises I kinda prefer to turn them ON during math but have my games turn then OFF. I kinda dislike when I download BASIC programs and it doesn't turn them OFF automatically. I think it is a bad coding practice (although automatically turning them off and not turning them back ON on game exit tend to annoy certain people in math classes)
Title: Re: Sprite Maker
Post by: meishe91 on August 17, 2010, 07:20:50 pm
Ya, I don't do a whole lot of graphing during the summer or outside of a math class so I just leave them off usually. Otherwise I have them on because it makes it easier for me to see graphs and such.

Edit:
Ok, update time.

This supports SQUARE sprites of any size from four pixels to sixty-three pixels.

Arrows - Move the cursor around.
[2ND] - Turns the pixel on or off.
[ALPHA] - Inverts the sprite.
[MODE] - Rotates the sprite 90º to the left.
[DEL] - Rotates the sprite 90º to the right.
[X,T,Θ,n] - Flips the sprite horizontally.
[STAT] - Flips the sprite vertically.
[CLEAR] - Clears the sprite.
[ENTER] - Continues on to the hexadecimal output.

It is pretty simple to use and all. One thing about the output though. It rounds the hexadecimal up to the nearest multiple of four if it isn't evenly divisible. What I mean by this is that if you have a 7*7 sprite and you click to make it export out the hexadecimal code will be for a 8*7. Now, if anyone has an issue with this and would like it to just output like an 8*8 (in this case) I can add that in.

This currently stands at 590 bytes. I will either get screenshots up sometime this week or if someone can make some that would be appreciated. Once I figure everything out for this thing I will just update the first post and make that all official.
Title: Re: Sprite Maker
Post by: DJ Omnimaga on August 18, 2010, 12:24:31 pm
Wow pretty small. I also like the control. However, what do you mean by 8x7? Does it means doing 8x8 sprites (the standard in Axe Parser) is impossible right now?
Title: Re: Sprite Maker
Post by: ztrumpet on August 18, 2010, 12:56:46 pm
I kinda dislike when I download BASIC programs and it doesn't turn them OFF automatically. I think it is a bad coding practice (although automatically turning them off and not turning them back ON on game exit tend to annoy certain people in math classes)
Here's the best thing to do in a program that uses the graphscreen:
Code: [Select]
:StoreGDB 1
:AxesOff
Change window settings
....Code here....
:RecallGDB 1
:DelVar GDB1
Title: Re: Sprite Maker
Post by: DJ Omnimaga on August 18, 2010, 02:22:53 pm
GDB keeps the graph zoom/window/axe settings? I thought it only kept the equations and the like. I was experimenting the other day with ZoomRCL and the like to see if it recalled the Axes and it didn't work, so that's nice to know at least.
Title: Re: Sprite Maker
Post by: ztrumpet on August 18, 2010, 02:30:09 pm
GDB keeps the graph zoom/window/axe settings? I thought it only kept the equations and the like.
It keeps both. :)
Title: Re: Sprite Maker
Post by: DJ Omnimaga on August 18, 2010, 02:34:27 pm
Nice ^^

I guess this is probably why some BASIC games leaves a GDB1 or GDB0 behind. FFTOM did that
Title: Re: Sprite Maker
Post by: meishe91 on August 18, 2010, 02:43:49 pm
Wow pretty small. I also like the control. However, what do you mean by 8x7? Does it means doing 8x8 sprites (the standard in Axe Parser) is impossible right now?

No, no, no. I didn't mean it like that. Say you are making a 7*7 sprite. Since hexadecimal, or at least the way I'm doing it, reads four pixels at a time it doesn't fit into seven nicely. So it will just push the sprite width wise to eight columns to help it compensate for that. So 5*5 will be exported as 8*5, as will 6*6, and 7*7. Right now it does a check to do the fix but I'm thinking now that I can shorten it to it doesn't have to. I'll look at the code later since I don't work today.

Basically though:

Code: [Select]
██████ This 6*6 sprite will be exported like...
██████
██████
██████
██████
██████

██████__ this. A 8*6 sprite.
██████__ So the resulting hexadecimal code is FCFCFCFCFCFC
██████__
██████__
██████__
██████__

Does that make sense?
Title: Re: Sprite Maker
Post by: ztrumpet on August 18, 2010, 03:20:01 pm
Here, let me try.  In other words, it's like xLib.  With xLib you had to pad the edges of sprites that had a width that wasn't a multiple of 8 to make them have a width that's a multiple of 8.  Meishe's program also must pad to make them have a width of a multiple of 8 (or maybe 4, he may do it that way too). :)
Title: Re: Sprite Maker
Post by: meishe91 on August 18, 2010, 03:21:07 pm
Padding, ya, that's a better word for it :P Ya, I do it in a multiple of four, though I could change it to eight if people wanted.
Title: Re: Sprite Maker
Post by: DJ Omnimaga on August 18, 2010, 03:49:45 pm
Wow pretty small. I also like the control. However, what do you mean by 8x7? Does it means doing 8x8 sprites (the standard in Axe Parser) is impossible right now?

No, no, no. I didn't mean it like that. Say you are making a 7*7 sprite. Since hexadecimal, or at least the way I'm doing it, reads four pixels at a time it doesn't fit into seven nicely. So it will just push the sprite width wise to eight columns to help it compensate for that. So 5*5 will be exported as 8*5, as will 6*6, and 7*7. Right now it does a check to do the fix but I'm thinking now that I can shorten it to it doesn't have to. I'll look at the code later since I don't work today.

Basically though:

Code: [Select]
██████ This 6*6 sprite will be exported like...
██████
██████
██████
██████
██████

██████__ this. A 8*6 sprite.
██████__ So the resulting hexadecimal code is FCFCFCFCFCFC
██████__
██████__
██████__
██████__

Does that make sense?
Ooh ok I see now. ^^
Title: Re: Sprite Maker
Post by: meishe91 on August 18, 2010, 03:51:04 pm
Ya, would it be easier on people to pad it on both sides? And do people want multiples of eight or four?
Title: Re: Sprite Maker
Post by: ztrumpet on August 18, 2010, 04:33:28 pm
Ya, would it be easier on people to pad it on both sides? And do people want multiples of eight or four?
My vote is for 8, because two nibbles = a byte. :)
Title: Re: Sprite Maker
Post by: meishe91 on August 18, 2010, 04:45:23 pm
Ok, I'll work on making it eight then. So now the question is should I pad both sides?
Title: Re: Sprite Maker
Post by: ztrumpet on August 18, 2010, 04:50:37 pm
Nah, I'd say just on the right. :)
Title: Re: Sprite Maker
Post by: meishe91 on August 18, 2010, 04:51:32 pm
Ok, will do. I'll work on it then. Thanks.

Edit:
Ok, so I'm just going to release two versions. One that just pads the width and one that pads both height and width. It was a simple change so ya.

Edit x2:
As I said, I am going to release two versions. One that pads just the width and one that pads both the width and height. I have also added in a few new features too. They affect row/column only and could be useful. One other thing, the limit of sprite size has been decreased and increased, depending how you look at it. Technically it's been decreased though. You can now do sprites from one pixel up to fifty-six pixels. I will be updating the original post with this version because as of right now this is the final version. Hope you all will enjoy it.
Title: Re: Sprite Maker
Post by: DJ Omnimaga on August 22, 2010, 03:25:12 pm
Ok just tried the editor finally, it works pretty well and most stuff is quite fast for basic. Nice job so far
Title: Re: Sprite Maker
Post by: meishe91 on August 22, 2010, 07:51:30 pm
Ya, that damn speed limitation is a killer but I tried. I'm sure there could be something more done to optimize but I haven't gone over it to much. Thanks though :)
Title: Re: Sprite Maker
Post by: ztrumpet on August 23, 2010, 02:06:20 pm
Wow, nice job!  It's by far the best sprite editor I've seen in Basic.

Here are my three suggestions:
1: Make the cursor wrap around the screen.  If you're at (0,0) and press up I'd like it to go to (0,Max_Y). :)
2: Make the current location gray.  This can be done like this:
Code: [Select]
:Repeat Ans
:Pt-Change(X,Y)
:getKey->K
:Pt-Change(X,Y)
3: Change the end to this:
Code: [Select]
:ClrHome
:RecallGDB 1
:DelVarGDB1sub(Ans,2,length(Ans)-1->Str1
This makes it display a string that you can scroll through and will not display Done.  I'm not sure if it works like this on OS 2.53 MP, but it's just as good as what you had before. :)

Wonderful job! ;D
Title: Re: Sprite Maker
Post by: meishe91 on August 23, 2010, 02:47:10 pm
Wow, nice job!  It's by far the best sprite editor I've seen in Basic.

Here are my three suggestions:
1: Make the cursor wrap around the screen.  If you're at (0,0) and press up I'd like it to go to (0,Max_Y). :)
2: Make the current location gray.  This can be done like this:
Code: [Select]
:Repeat Ans
:Pt-Change(X,Y)
:getKey->K
:Pt-Change(X,Y)
3: Change the end to this:
Code: [Select]
:ClrHome
:RecallGDB 1
:DelVarGDB1sub(Ans,2,length(Ans)-1->Str1
This makes it display a string that you can scroll through and will not display Done.  I'm not sure if it works like this on OS 2.53 MP, but it's just as good as what you had before. :)

Wonderful job! ;D

Thanks ;D

As for the changes I will try to get those implemented today. The only reason I didn't put the cursor wrap into it was just to make it as small as possible. But I'll get it in there :)

Edit:
Made the changes and put the newest version on the original post. I don't really feel like making new screenshots though unless people want me to update those too.
Title: Re: Sprite Maker
Post by: DJ Omnimaga on August 23, 2010, 10:15:53 pm
One suggestion I got would maybe be to clarify what does the 56 at the beginning when inputting stuff means, because I have yet to figure that out, even thought I somehow got your program to work fine.
Title: Re: Sprite Maker
Post by: meishe91 on August 23, 2010, 10:20:17 pm
Do you mean when it says "56≥SIZE≥1?"
Title: Re: Sprite Maker
Post by: DJ Omnimaga on August 23, 2010, 10:33:26 pm
yea
Title: Re: Sprite Maker
Post by: meishe91 on August 23, 2010, 10:45:32 pm
Oh, that's the size restriction. Greater-than-or-equa-to one pixel but also has to be less-than-or-equal-to fifty-six pixels.
Title: Re: Sprite Maker
Post by: DJ Omnimaga on August 24, 2010, 03:48:11 am
Aaah ok, thanks, although it might be good to clarify what those means in the program or in the first post.
Title: Re: Sprite Maker
Post by: meishe91 on August 24, 2010, 04:00:24 am
Done.
Title: Re: Sprite Maker
Post by: ztrumpet on August 24, 2010, 08:42:20 am
Nice job!  I like the way it looks and all the features.  Excellent program! ;D
Title: Re: Sprite Maker
Post by: meishe91 on August 24, 2010, 03:06:51 pm
Thanks.
Title: Re: Sprite Maker
Post by: meishe91 on September 01, 2010, 12:38:39 am
Update:
Nothing really that big. Just shaved off four bytes.
Title: Re: Sprite Maker
Post by: DJ Omnimaga on September 01, 2010, 01:05:07 am
Cool, optimizations of all sort are always welcome :)
Title: Re: Sprite Maker
Post by: meishe91 on September 01, 2010, 02:01:23 am
Ya, and now I'm working on getting this thing to support any size sprite (sorta) :)
Title: Re: Sprite Maker
Post by: DJ Omnimaga on September 01, 2010, 02:12:40 am
You mean any width x 5 and 7 pixels of height?
Title: Re: Sprite Maker
Post by: meishe91 on September 01, 2010, 02:21:00 am
Ya. So say you are working on a 5*7 sprite and decide you want to rotate it. It will turn it into a 7*5 sprite.
Title: Re: Sprite Maker
Post by: DJ Omnimaga on September 01, 2010, 03:02:31 am
wow nice o.o
Title: Re: Sprite Maker
Post by: meishe91 on September 01, 2010, 03:17:26 am
Ya. I've got everything working, to my knowledge (I don't know if there are any bugs I haven't come across), and now just trying to tweak the output routine.
Title: Re: Sprite Maker
Post by: meishe91 on September 01, 2010, 03:27:10 am
Well this one is just the sprite to hexadecimal program ;) But thanks. I've just tried some editors before and thought that they were all missing things that would be handy. I've also seen people complain about features not being in programs and such. So I'm just trying to do my best :)

I was replying to a message DJ said but I guess he said it in the wrong place or something because it's gone now. So if someone could please delete this post it'd be appreciated :)
Title: Re: Sprite Maker
Post by: DJ Omnimaga on September 01, 2010, 03:29:10 am
Oh yeah I know I noticed later as I got consused by both topics x.x. I removed my post lol. However I think it is nice that this one got rotating and stuff too.
Title: Re: Sprite Maker
Post by: meishe91 on September 01, 2010, 03:34:07 am
Ah ok. Ya, that's what I figured. Well I got all the programs working now ;D I'll upload them but I won't be able to get screenshots updated until tomorrow because I'm lazy like that :P
Title: Re: Sprite Maker
Post by: DJ Omnimaga on September 01, 2010, 03:41:55 am
No problem, I'll look forward for them :)
Title: Re: Sprite Maker
Post by: meishe91 on September 01, 2010, 04:04:18 am
Update:
So this is finally updated with a few new things. Well not really but the new features is just working with pre-existing ones correctly now :P The only new feature is that it now supports any sprite size! I finally got the rotating to work correctly with them which is what was holding it back. Everything should work but if there are any bugs please, PLEASE, let me know.

The only thing really is that you must have a sprite with a width lower than fifty-six or sixty-three (depending which one you're using) but that shouldn't really be that big of a deal I don't think.
Title: Re: Sprite Maker
Post by: DJ Omnimaga on September 01, 2010, 11:37:16 am
Cool to see more updates :)

Sadly I don't know if I'll be able to try it soon, though, as there were many downloadable stuff released lately and I also have some stuff to do, but hopefully I may be able to give it a try at one point.