### Author Topic: Scaled sprites axiom  (Read 3525 times)

0 Members and 1 Guest are viewing this topic.

#### Matrefeytontias

• Axe roxxor (kinda)
• LV10 31337 u53r (Next: 2000)
• Posts: 1982
• Rating: +310/-12
• Axe roxxor
##### Scaled sprites axiom
« on: July 11, 2014, 01:31:31 pm »
Hi guys,

This is something I could have done a while ago, but since Hayleia reminded me about it, I do it now.

So what is it, you ask. Well, it's an axiom that lets you draw scaled sprites, either clipped (for safety) or not clipped (for speed). Beware though, it only lets you draw sprites as a fraction of their size, that means that you can't widen sprites, only shrink them - but look at dem specs : it works for sprites up to 256*256 and have a precision of 0.4 in the resizing ratio.

Though this time again, I didn't do much ; like with AxeJh3D, I just ported ASM routines to axiom form. Code and appvar attached.

So here's how it works. The commands can be found near the Z entry of the catalog [2nd][0][2].

 Command (token) Usage Effect Scaled-On (Zoom In) Scaled-On(X * 256 + Y, original height * 256 + original witdh IN BYTES, scale factor, sprite) OR-s a sprite scaled to a fraction of its original dimensions on the graph buffer. Does no clipping, very fast. The scale factor goes from 1 to 256 (or 0 to 255, but keep reading). 1 is 0.4%, 128 is 50%, 256 (aka 0) is 100%. Scaled-XOR (Zoom Out) Scaled-XOR(X * 256 + Y, original height * 256 + original width in bytes, scale factor, sprite) XOR-s a sprite scaled to a fraction of its original dimensions on the graph buffer. Does no clipping, very fast. ScaledClip-On (ZoomFit) ScaledClip-On(X * 256 + Y, original height * 256 + original width in bytes, scale factor, sprite) OR-s a sprite scaled to a fraction of its original dimensions on the graph buffer. Does clipping, but still very fast, trust me. ScaledClip-XOR (ZoomRcl) ScaledClip-XOR(X * 256 + Y, original height * 256 + original width in bytes, scale factor, sprite) XOR-s a sprite scaled to a fraction of its original dimensions on the graph buffer. Does clipping, but still very fast, trust me.

Original routines : http://www.ticalc.org/archives/files/fileinfo/192/19230.html

Enjoy =]
« Last Edit: July 29, 2014, 10:29:17 am by Matrefeytontias »

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: Scaled sprites axiom
« Reply #1 on: July 12, 2014, 05:34:03 am »
Thanks
You should mention if it doesn't work in apps due to using SMC though.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55877
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: Scaled sprites axiom
« Reply #2 on: July 15, 2014, 06:26:28 pm »
Interesting. I wonder if there is an example screenshot or working demo? I wonder how fast it is?

#### Matrefeytontias

• Axe roxxor (kinda)
• LV10 31337 u53r (Next: 2000)
• Posts: 1982
• Rating: +310/-12
• Axe roxxor
##### Re: Scaled sprites axiom
« Reply #3 on: July 15, 2014, 07:28:06 pm »
Well there are still the screenshots of the ticalc.org page, it's exactly the same routine. You'll also see it's really fast

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55877
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: Scaled sprites axiom
« Reply #4 on: July 15, 2014, 07:36:51 pm »
Oh right, I didn't realize this used Badja's routine.

#### Sorunome

• Fox Fox Fox Fox Fox Fox Fox!
• Support Staff
• LV13 Extreme Addict (Next: 9001)
• Posts: 7920
• Rating: +374/-13
• Derpy Hooves
##### Re: Scaled sprites axiom
« Reply #5 on: July 16, 2014, 12:48:09 am »
Sweat! This can allow for some nice animations
 THE GAMEAlso, check out my websiteIf OmnomIRC is screwed up, blame me!Click here to give me an internet!

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: Scaled sprites axiom
« Reply #6 on: July 29, 2014, 07:02:22 am »
Bug report !

Zoom In works.
Zoom Out works.
ZoomFit doesn't compile, says "Invalid token" and jumps to the first comma in the line starting with ZoomFit (in the sample program above, it is the comma just after the "32").
ZoomRcl doesn't compile either, says "Invalid Axiom" and jumps on "ZoomRcl" (not on "#Axiom(SCALESPR)").

Here's a sample program (in attachement to) if you want to test (yeah, I know the calculation of F could have been in the Zoom line but this one is already long enough, and it's just a program for testing ). Just replace the "ZoomXXX" with the token you want.
Code: [Select]
.AAAxiom(SCALESPR)256->FWhile 1 max(min(F+getKey(4)-getKey(1),256),1)->F Zoom In 48*256+32,16*256+2,F,[FFFFFFFFF003F803DC03CE03C703C383C1C3C0E3C073C03BC01FC00FFFFFFFFF]) DispGraphClrDrawEndIf getKey(15)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### Matrefeytontias

• Axe roxxor (kinda)
• LV10 31337 u53r (Next: 2000)
• Posts: 1982
• Rating: +310/-12
• Axe roxxor
##### Re: Scaled sprites axiom
« Reply #7 on: July 29, 2014, 09:58:15 am »
Problem solved, download the attachments of the first post again I have no idea why but I put an extra .dw 0 in the header of the ScaledClip-On, thus shifting the whole program down 2 bytes. Sorry about that !

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: Scaled sprites axiom
« Reply #8 on: July 29, 2014, 01:27:58 pm »
I confirm that the other three work but ZoomRcl now says Invalid Token.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.