Author Topic: Cool transitions!  (Read 2973 times)

0 Members and 1 Guest are viewing this topic.

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Cool transitions!
« on: September 02, 2010, 11:53:24 am »
Yeah. Well, they would be if they worked.
I am trying to save a screen to the back-buffer and then call 8x8 chunks of that screen back to the screen.
How would I do that?
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Cool transitions!
« Reply #1 on: September 02, 2010, 12:01:56 pm »
The back-buffer's stored in appBackUpScreen (L3) and the buffer's stored in plotSScreen (L6), so you could copy bytes over individually. Each one is a bitmap (like the ones you'd use for the Bitmap( command, except without the first two size bytes), so each row is represented by 12 pixels, and there are 64 (I think) rows total, like this:
Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte Byte
█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █
 █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █
█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █
 █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █
█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █
 █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █
█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █ |█ █ █ █
 █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █| █ █ █ █
......................................................

So to copy an 8x8 that happens to be in a perfect tile (meaning it doesn't cross one of those lines), all you'd have to do is copy one byte over from the first row, then one from the second row, then one from the third row, etc. (for eight rows).

For example, to copy the first 8x8 tile, you'd copy the first byte over to where you want it, then the byte twelve bytes after L3, then the byte at twelve after that, and so on.
« Last Edit: September 02, 2010, 03:21:02 pm by Deep Thought »




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Cool transitions!
« Reply #2 on: September 02, 2010, 03:12:08 pm »
I believe you meant to say one byte instead of two bytes? Each row of 8 pixels is only one byte, so you'd end up copying 8 rows of 1 byte each.

The screen is 96x64 pixels, so diving it up into 8x8 blocks would give you 12x8 blocks. The following routine, with inputs 0-11 (r1) and 0-7 (r2), would copy a block from the back buffer to the front buffer. r3 is used as a temporary variable.

Code: [Select]
Lbl B2F
For(r₃,0,7)
r₂*8+r₃*12+r₁→r₄+L₃→r₄+L₆
End
Return

EDIT: Oops, just realized I had L3 and L6 reversed.
« Last Edit: September 02, 2010, 11:28:07 pm by Runer112 »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Cool transitions!
« Reply #3 on: September 02, 2010, 03:20:09 pm »
I believe you meant to say one byte instead of two bytes? Each row of 8 pixels is only one byte, so you'd end up copying 8 rows of 1 byte each.

Whoops, yeah, sorry.