Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Munchor on November 21, 2010, 03:13:43 pm

Title: 16*16 Images
Post by: Munchor on November 21, 2010, 03:13:43 pm
Hey, I was trying to implement an image in my programs, a 16*16 image, this is the code:

Code: [Select]
00000000000000000000000003F80404080410027FFF8001FFFF781E4812300C
So I would have:

Code: [Select]
Lbl 1
[00000000000000000000000003F80404080410027FFF8001FFFF781E4812300C->Pic1
Pt-Change(0,0,Pic1
DispGraph
Repeat getKey->Z
If Z>=1
Goto1

However, nothing appears, is it a temporary problem or it works for you?

I gotta try it in WabbitEmu but I can't now :S

Title: Re: 16*16 Images
Post by: nemo on November 21, 2010, 03:17:50 pm
Pt-Change takes a pointer to an 8-byte sprite. a 16x16 image is 32 bytes. you'll need to do this:

Code: [Select]
Lbl 1
[00000000000000000000000003F80404080410027FFF8001FFFF781E4812300C->Pic1
Pt-Change(0,0,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,8,Pic1+24
DispGraph
Repeat getKey->Z
If Z>=1
Goto1
Title: Re: 16*16 Images
Post by: Munchor on November 21, 2010, 03:18:28 pm
Code: [Select]
Pt-Change(0,0,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,8,Pic1+24

Wuuuh thanks much! Like your reply ;)
Title: Re: 16*16 Images
Post by: Runer112 on November 21, 2010, 04:01:25 pm
Code: [Select]
Pt-Change(0,0,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,8,Pic1+24

Wuuuh thanks much! Like your reply ;)


Optimization ;)

Code: [Select]
Pt-Change(0,,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,,Pic1+24
Title: Re: 16*16 Images
Post by: Munchor on November 21, 2010, 04:05:04 pm
Code: [Select]
Pt-Change(0,0,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,8,Pic1+24

Didn't work :S

Code: [Select]
Pt-Change(0,,Pic1
Pt-Change(8,0,Pic1+8
Pt-Change(0,8,Pic1+16
Pt-Change(8,,Pic1+24

Nice optimization, gotta try it too :)
Title: Re: 16*16 Images
Post by: Runer112 on November 21, 2010, 04:07:34 pm
Also, I'm a little confused as to what you intended your getKey code section to do. The Repeat doesn't have a matching End, and it doesn't make sense to have code to check a getKey value inside of a loop that will end whenever you press a key.
Title: Re: 16*16 Images
Post by: Munchor on November 21, 2010, 04:08:42 pm
Also, I'm a little confused as to what you intended your getKey code section to do. The Repeat doesn't have a matching End, and it doesn't make sense to have code to check a getKey value inside of a loop that will end whenever you press a key.

What doesn't work is the image :S It is all confused and crazy :s


And I'm using Pause 9999
Title: Re: 16*16 Images
Post by: Deep Toaster on November 21, 2010, 04:13:09 pm
That's because your image is a 16x16 sprite. What you need to do is split it into four 8x8 sprites, and it should work.
Title: Re: 16*16 Images
Post by: Runer112 on November 21, 2010, 04:19:09 pm
And I'm using Pause 9999

Just a note, there's no reason to stop at 4 digits. You know you can pause for values up to 65535 (actually up to 65536, which is what 0 does)
Title: Re: 16*16 Images
Post by: DJ Omnimaga on November 21, 2010, 04:22:33 pm
For odd reasons, I think he ended up taking a habit from BASIC programming. ;D. In BASIC, it's typical to do Repeat Z=number:Getkey->Z:End in non-realtime games, because otherwise, at 2-3 FPS, key detection is terrible.
Title: Re: 16*16 Images
Post by: Deep Toaster on November 21, 2010, 06:40:43 pm
Sorry, had to go earlier, but what I meant by

That's because your image is a 16x16 sprite. What you need to do is split it into four 8x8 sprites, and it should work.

is this: Say you have a picture like this:

■■■■■■■■■■■■■■■■
■■▢▢▢▢▢▢▢▢▢▢▢▢■■
■▢■▢▢▢▢▢▢▢▢▢▢■▢■
■▢▢■▢▢▢▢▢▢▢▢■▢▢■
■▢▢▢■▢▢▢▢▢▢■▢▢▢■
■▢▢▢▢■▢▢▢▢■▢▢▢▢■
■▢▢▢▢▢■▢▢■▢▢▢▢▢■
■▢▢▢▢▢▢■■▢▢▢▢▢▢■
■▢▢▢▢▢▢■■▢▢▢▢▢▢■
■▢▢▢▢▢■▢▢■▢▢▢▢▢■
■▢▢▢▢■▢▢▢▢■▢▢▢▢■
■▢▢▢■▢▢▢▢▢▢■▢▢▢■
■▢▢■▢▢▢▢▢▢▢▢■▢▢■
■▢■▢▢▢▢▢▢▢▢▢▢■▢■
■■▢▢▢▢▢▢▢▢▢▢▢▢■■
■■■■■■■■■■■■■■■■


Instead of storing it as a 16x16 picture, as in

Code: (Axe) [Select]
:[FFFFC003A0059009881184218241818181818241842188119009A005C003FFFF]→Pic1

you should think of it as four 8x8 pictures:

■■■■■■■■   ■■■■■■■■
■■▢▢▢▢▢▢   ▢▢▢▢▢▢■■
■▢■▢▢▢▢▢   ▢▢▢▢▢■▢■
■▢▢■▢▢▢▢   ▢▢▢▢■▢▢■
■▢▢▢■▢▢▢   ▢▢▢■▢▢▢■
■▢▢▢▢■▢▢   ▢▢■▢▢▢▢■
■▢▢▢▢▢■▢   ▢■▢▢▢▢▢■
■▢▢▢▢▢▢■   ■▢▢▢▢▢▢■

■▢▢▢▢▢▢■   ■▢▢▢▢▢▢■
■▢▢▢▢▢■▢   ▢■▢▢▢▢▢■
■▢▢▢▢■▢▢   ▢▢■▢▢▢▢■
■▢▢▢■▢▢▢   ▢▢▢■▢▢▢■
■▢▢■▢▢▢▢   ▢▢▢▢■▢▢■
■▢■▢▢▢▢▢   ▢▢▢▢▢■▢■
■■▢▢▢▢▢▢   ▢▢▢▢▢▢■■
■■■■■■■■   ■■■■■■■■


Then you'd store each 8x8 chunk one by one, starting with the top left, then top right, then bottom left and right. So you'd store it as

Code: (Axe) [Select]
:[FFC0A09088848281]→Pic1
:[FF03050911214181]
:[8182848890A0C0FF]
:[81412111090503FF]

which is basically the four 8x8 sprites one after another, and it should work.
Title: Re: 16*16 Images
Post by: Munchor on November 22, 2010, 08:35:59 am
Sorry, had to go earlier, but what I meant by

That's because your image is a 16x16 sprite. What you need to do is split it into four 8x8 sprites, and it should work.

is this: Say you have a picture like this:

■■■■■■■■■■■■■■■■
■■▢▢▢▢▢▢▢▢▢▢▢▢■■
■▢■▢▢▢▢▢▢▢▢▢▢■▢■
■▢▢■▢▢▢▢▢▢▢▢■▢▢■
■▢▢▢■▢▢▢▢▢▢■▢▢▢■
■▢▢▢▢■▢▢▢▢■▢▢▢▢■
■▢▢▢▢▢■▢▢■▢▢▢▢▢■
■▢▢▢▢▢▢■■▢▢▢▢▢▢■
■▢▢▢▢▢▢■■▢▢▢▢▢▢■
■▢▢▢▢▢■▢▢■▢▢▢▢▢■
■▢▢▢▢■▢▢▢▢■▢▢▢▢■
■▢▢▢■▢▢▢▢▢▢■▢▢▢■
■▢▢■▢▢▢▢▢▢▢▢■▢▢■
■▢■▢▢▢▢▢▢▢▢▢▢■▢■
■■▢▢▢▢▢▢▢▢▢▢▢▢■■
■■■■■■■■■■■■■■■■


Instead of storing it as a 16x16 picture, as in

Code: (Axe) [Select]
:[FFFFC003A0059009881184218241818181818241842188119009A005C003FFFF]→Pic1

you should think of it as four 8x8 pictures:

■■■■■■■■   ■■■■■■■■
■■▢▢▢▢▢▢   ▢▢▢▢▢▢■■
■▢■▢▢▢▢▢   ▢▢▢▢▢■▢■
■▢▢■▢▢▢▢   ▢▢▢▢■▢▢■
■▢▢▢■▢▢▢   ▢▢▢■▢▢▢■
■▢▢▢▢■▢▢   ▢▢■▢▢▢▢■
■▢▢▢▢▢■▢   ▢■▢▢▢▢▢■
■▢▢▢▢▢▢■   ■▢▢▢▢▢▢■

■▢▢▢▢▢▢■   ■▢▢▢▢▢▢■
■▢▢▢▢▢■▢   ▢■▢▢▢▢▢■
■▢▢▢▢■▢▢   ▢▢■▢▢▢▢■
■▢▢▢■▢▢▢   ▢▢▢■▢▢▢■
■▢▢■▢▢▢▢   ▢▢▢▢■▢▢■
■▢■▢▢▢▢▢   ▢▢▢▢▢■▢■
■■▢▢▢▢▢▢   ▢▢▢▢▢▢■■
■■■■■■■■   ■■■■■■■■


Then you'd store each 8x8 chunk one by one, starting with the top left, then top right, then bottom left and right. So you'd store it as

Code: (Axe) [Select]
:[FFC0A09088848281]→Pic1
:[FF03050911214181]
:[8182848890A0C0FF]
:[81412111090503FF]

which is basically the four 8x8 sprites one after another, and it should work.

Ooooh thanks, then I gotta split my image, it won't be hard using tokens :)