Author Topic: xLIB 84C Edition  (Read 50942 times)

0 Members and 1 Guest are viewing this topic.

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #60 on: July 03, 2013, 09:17:33 pm »
Normally i would stack some stuff up and try to keep everything stationary (im just recording from a phone).

However im currently out of town on business for 2 weeks so i didnt have access to anything in my hotel room :/.

But the quiet time is a good opportunity to get some coding done :).

EDIT - Here is the code for the demo program:

Code: [Select]
:"set user vars
:real(1,1,0,0
:real(1,1,1,0
:real(1,1,2,0
:real(1,1,3,0
:real(1,1,5,0
:real(1,1,6,0
:real(1,1,7,64
:"set 160x240 mode
:real(0,1,0
:"draw tilemap (to both sides of LCD)
:real(3,0,5,6,7,0,0,1
:real(3,0,5,6,7,0,0,0
:"loop until clear is pressed
:Repeat real(2,0)=15
:"draw character sprite, updateLCD
:real(4,0,1,2,2,0,249,1,0,124,125,126,127
:"draw tiles behind old character sprite to inactiveLCD section
:real(4,2,3,2,2,0,1,0,real(3,1,2,3,7,0,0),real(3,1,2,3,7,0,8),real(3,1,2,3,7,8,0),real(3,1,2,3,7,8,8
:"copy old character position to temp position
:real(1,1,2,real(1,0,0
:real(1,1,3,real(1,0,1
:"test for keypresses, update x/y depending on arrows
:real(2,4,4,1,-8,1,1,8,2,0,-8,3,0,8
:End
:"restore LCD to normal mode
:real(0,1,1
« Last Edit: July 03, 2013, 11:24:09 pm by tr1p1ea »
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


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: xLIB 84C Edition
« Reply #61 on: July 03, 2013, 11:31:15 pm »
Interesting. By the way you should put what each Real command do in the first post, for example real(1, real(2, etc, so when this comes out (beta, final, etc) and people post code, it would be easier for people to learn the language. :)

By the way, I notice the real(0,1,0 command there. When updating the screen content, I assume that it will automatically set 160 by default then alternate between both GRAM areas, right? Also is there an argument in that command that lets you change the screen position, for example for earthquake effects?

Also what's with the real(4,2,3,2,2,0,1,0,real(3,1,2,3,7,0,0),real(3,1,2,3,7,0,8),real(3,1,2,3,7,8,0),real(3,1,2,3,7,8,8 thing? O.O

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #62 on: July 04, 2013, 12:23:12 am »
You do need to set the screen to 160x240 mode before drawing, otherwise you will only be able to draw to half a screen. I could have it do it anytime you try to draw something however.

I will add the ability to offset the LCD if needed, its only a few lines of code.

The command is used to draw 4 8x8 sprites which are the tiles that the sprite is currently over (to erase the sprite).

real(4 is draw sprite so:

real(4,x,y,w,h,pic,transcolour,updateLCD,tile0,tile1,tile2,tile3 ...

for tile0 etc there is: real(3,1,2,3,7,0,0) which is the 'getTile' command (real(3,0.. is drawMap, real(3,1.. is getTile) so:

real(3,1,x,y,mapwidth,xoff,yoff) where xoff/yoff is an offset you can provide that will add to x/y so that you can get tiles for larger sprites. The result is stored to Ans (and is just used inline in the example).

Sprites are drawn in 8x8 chunks, but also in columns first, then rows.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


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: xLIB 84C Edition
« Reply #63 on: July 04, 2013, 03:45:52 am »
Yeah about 320x240 I meant for people who plan to use some weird tricks in their tilemaps  or something :P. I personally probably will only use 160x120, though (160x240).

Also thanks for the commands doc. :) As for GetTile, I like the idea, since this will make collision detection much easier. :)

Also, regarding map data, will it be possible to use boolean logic for a tile ID or will we have to create a second (modified) copy of the tilemap to load or even hard-code map modifiers? For example, in some of my games, after you activated a switch in a dungeon, a path in the wall would open. However, when leaving the room that path had to remain open, meaning that when you came back in, the path had to be immediately displayed as open.
« Last Edit: July 04, 2013, 03:46:42 am by DJ Omnimaga »

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #64 on: July 04, 2013, 04:04:39 am »
Well the map will site in temp RAM and you can modify the tiles in it however you like. You just cant save it back to the original data.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline JamesV

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 276
  • Rating: +77/-0
    • View Profile
    • James V's TI-Calculator page
Re: xLIB 84C Edition
« Reply #65 on: July 04, 2013, 04:53:04 am »
As usual, this looks incredible! Great work Tr1p!

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: xLIB 84C Edition
« Reply #66 on: July 04, 2013, 05:11:01 am »
That looks awesome tr1p!
You make the slowness of the screen look non-existing O.O
And you make like every game seemingly possible.....

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

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: xLIB 84C Edition
« Reply #67 on: July 04, 2013, 09:46:23 am »
Well the map will site in temp RAM and you can modify the tiles in it however you like. You just cant save it back to the original data.
Yeah but as I say, the issue is that if might be annoying to have to modify the data by default everytime you reload the map. If, for example, the game has a total of 500 treasure chests, then this means that my map loading code will contain 500 If instructions checking each map that contains treasure chests >.<

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #68 on: July 04, 2013, 05:30:57 pm »
How would you have done this normally on the 83+? I guess people never had their maps in archive?

Also i thought of a great idea! I can use ExecLib( so that BASIC programs can enable/disable xLIB from within their programs! I wonder what the TIOS throws should xLIB not even be on the calc?
« Last Edit: July 04, 2013, 06:00:52 pm by tr1p1ea »
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


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: xLIB 84C Edition
« Reply #69 on: July 05, 2013, 01:06:01 am »
Here is a map from Reuben Quest: Ev Awakening, for example, using matrices in xLIB 0.1a (non-APP) format:

Quote
:If N=5821
:[[16,16,16,16,16,16,29,11,39,40,27,16][16,16,16,29,27,29,41,11-(L1(1)=4),11,11,39,15][28,28,29,41,39,41,11,11,11,10+(L1(1)=4),11,15][40,40,41,11,11,11,11,11,11,11,11,15][11,11,11,11,11,11,11,11,11,11,3,16][4,4,5,11,11,11,11,11,3,4,4,16][16,16,16,5,11,11,11,11,27,28,54,55][16,16,16,16,5,11,11,11,39,40,66,67]]

From what I recall, this is the gate near your house that you need to open by beating the first boss. After the first boss is defeated, the gate is replaced with normal tiles you can pass on. For size and speed reason, NPCs and event tiles in that game are part of the maps.

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #70 on: July 18, 2013, 07:52:47 am »
Just a small colour drawLine test. Note that this is in 160x120 res ... but i have limited the random line coords to the middle ofthe screen because there is no clipping.

Also its a jsTIfied screenie so its a lot smoother in reality:

"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: xLIB 84C Edition
« Reply #71 on: July 18, 2013, 09:01:07 am »
that is quick.....and it looks awesome O.O
and now to adding clipping :P

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

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: xLIB 84C Edition
« Reply #72 on: July 18, 2013, 09:54:32 pm »
Just a small colour drawLine test. Note that this is in 160x120 res ... but i have limited the random line coords to the middle ofthe screen because there is no clipping.

Also its a jsTIfied screenie so its a lot smoother in reality:



O.O

Is it me or this xLIB is much faster than the other one? I know this lacks line clipping support, meaning it's much faster already, but still... awesome.

By the way, will there be a command to change the contrast (and store contrast value to Ans to reset contrast back to its original state) and even turn the screen ON/OFF? I saw that Buttonz turns the screen OFF during transitions and I thought this would be nice to have this in xLIB.
« Last Edit: July 18, 2013, 09:59:43 pm by DJ Omnimaga »

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: xLIB 84C Edition
« Reply #73 on: July 19, 2013, 12:02:51 am »
Well i should say that this is a raw line test, so the xLIB commands will be a bit slower. But still it gives a good idea of the colours that can be used.

That being said this routine is 8-bits only, so i do need to extend it to allow for the full range of coords.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


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: Re: xLIB 84C Edition
« Reply #74 on: July 19, 2013, 12:36:47 pm »
Could you post how the color palette looks like btw? (As well as the values)?