* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: CE Textlib/Basic Drawing  (Read 5683 times)

0 Members and 1 Guest are viewing this topic.

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
CE Textlib/Basic Drawing
« on: March 11, 2016, 11:34:14 pm »
I was thinking about porting some of my favorite basic games, to get past only Text games.
I thought of Shift, even though it's made in xLib, maybe I could draw sprites in pure basic?

Anyway, I found you can draw sprites with the Px-On command by looking thru someone's tutorial on ticalc.org, but it takes forever,
especially on my CE, and drawing sprites pixel by pixel on a 320x240 screen is pretty much torture.
@DJ Omnimaga said you can draw with CE Textlib, and I'd like to know how.


  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline KingInfinity

  • New User
  • Join Date: Mar 2016
  • Location:
  • Posts: 3
  • Post Rating Ratio: +0/-0
    • View Profile
Re: CE Textlib/Basic Drawing
« Reply #1 on: March 11, 2016, 11:46:00 pm »
Protip: Wait for xLIBCE :)
Real answer: You probably can. but xLIBCE and Doors CE 9 will empower and enable you to create programs on a larger and better scale.

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #2 on: March 11, 2016, 11:49:38 pm »
So, just forget it and wait for XX months/years?  :-\
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline Adriweb

  • Full User
  • CodeWalrus Supporter
  • *
  • Join Date: Jan 2015
  • Location: France & Canada
  • Posts: 397
  • Post Rating Ratio: +7/-0
    • Adriweb
    • @Adriweb
    • Adriweb
    • @UC-UIrbk5SuaUCvnV6SQvt-Q
    • /u/Adriweb
    • Adriweb
    • View Profile
    • TI-Planet.org
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #3 on: March 12, 2016, 01:36:24 am »
Well, you have C programming on the CE, if you want :)
And there are libs already available, including for graphics (example here)

