CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: Dudeman313 on March 11, 2016, 11:34:14 PM

Title: CE Textlib/Basic Drawing
Post by: Dudeman313 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.
Title: Re: CE Textlib/Basic Drawing
Post by: KingInfinity 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.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 11, 2016, 11:49:38 PM
So, just forget it and wait for XX months/years?  :-\
Title: Re: CE Textlib/Basic Drawing
Post by: Adriweb on March 12, 2016, 01:36:24 AM
Well, you have C programming (https://ce-programming.github.io/documentation/setup/c-setup/) on the CE, if you want :)
And there are libs already available (https://github.com/CE-Programming/libraries), including for graphics (example here (https://github.com/CE-Programming/libraries/blob/master/graphics/graphics_examples/demo_0/main.c))

(Also, self-promotion: and even an online builder (https://tiplanet.org/pb) (still in beta) compatible with the latest toolchain, if you don't feel like setting up the toolchain locally)
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 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...   :-|
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga 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.
Title: Re: CE Textlib/Basic Drawing
Post by: Adriweb on March 12, 2016, 03:00:50 AM
Quote from: DJ Omnimaga on March 12, 2016, 02:23:40 AMThis 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.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga 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:

{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:

(https://img.ourl.ca/cetextlibsprites.gif)


Here is a version where it isn't erased every frame, but changes color:
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


(https://img.ourl.ca/cetextlibsprites2.gif)


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.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 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)?




Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga 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
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 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?
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga 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.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 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.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga 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.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 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
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 15, 2016, 11:56:16 PM
{16,TextColor,17,BackgroundColor
Asm(prgmTEXTLIB
For example, {16,10:Asm(prgmTEXTLIB would set the text color to blue and leave the background color unchanged. You can put all commands in one list, such as {16,TextColor,17,BackgroundColor , or you can make them separate.

Have you checked the CE Textlib readme.txt, by the way?
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 16, 2016, 12:05:01 AM
Yes, I have. I know how to do that, but what if I did this:

{16, LTBLUE,17,NAVY}
Asm(prgmTEXTLIB
Output(1,1,"This text should be blue.
Output(2,1,"This text should be red.
Output(3,1,"This text should be blue.

How would I change the 2nd Output( text
while keeping the others with the FGcolor command?

I'm sorry if I was unclear, but that's what I meant.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 16, 2016, 12:08:22 AM
Do you mean you want to preserve the foreground color? If so, then you would have to do this:

{16, LTBLUE,17,NAVY
Asm(prgmTEXTLIB
Output(1,1,"This text should be blue.
{17,YELLOW
Asm(prgmTEXTLIB
Output(2,1,"This text should be red.
{17,RED
Asm(prgmTEXTLIB
Output(3,1,"This text should be blue.


Also, you don't have to use the textual color names. You can use the numerical values from 10 to 24 as well. That can be handy if you use a variable to change the color or want to randomize it.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 16, 2016, 01:20:18 AM
Not exactly. I meant something like TextColor( , but for Output(.

Is that possible? To keep the FG color and BG color on the rest of the Output( s and to change the color of a single line?
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 16, 2016, 01:27:24 AM
I don't get what I mean. {16,color:Asm(prgmTEXTLIB is essentially the same thing as TextColor(COLOR), but for Output() instead of Text(). You would need to show a mockup picture to explain what you want to do.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 16, 2016, 01:44:53 AM
If I do this:

{16,10
Asm(prgmTEXTLIB
Output(1,1,"Hello
{16,11
Asm(prgmTEXTLIB
Output(2,1,"It's me...
Pause
ClrHome

Will I get this?
Hello
It's me...

EDIT:
Apparently, the answer is yes. I don't know how I didn't think of trying it before. ;D
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 16, 2016, 03:18:48 AM
Yeah, that should do it.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 16, 2016, 03:51:41 AM
Now that that's taken care of, another question, for basic on general.

Is it possible to display a character backwards?
I'm trying to remix Matt Crespin's French Flappy Bird into an English Tappy Fish with Textlib, and I found a character  that looks like a fish, but is facing the wrong way. Can I change that?

If you want to know which charater I mean, look at the fourth row from the top and the fourth column from the right in Charz 3.0.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 16, 2016, 04:41:39 AM
Nope, you can't display a character backwards. It's best to just use a different character. You could also use multiple characters stuck together, such as >(v') and ('v)< , but that's Cemetech mascot (blub), so perhaps you might want to modify it a bit for originality, such as >(^)
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 16, 2016, 07:46:44 PM
I'd be harder to do it with more than one character, so I'll probably just keep it a Tappy Bird game.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 16, 2016, 08:42:56 PM
That's fine. It doesn't really need to be that detailed anyway, since it's an hybrid BASIC game, after all.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 16, 2016, 09:14:52 PM
Yeah. So far, Tappy Bird's really slow, but when I get finished with the slow versions of both TimberDodge and TB, I'll make a topic for them.

BTW, is it possible to display pics/images on the Home Screen?
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 17, 2016, 12:33:52 AM
Pic/images on the home Screen are impossible. The only way is with CE Textlib but then it looks blocky as hell. There is probably a way that I'm trying to figure out right now, but the graphics would be slanted diagonally, so it won't be practical. The other way gives you a resolution of 13x59 pixels (stretched so that each pixel are actually 12x4 pixels large) and it takes a long while to load.

Otherwise you would need to learn C and do a library that can be used in TI-BASIC to display pictures.

EDIT @Dudeman313 this is probably the best quality you could get from a CE Textlib-generated image (this is a mockup. I didn't do a converter nor anything):

(http://img.codewalr.us/rickastley13x59.png)

It would probably take close to 50 seconds to draw. This is Rick Astley, by the way.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 17, 2016, 01:51:41 AM
What about something that's only 3 colors, in which most of it is blue and there are no curves?
Title: Re: CE Textlib/Basic Drawing
Post by: c4ooo on March 17, 2016, 01:54:08 AM
Quote from: DJ Omnimaga on March 17, 2016, 12:33:52 AM
Pic/images on the home Screen are impossible. The only way is with CE Textlib but then it looks blocky as hell. There is probably a way that I'm trying to figure out right now, but the graphics would be slanted diagonally, so it won't be practical. The other way gives you a resolution of 13x59 pixels (stretched so that each pixel are actually 12x4 pixels large) and it takes a long while to load.

Otherwise you would need to learn C and do a library that can be used in TI-BASIC to display pictures.

EDIT @Dudeman313 this is probably the best quality you could get from a CE Textlib-generated image (this is a mockup. I didn't do a converter nor anything):

(http://img.codewalr.us/rickastley13x59.png)

It would probably take close to 50 seconds to draw. This is Rick Astley, by the way.
That looks kinda cool though ^.^
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 17, 2016, 01:54:15 AM
Actually, my previous post was wrong. It's 26x59, not 13x59. Here is a better mockup:

(http://img.codewalr.us/rickastley26x59.png)

As for what you say, can you give an example?
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 17, 2016, 01:58:09 AM
A simplified Flappy Bird background. And if it takes forever to draw, will it slow down the game further once it's there?

Also, I just realized that the Nokia E63 I'm posting from has the same resolution and screen size as my CE. O.O
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 17, 2016, 02:03:03 AM
After updates, I tested drawing some dummy picture from a small list of 8 elements. The data was always the same for all lines, but I tried using 26 rectangles at a time to draw an entire row at once and it only took 7 seconds to render :D

The problem, though, is that a list cannot be larger than 999 elements, so if a picture converter was made, the image data would have to be split in two lists. String-based images are most likely out of the question, because they're very slow, but we never know.
Quote from: Dudeman313 on March 17, 2016, 01:58:09 AM
A simplified Flappy Bird background. And if it takes forever to draw, will it slow down the game further once it's there?

Also, I just realized that the Nokia E63 I'm posting from has the same resolution and screen size as my CE. O.O
I think for a Flappy Bird clone you would be better off using the same type of background as Wal-Rush CE, but with pipes scrolling through it might be hard to have parallax scrolling, so that might need to be ditched. Pipes could probably be made to look nice, but with two on the screen at a time it would probably slow down.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 17, 2016, 02:26:57 AM
7 seconds is far too long. :(
And the game is not entirely in Textlib.
What I did was just take a recently created French basic Flappy Bird TI Edition by Matt Crespin, add colors, and translate it to English.

It's in ASCII art. The pipes are made from *s and it's so slow that it's super easy.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 17, 2016, 04:26:52 AM
Did you ask him permission? Also for a Flappy Bird game you wouldn't display an actual image like above, but rather a few rectangles. For speed you could make pipes plain green rectangles
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 17, 2016, 04:56:41 AM
No, but it was on TI-Planet under a license that said I was allowed to remix it...

And like I think I mentioned, maybe not, I'm not doing this from scratch. All I did was colour the original graphics, but I needed a background for the actual game part, and even with colours and half-translated menus being the only difference between the original and mine, it seemed to have slowed a lot.

Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 17, 2016, 05:31:02 AM
Do you have  a screenshot of what you have so far?
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 17, 2016, 10:56:14 AM
No. I still can't get CEmu to work, and since I'm currently preparing for school, I don't have time to use TI-Connect.  :-|
I'll post one later, though.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 17, 2016, 06:58:47 PM
That sucks. Haven't Mateo been able to find the issue? It might definitively be the school filter or something, though. Those can screw up computers very badly if they are of shady origins. Or you could post the program and someone can make a screenshot (maybe me if I have time).

Also there are two versions of CE Textlib. Make sure to use 1.1 not 1.0. 1.0 is fine if you only need features in it, but 1.1 has many more.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 17, 2016, 08:06:27 PM
Quote from: DJ Omnimaga on March 17, 2016, 06:58:47 PM
That sucks. Haven't Mateo been able to find the issue? It might definitively be the school filter or something, though. Those can screw up computers very badly if they are of shady origins. Or you could post the program and someone can make a screenshot (maybe me if I have time).

Also there are two versions of CE Textlib. Make sure to use 1.1 not 1.0. 1.0 is fine if you only need features in it, but 1.1 has many more.
Mateo investigated, and found that the problem is not the program, but probably my own computer. Now if only I knew exactly what. :(

I think I'm using CE Textlib 1.1. It's the one on ticalc.org, I think.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 17, 2016, 08:12:59 PM
That sucks. Could it be related to your graphics card, RAM or is it OS-specific? It could be an undetected virus, though. You can get viruses just by accidentally clicking an ad or by going on a site with infected ads without knowing they're infected.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 17, 2016, 10:18:27 PM
Mateo told me he removed hardware dependency, and ben_g says it works on Windows 10. It could be a virus, though, but if I had one I wouldn't know how to find and get rid of it, though.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 21, 2016, 12:13:41 AM
Do you mean coloring each Output command separately?

You would need to do this, for example:

{16,<color>,17,<bgColor>
asm(prgmTEXTLIB
Output(Y,X,<text>
{16,<color>,17,<bgColor>
asm(prgmTEXTLIB
Output(Y,X,<text>
{16,<color>,17,<bgColor>
asm(prgmTEXTLIB
Output(Y,X,<text>


On an unrelated note, I tried experimenting with drawing 4x4 squares anywhere on the screen instead of 12x4 ones, and this was the result:

(http://img.codewalr.us/customtextlibfont.png)

And I never figured out how to draw them vertically at something else than multiples of 4. So a custom font routine using such small squares would probably not be of any practical use.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 21, 2016, 12:40:22 AM
Well, at least it looks cool.
"THE GAME?" Really?  <_<
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 21, 2016, 12:48:19 AM
I couldn't resist. Also it took a long while to get the coordinates right. Drawing such text as a sprite routine would be a major nightmare O.O (and the resulting nightmare would probably, in turn, result into massive lag)
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 21, 2016, 01:47:54 AM
How long would it take to FFMana's intro? Probably at least 2 minutes!
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 21, 2016, 02:22:02 AM
Each character would probably take 0.20 to 0.25 seconds to draw, so yeah, 10 minutes seems like a good guess :P
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 21, 2016, 05:19:44 AM
So, will this be your "revolutionary discovery of the year," or are you just getting back into TI-Basic more lately?
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 22, 2016, 09:04:39 PM
Well I am mostly experimenting right now. I don't know if I will finish anything in 2016 :P (I think I finished only 1 game in 3 years), but we never know.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 22, 2016, 10:50:44 PM
Quote from: DJ Omnimaga on March 22, 2016, 09:04:39 PM
Well I am mostly experimenting right now. I don't know if I will finish anything in 2016 :P (I think I finished only 1 game in 3 years), but we never know.
For a guy who lives alone and is on the forums for most of the day, that's not very productive. :P
But you've finished/almost finished about 3 games this year?
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 22, 2016, 11:13:00 PM
It's hard to get motivated to code when 90% of the time you are plagued with neck or upper back pain or are exhausted from work. Also actually my previous game was in 2013, not 2015. I released 5 games in 2013, 1 in 2015 but my previous release was in Early 2010. http://tistory.wikidot.com/kevin-ouellet
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on March 23, 2016, 10:06:57 AM
Quote from: DJ Omnimaga on March 22, 2016, 11:13:00 PM
It's hard to get motivated to code when 90% of the time you are plagued with neck or upper back pain or are exhausted from work. Also actually my previous game was in 2013, not 2015. I released 5 games in 2013, 1 in 2015 but my previous release was in Early 2010. http://tistory.wikidot.com/kevin-ouellet
Oh. Pain can be a nuisance sometimes.  <_<
But what about this year? How many projects are you working on?
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on March 23, 2016, 04:22:27 PM
I currently have two with code written for, and three others in the planning stages. :P I have others that are stalled since yeara, though.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 02, 2016, 10:31:22 PM
By the way, unless I screwed up, this should be the pixel grid for CE Textlib, which alternates between 1x4 pixels and 4x4 ones, so if you were to make an image converter, this is the highest possible resolution that your image could be:

(http://img.codewalr.us/cetextlibpixels.png)


I doubt this would be very practical for mViewer GX uses, though, due to the low, slanted resolution and the fact it would take over 15 seconds to render a pic (unless hardcoded?).
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 03, 2016, 12:03:17 AM
It looks okay to me, though. How long would it take to draw a simplified Flappy Bird Background to put in the back of that Flappy Bird Textlib I was making? I think I have all my progress backed up somewhere...
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 03, 2016, 06:02:46 AM
Using such resolution (alternating between 1x4 and 4x4 blocks), I bet it would take 2 minutes to render. Also, some image styles might look horrible due to the slanted layout.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 03, 2016, 10:00:37 PM
What if the majority of it(maybe 3/4 of the screen, top to bottom) was a single blue rectangle, and the rest was rolling green hills?
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 05, 2016, 05:28:13 AM
(https://img.ourl.ca/grassskyrender.gif)

{1,33,0,1,12,27,12,33,12,1,1,27,12,14
Asm(prgmTEXTLIB

For(B,7,267,26
For(A,1,28
{33,B,A,13,43,14,33,B,A,13,128,25,33,B+13,A,13,43,25,33,B+13,A,13,128,14,33,B,A+26,13,43,14,33,B,A+26,13,128,25,33,B+13,A+26,13,43,25,33,B+13,A+26,13,128,14,33,B,A+52,13,43,14,33,B,A+52,13,128,25,33,B+13,A+52,13,43,25,33,B+13,A+52,13,128,14

Asm(prgmTEXTLIB
End
End
{33,780,1,8,27,18
Asm(prgmTEXTLIB
Pause


I don't think people will want to wait through this rendering speed. By the way, drawing more stuff in a larger list doesn't improve the speed that much, because the TI-OS takes longer to store the list into Ans.


EDIT: Also this is a mockup, not actual code:

(http://img.codewalr.us/walriitextlibized.png)

And I doubt anyone would want Walrii to look like that in his game, especially if he takes several seconds to render. :P
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 05, 2016, 02:42:58 PM
What about only 3 rows of grass from the bottom up, the blue rectangle, and a white "Loading..." text?
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 05, 2016, 05:01:01 PM
That would still be slow-ish even for a cutscene. Just with 2 rows of blocks, I got annoyed at the title screen load time and decided to make it shorter.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 05, 2016, 09:15:28 PM
What about 3 rows, but with only one row of small blocks at the top, maybe 1 pixel larger? As long as the top is still slanted, the resolution doesn't matter to me.

EDIT: Sorry if I'm starting to sound naggy. I just don't have the time to try to get CEmu to work so that I can try it myself.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 05, 2016, 10:27:02 PM
That would be better I think, speed-wise. Would the plain-colored part be light green or middle green? Or would it be a different color such as brown or black?
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 05, 2016, 11:26:28 PM
Quote from: DJ Omnimaga on April 05, 2016, 10:27:02 PM
That would be better I think, speed-wise. Would the plain-colored part be light green or middle green? Or would it be a different color such as brown or black?
What do you mean by plain-coloured area?
I'm not sure I understand, but here's my plan: Blue sky, dark green top of the hills, and medium green hills.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 05, 2016, 11:47:42 PM
Oh I mean the part below the row of grass. Kinda like this mockup (I don't know if that's possible with CE Textlib but I wouldn't be surprised if it was)

(http://img.codewalr.us/ghostngoblincemockups.png)

I made those because I was bored and wanted to see what a zombie-themed game like Ghouls N Ghost would look like. Everything except the grass/snow/lava/water and the top of the sky is made of 3 rectangles each and enemies or the characters would probably move in a way that prevents gradient overlapping.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 06, 2016, 02:41:42 PM
That's really cool. It might run really slow for a zombie game, though, because the whole point of those is to survive a swarm.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 06, 2016, 04:25:22 PM
It depends. If it's just a clone of Ghouls N Ghosts, then there is a limited amount of enemies at once on the screen and no swarm would be involved.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 06, 2016, 06:52:25 PM
Oh. I've never played Ghouls N Ghosts. It sounds cool.
Actually, most of the games I've played I didn't know existed until they had calculator ports.  :-|
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 09, 2016, 05:25:12 AM
Well, another thing is that even if you played console games, it would totally be understandable if you didn't know that particular game, because it came out in 1988 (1991 for the SNES). Also it's extremely hard.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 09, 2016, 07:19:15 PM
Really? Like, die-on-1st-level hard, or outright difficult?
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 09, 2016, 07:20:49 PM
Both. Getting past the first mini-boss is next to impossible.

Also a name idea for a calc clone could be Ghouls 'N Goblins. :P
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 09, 2016, 07:55:15 PM
That doesn't sound like something I'd try. I'd give up. :trollface:

Sounds good to me. ;)
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 10, 2016, 05:49:04 AM
By the way, my idea for this game is that the floor and the sky gradient (or the ceiling, if any) would be pre-rendered before the level starts. Map data would be used for collision detection, but when drawing platforms and blocks, the game would only draw every 2 or 3 object from the data and each object (such as the pillars in the mockups above) would be made of just 3 rectangles of any size (I don't know how it would be specified, but they would be allowed to be wider to make up for the "drawing every 2 or 3 object thing". Enemies would also be made out of 3 blocks, but they would be separate from the map data and be allowed to move around.

THat might actually allow scrolling to be possible without too much speed loss because no tilemapping would be involved. Otherwise I could always just have no scrolling and pre-render everything fast.


Another idea I had for a CE Textlib game would be something like First Fantasy II but where the graphics are so simple that all wall tiles can be drawn with just 2-3 blocks each and perhaps go as far as allowing scrolling.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 11, 2016, 10:25:59 PM
I like games with scrolling. :D
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 13, 2016, 05:57:31 PM
So I finally maxed out CE Textlib rectangle  limits it seems. Here they are:

-CE Textlib will accept lists up to 255 elements each. Since a rectangle takes 6 of them, this means you can chain 42 rectangles in 1 Asm(prgmTEXTLIB) command.

-There are 16 different colors, all of which except one are the same as TI-BASIC. The extra color is teal and is color #25 (the last one). Any ID other than 10-25 will show black.

-Height can be multiples of 4 pixels.

-Width can be multiples of 4 pixels, but it's also possible to have a width of 1 pixel by setting it to 128.

-Vertical offset starts at the 2nd row of pixels and can be multiples of 4 pixels. To make things much easier, it's recommended to start with an offset of 780 or something else that starts drawing there.

-Horizontal offset starts at the 3rd column of pixels and can be multiples of 4 pixels, but in order to align the rectangles vertically you need to wrap around often enough and then subtract 13 from the vertical offset, which might make drawing at the top of the screen more difficult. Funky results will happen if using CE Textlib values that are not from 1 to 255. Here's an example of coordinates and rectangle placements:
(http://img.codewalr.us/examplecetextlibhax.png)EDIT: It seems that you can also start at 12 instead of 780 with no problem, which saves space, but you need to be careful with negative numbers

-The smallest and fastest way to fill the entire screen with one color is {33,780,1,12,27,color:Asm(prgmTEXTLIB.

-The first row of pixels and the two leftmost pixels right below cannot be used by CE Textlib. So a small line of gray pixels will remain visible.

-Sometimes, drawing a rectangle that goes outside the bottom of the screen will cause it to be 1 pixel shorter in width.

There are some tricks to get around rectangle height limitations: It's possible to emulate any other height multiple by drawing a second rectangle under it with an offset high enough to wrap around the screen, which will move the rectangle 1, 2 or 3 pixels below (although often with an horizontal offset). This is how I got the sky gradient effects in Wal-Rush CE's newest title screen.

Also, since those tricks circumvents CE Textlib limitations, this means you have to translate the pixel offsets and dimensions into what CE Textlib will accept. I might try to create a table at some point to explain in more details.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 13, 2016, 07:46:45 PM
Behold: DJ's revolution of the month! :D
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 13, 2016, 10:12:23 PM
Don't you mean decade, not month? My last revolution was over a decade ago. :P (granted, perhaps the fact Supersonic Ball ran at 6 MHz even with parallax scrolling and still keeping 20 FPS could count, but that game never was very popular and most people probably thinks it runs at 15 MHz)
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 14, 2016, 08:14:14 PM
Quote from: DJ Omnimaga on April 13, 2016, 10:12:23 PM
Don't you mean decade, not month? My last revolution was over a decade ago. :P (granted, perhaps the fact Supersonic Ball ran at 6 MHz even with parallax scrolling and still keeping 20 FPS could count, but that game never was very popular and most people probably thinks it runs at 15 MHz)
Who's to say you won't make a revolution about xLIBCE next month? :P
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 18, 2016, 06:05:46 PM
We never know, but since I am so focused on CE Textlib right now, I doubt I'll do much xLIBCE stuff right away. I might however do some minor changes to my older games, though, depending of how fast they run on the CE.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 18, 2016, 06:54:08 PM
It'd be cool to see a CE Textlib v xLIB showdown.
You could remake some of your older games in CE Textlib and do a side by side speed comparison.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 18, 2016, 07:58:48 PM
So this program draws 4x4 squares to form a grid of 78x57 of them:

(http://img.codewalr.us/4x4textlib.png)

{33,12,1,12,27,12,1
Asm(prgmTEXTLIB
For(A,1,26
For(Z,38,766,13
{33,Z,A,13,43,randInt(10,25),33,Z-13,A+107,13,43,randInt(10,25),33,Z-26,A+214,13,43,randInt(10,25)
Asm(prgmTEXTLIB

End
End
Pause


Notice how I am drawing 3 squares at a time and see what I did to the horizontal and vertical offsets (A and Z).

Also I realized that it's not necessary to use 780 to draw at the very top of the screen, but rather 12, which might make you save some bytes. But the trick used in the screenshot above won't let you draw everywhere in the top rows, so it's better not to use the top rows when using aligned 4x4 squares. I also didn't use the last row at the bottom because the squares would be 4x3 and I was too lazy to use the left and right edges. :P

Quote from: Dudeman313 on April 18, 2016, 06:54:08 PM
It'd be cool to see a CE Textlib v xLIB showdown.
You could remake some of your older games in CE Textlib and do a side by side speed comparison.
xLIB would definitively win, hands down, partly due to not having to store a large list then run an ASM program every loop iteration. It's still cool to see what can be done with more limited softwares, though.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 18, 2016, 10:16:15 PM
Even if xLIB would win, I thought maybe CE Textlib might be somewhere in speed comparison to Monochrome xLIB.
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 19, 2016, 01:38:47 AM
It depends. Some stuff would be faster in CE Textlib, such as drawing rectangles, because you can chain commands, but sprites are definitively slower.

On a side note, I plan to experiment with scaled sprites in CE Textlib at some point (probably the ones where rectangle offsets are multiples of 12,4 (X,Y) to start). Not that this would be practical at all, but it would still be cool to watch.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 19, 2016, 01:07:43 PM
A lot of programs are made to watch. ;)
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 19, 2016, 03:47:11 PM
Yeah true. Also my first attempt at making scaled sprites was futile, because horizontal values cannot exceed 255, so past 255 things glitched out. I'll try again later I guess.
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 19, 2016, 08:27:48 PM
Quote from: DJ Omnimaga on April 18, 2016, 07:58:48 PM
So this program draws 4x4 squares to form a grid of 78x57 of them:

(http://img.codewalr.us/4x4textlib.png)

{33,12,1,12,27,12,1
Asm(prgmTEXTLIB
For(A,1,26
For(Z,38,766,13
{33,Z,A,13,43,randInt(10,25),33,Z-13,A+107,13,43,randInt(10,25),33,Z-26,A+214,13,43,randInt(10,25)
Asm(prgmTEXTLIB

End
End
Pause

This might be a bit off-topic, but in that picture I see some colonial version of Einstein wearing a gray wig and an American-Revolution-style colonial hat, who has a pudgy nose, round :walrii: eyes, a huge mustache, and a fat chin.
He also is sticking out his lounge while holding something looking like either a Magnifying glass or a tongue depressor or a teddy bear or a rubber chicken or a beaker.

I know, my mind is strange. :P
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 19, 2016, 08:42:42 PM
Wait, where do you see that? O.O, you should maybe circle the parts where you see it and post an edited pic. :P
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 19, 2016, 08:57:09 PM
Something like this, but it changes every time I look; It didn't look like this the first time.

(http://piskel-imgstore-b.appspot.com/img/219222c0-0671-11e6-a592-db71bace7eb0.gif)
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 19, 2016, 08:59:59 PM
Well, I definitively don't see this :P
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 19, 2016, 09:10:04 PM
Quote from: DJ Omnimaga on April 19, 2016, 08:59:59 PM
Well, I definitively don't see this :P
This coming from a person who instantly sees the walrus in everything? :P
Title: Re: CE Textlib/Basic Drawing
Post by: aetios on April 19, 2016, 09:12:45 PM
I actually know what you mean, @Dudeman313. I kinda see that too :P
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 19, 2016, 09:14:10 PM
Yay! Someone gets me. :)
Title: Re: CE Textlib/Basic Drawing
Post by: Dream of Omnimaga on April 19, 2016, 09:40:05 PM
Quote from: Dudeman313 on April 19, 2016, 09:10:04 PM
Quote from: DJ Omnimaga on April 19, 2016, 08:59:59 PM
Well, I definitively don't see this :P
This coming from a person who instantly sees the walrus in everything? :P
There is a difference between seeing a walrus in everything and creating a walrus out of everything. :P
Title: Re: CE Textlib/Basic Drawing
Post by: Dudeman313 on April 20, 2016, 01:12:45 PM
True. :P