Author Topic: Homescreen or graphscreen?  (Read 7142 times)

0 Members and 1 Guest are viewing this topic.

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Homescreen or graphscreen?
« on: October 05, 2010, 12:59:45 pm »
Yeah... It wasn't long ago since I started coding TI-BASIC and now I've gotten to the point where I want to display graphics that aren't just ASCII characters. So I'm wondering: Should I use the homescreen or the graphscreen? As I understand it, graphscreen allows stuff like drawing lines, but homescreen allows Disp. Are there any other important differences, and which screen would be the best to use when drawing sprites?

And also, how do I swap between the two screens from a program? Do I simply use a function for drawing to the screen I want to swap to? I didn't exactly see any function for swapping when I looked in the manual.

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Homescreen or graphscreen?
« Reply #1 on: October 05, 2010, 01:08:30 pm »
Graphscreen. You cannot make non-ASCII characters any other way.

Also, in regards to the swapping thing, certain commands drop you back to the homescreen. Try fiddling with some of those.
« Last Edit: October 05, 2010, 01:09:21 pm by Raylin »
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 JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Homescreen or graphscreen?
« Reply #2 on: October 05, 2010, 01:13:17 pm »
Graphscreen. You cannot make non-ASCII characters any other way.
So the function that draws a single pixel only works on the graphscreen?

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Homescreen or graphscreen?
« Reply #3 on: October 05, 2010, 01:20:57 pm »
Yes. It also switches to the graphscreen on execution if I recall correctly.
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 JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Homescreen or graphscreen?
« Reply #4 on: October 05, 2010, 01:22:54 pm »
Is that function fast or should I avoid overusing it?

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Homescreen or graphscreen?
« Reply #5 on: October 05, 2010, 01:49:36 pm »
None of the Basic commands are what i would call fast, but the pixel routine is (i believe) the fastest graphical command. NOTE however, that there is a very important difference between Pixel plotting and Point plotting.  Pixel plotting works off of the screen coordinates, so 0,0 is always in the top left hand corner.  Point plotting works off of the graph screen coordinates, so they depend on your window settings.

Also note that while a single pixel plot is faster than a single line command, it is definetaly faster to use the line() command to draw a line than use a bunch of pixel() commands to draw it.  And actually you kind of can switch between the screens, Disp without any arguments brings you to the homescreen, and dispGraph brings you to the graph screen.  Using graph functions will also bring you to the graph screen (except ClrDraw) and using homescreen functions will bring you to the homescreen. 

Its also worthy to note that no command that works on one screen also works on the other screen.

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Homescreen or graphscreen?
« Reply #6 on: October 05, 2010, 01:53:22 pm »
Okay. Thanks to both of you. I'll start coding something soon (or maybe in a week if I'm lazy :P)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Homescreen or graphscreen?
« Reply #7 on: October 05, 2010, 02:39:27 pm »
Another way to speed things up is to use two (or three?) ASCII character combined together to draw tilemaps.

ClrDraw
For(A,0,56,7
Text(A,0,"OOOOOOOOOOOOOOO
End
Storepic 0
For(A,0,56,7
Text(A,1,"HHHHHHHHHHHHHHH
End
Recallpic 0
Storepic 0

It gives some pretty amazing results sometimes, while still running pretty fast. :)

Example of game using such technique:

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Homescreen or graphscreen?
« Reply #8 on: October 05, 2010, 07:32:54 pm »
Here's a summery of Graphics: http://tibasicdev.wikidot.com/graphics
I hope you are able to do well with this first transition to the graphscreen. :)  Good luck! ;D

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: Homescreen or graphscreen?
« Reply #9 on: October 05, 2010, 07:34:46 pm »
Graphscreen. You cannot make non-ASCII characters any other way.

Plus, you can combine the two, and even ASCII chars aren't that slow on the graph screen if you draw them with Text(-1.




Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Homescreen or graphscreen?
« Reply #10 on: October 05, 2010, 08:26:28 pm »
Are there any other important differences, and which screen would be the best to use when drawing sprites?

Sprites are rather difficult to do [quickly] in BASIC with non-ASCII characters, especially if you have a constantly changing background.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

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: Homescreen or graphscreen?
« Reply #11 on: October 05, 2010, 08:35:16 pm »
Pixel-based sprites are actually faster than text sprites, but bigger.




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Homescreen or graphscreen?
« Reply #12 on: October 06, 2010, 01:43:54 am »
I don't think so. Good luck, Deep Thought, at rendering a 12x8 tilemap in 3 seconds in pure-BASIC. With dual-layer text as shown in the screenshot above, it takes about 2-3 seconds and with single-layer ascii it takes half a second.

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Homescreen or graphscreen?
« Reply #13 on: October 06, 2010, 01:46:57 am »
Pixel-based sprites are actually faster than text sprites, but bigger.
Bigger in which way? Does the program get larger?
I don't think so. Good luck, Deep Thought, at rendering a 12x8 tilemap in 3 seconds in pure-BASIC. With dual-layer text as shown in the screenshot above, it takes about 2-3 seconds and with single-layer ascii it takes half a second.
I guess I'll have to try to avoid drawing too much stuff, then. (Or maybe I should switch to Axe :D)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Homescreen or graphscreen?
« Reply #14 on: October 06, 2010, 01:54:34 am »
There is also xLIB or Doors CS that supports sprites. But yeah if your sprites are just made of two lines for example it should not be too slow. But they still becomes much larger in file size than text ones. In Axe they aren't too large, though (8 bytes for a 8x8 sprite)