(Also, self-promotion: and even an online builder (still in beta) compatible with the latest toolchain, if you don't feel like setting up the toolchain locally)
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #4 on: March 12, 2016, 02:07:14 am »
I was just trying to learn to do some stuff in Basic, which I somewhat understand. C looks terribly foreign to me, much like Russian.
I guess I could try it, though, if the tutorial was finished...  <_<

Well, then there's no point in this topic if I'm not getting any help out of it...   :-|
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 17891
  • Post Rating Ratio: +89/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #5 on: March 12, 2016, 02:23:40 am »
This topic is about CE Textlib and pure BASIC drawing commands support, not about xLIBC nor C. Those should be kept separate if Dudeman313 ever needs help with them.

Anyway I didn't have time to help because I spent the last two hours on the phone and the previous ones at work, but I suggest against drawing sprites pixel by pixel, since that's too slow. There are plenty of tricks to draw BASIC sprites at a somewhat decent speed (if you don't need to move them around, that is), which involves tricks such as text sprites, using lists and the Line command and stuff, but it would take a while to explain all.

Have you checked TI-Basic Developer wiki for info about the Line(), Pt-On, Pt-Off and Text() commands? I think they updated the wiki to include extra color stuff, but I'M unsure.

As for CE Textlib, the readme explains each command, but if you need help with a specific one then let me know. I was kinda joking about the CE Textlib sprites, though. While it's technically possible to draw a 26x10 sprite using CE Textlib, it's not practical, because just a 8x8 sprite alone almost fills the entire screen height and the resulting code is very large. It's done by using the rectangle commands, but those rectangle commands can be handy to erase large parts of the screen. And of course you can also draw colored text.
« Last Edit: March 12, 2016, 02:53:03 am by DJ Omnimaga »
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)
??? ??? ??? ???

Offline Adriweb

  • Full User
  • CodeWalrus Supporter
  • *
  • Join Date: Jan 2015
  • Location: France & Canada
  • Posts: 397
  • Post Rating Ratio: +7/-0
    • Adriweb
    • @Adriweb
    • Adriweb
    • @UC-UIrbk5SuaUCvnV6SQvt-Q
    • /u/Adriweb
    • Adriweb
    • View Profile
    • TI-Planet.org
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #6 on: March 12, 2016, 03:00:50 am »
This topic is about CE Textlib and pure BASIC drawing commands support, not about xLIBC nor C. Those should be kept separate if Dudeman313 ever needs help with them.
I was rather replying with an alternative solution since he seemed desperate with his "So, just forget it and wait for XX months/years? :/" message.
But sure, if the discussion ends up on more C stuff, he might as well make another proper topic about that.
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 17891
  • Post Rating Ratio: +89/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #7 on: March 12, 2016, 04:03:11 am »
Ah ok. CodeWalrus tends to be open to learning of any language so I thought that if he was willing to learn TI-BASIC, that the topic should be about that, but of course I can understand that waiting XX months/years for xLIBC release (worst case scenarios, of course) isn't very productive compared to sticking to the current tools or trying C. But yeah in TI-BASIC and with CE Textlib, you can still do some decent stuff. It takes skills no matter the language used, though, so he needs to learn the basic concepts first prior getting into elaborate tricks.

However, an example of what I meant for CE Textlib sprites is this:

Code: [Select]
{33,1,1,10,26,12,33,1,3,1,4,22,33,1,9,1,4,22,33,2,3,2,10,20,33,2,1,2,2,18,33,3,3,1,2,18,33,2,7,2,2,18,33,3,9,1,2,18,33,2,13,2,2,18,33,4,1,4,16,22,33,5,3,2,2,20,33,5,7,2,2,20,33,8,1,1,2,22,33,8,5,1,4,22,33,8,11,1,4,22
Asm(prgmTEXTLIB

Here I use 15 rectangles to erase the entire screen, then draw the :walrii: from @JWinslow23 's Atari 2600 port of Wal-Rush every frame. (I got the colors wrong, though). I get 4 FPS, which isn't that great, but it still shows what can be achieved.
I made it flicker on purpose to show the speed. Also, the pixels are doubled in there, so technically it's a 16x8 sprite:




Here is a version where it isn't erased every frame, but changes color:
Code: [Select]
1→A
{33,0,1,11,26,18
Asm(prgmTEXTLIB
{11,23,18,23→L₁
While 1
L₁(A
{33,1,3,1,4,Ans,33,1,9,1,4,Ans,33,2,3,2,10,20,33,2,1,2,2,17,33,3,3,1,2,17,33,2,7,2,2,17,33,3,9,1,2,17,33,2,13,2,2,17,33,4,1,4,16,Ans,33,5,3,2,2,20,33,5,7,2,2,20,33,8,1,1,2,Ans,33,8,5,1,4,Ans,33,8,11,1,4,Ans
Asm(prgmTEXTLIB
A+1→A
If A>4:1→A
End




You can also use the pure BASIC Pt-On command to draw small dots that are larger than with Pxl-On to form small sprites. But Pt-On uses graphing coordinates, not screen, so you need to set Xmin, Xmax and stuff beforehand.
« Last Edit: March 12, 2016, 04:21:28 am by DJ Omnimaga »
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)
??? ??? ??? ???

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #8 on: March 12, 2016, 10:13:58 pm »
Interesting. I'll look into this when I have a bit more time.

EDIT
So, Textlib does everything on the Home Screen? Found that out w/ some experimentation.
And if I wanted to port something like Shift, I could use rectangles for most things?
Would it be really slow if I made the rectangles pixel sized? I found that I can't.

How do I determine where the rectangle will start?
How do I set the color while drawing? Apparently, 20 is white, 18 is blue, but 5 is black?
To make the background white, will I have to cover the screen w/ a white rectangle and draw over it?
How do I move the rectangles, specifically with the keys(jumping & such)?




« Last Edit: March 14, 2016, 12:48:35 am by Dudeman313 »
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 17891
  • Post Rating Ratio: +89/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #9 on: March 15, 2016, 07:06:48 pm »
I don't know if CE Textlib rectangles are drawn on the home screen. I would need to do some testings.


Rectangles coordinates are the same as the Output() command. Y goes from 1 to 10 and X from 1 to 26. But for some reasons, we can also draw them outside those boundaries as long as you don't use negative coordinates. Whether this can cause stability issues have yet to be seen. Colors are the same as in TI-BASIC and rectangle size is actually the size of an Output character, so no, you can't draw them of any size.

10 Blue
11 Red
12 Black
13 Pink
14 Green
15 Orange
16 Brown
17 Yellow
18 Dark blue
19 Light blue
20 White
21 light gray
22 light-medium gray
23 medium gray
24 dark gray
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)
??? ??? ??? ???

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #10 on: March 15, 2016, 07:34:02 pm »
Thanks! ;D
I'm going to see if I can add CE Textlib graphics to a Timber Dodge game
on Cemetech, but I should probably ask the author first.

Also, can you color Output( functions individually?
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 17891
  • Post Rating Ratio: +89/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #11 on: March 15, 2016, 07:38:30 pm »
Ask the author first, of course. And yeah you can color Output commands individually, but that requires using several Asm() commands which is very slow. Ideally, you should do all the static background drawing before the game starts, then during gameplay you should never change the Output colors at all, to keep speed to a maximum. You could maybe switch colors twice per loop but you'll already notice a slowdown.

It's because when you use the Asm() command, the calculator searches the VAT (variable allocation table) to find prgmTEXTLIB in the calculator RAM and archive, which takes a long while.
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)
??? ??? ??? ???

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #12 on: March 15, 2016, 08:29:50 pm »
I have asked him, and when he replies I may/may not start the project. :)

Well, I am using background/foreground settings, but I need to color a few things differently than everything else.
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 17891
  • Post Rating Ratio: +89/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #13 on: March 15, 2016, 09:41:54 pm »
On a side note, do you know that you can also use colored text on the graph screen but without any BASIC library? The only issue is that you can't choose the background. White, yello and light gray text has a mid gray background, while everything else has a white background. But I thought I would let you know in case this might suit your needs.
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)
??? ??? ??? ???

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CE Textlib/Basic Drawing
« Reply #14 on: March 15, 2016, 09:49:58 pm »
Well, both my game and CalcGuy123's TimberDodge are made on the home screen, and I'm somewhat lazy(:trollface:) and don't want to reprogram them both just to color them on the graph screen. And if I can't choose the background then there's no point, because I want to make TimberDodge's background blue and green, like your Wal-Rush.

So, about coloring Output( functions?
I'd like to know how to color ones individually and if it's possible to use one command to color several(but not all).

Also, 655 posts already! Wow! O.O
« Last Edit: March 15, 2016, 10:20:56 pm by Dudeman313 »
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games