http://learn.cemetech.net/index.php?title=XLIBC_for_Beginners&feed=atom&action=historyXLIBC for Beginners - Revision history2024-03-29T01:50:19ZRevision history for this page on the wikiMediaWiki 1.34.0http://learn.cemetech.net/index.php?title=XLIBC_for_Beginners&diff=2627&oldid=prevUnicorn at 06:57, 26 February 20162016-02-26T06:57:05Z<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 06:57, 26 February 2016</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l213" >Line 213:</td>
<td colspan="2" class="diff-lineno">Line 213:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>= How to make a spritesheet =</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>= How to make a spritesheet =</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">----</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>= How to make a tilemap =</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>= How to make a tilemap =</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">----</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>= Example program =</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>= Example program =</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">----</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>In this section, we want to make a program together with you.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>In this section, we want to make a program together with you.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> :CODE GOES</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> :CODE GOES</div></td></tr>
</table>Unicornhttp://learn.cemetech.net/index.php?title=XLIBC_for_Beginners&diff=2626&oldid=prevUnicorn: /* This Tutorial is in Development */2016-02-26T06:55:46Z<p><span dir="auto"><span class="autocomment">This Tutorial is in Development</span></span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 06:55, 26 February 2016</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l224" >Line 224:</td>
<td colspan="2" class="diff-lineno">Line 224:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=This Tutorial is in Development=</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=This Tutorial is in Development=</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">----</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Go [https://www.cemetech.net/forum/viewtopic.php?p=244599#244599 the development thread] for information and current progress.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Go [https://www.cemetech.net/forum/viewtopic.php?p=244599#244599 the development thread] for information and current progress.</div></td></tr>
</table>Unicornhttp://learn.cemetech.net/index.php?title=XLIBC_for_Beginners&diff=2623&oldid=prevUnicorn: Created page with "This is a tutorial for people who definitely want to use Hybrid Basic, but don't know how to start, and what you can do with it. = What is Hybrid Basic? = Hybrid Basic is an..."2016-02-26T06:03:49Z<p>Created page with "This is a tutorial for people who definitely want to use Hybrid Basic, but don't know how to start, and what you can do with it. = What is Hybrid Basic? = Hybrid Basic is an..."</p>
<p><b>New page</b></p><div>This is a tutorial for people who definitely want to use Hybrid Basic, but don't know how to start, and what you can do with it.<br />
<br />
= What is Hybrid Basic? =<br />
Hybrid Basic is an addition to normal Basic, the standard programming language on (TI) calculators. Better said, with Hybrid Basic, you can use the standard Basic, and even some new features. Hybrid Basic is designed for very fast graphics, so if you want a nice game, with some graphics, we encourage you to use Hybrid Basic!<br />
<br />
= Getting Ready to Program =<br />
Make sure you have [http://www.ticalc.org/archives/files/fileinfo/456/45670.html DoorsCSE] installed on your calculator. You also will want to install [http://www.ticalc.org/archives/files/fileinfo/433/43315.html TokenIDE] on your computer. Doors CSE adds the xLIBC library, as well as many helpful features for your calculator. TokenIDE features an image editor and building tools for the xLIBC library.<br />
<br />
----<br />
<br />
'''Windows:'''<br />
<br />
Unpack the downloaded zip and double click TokenIDE.exe in the folder. DO NOT remove TokenIDE from the folder, as it will not work when removed from its dependencies. You can create a shortcut to the destop if navigating to a folder annoys you.<br />
<br />
----<br />
<br />
'''Linux:''' <br />
<br />
Using TokenIDE on linux is a little roundabout, but it can be done. You just have to install [http://www.mono-project.com/ Mono] (A wine-like program that includes .net) and then cd to the directory of the program and run '''Run TokenIDE''' <br />
<br />
'''Install Mono'''<br />
sudo apt-get install mono-complete<br />
'''Run TokenIDE'''<br />
mono TokenIDE.exe<br />
<br />
If you get an error like shown below, go into the TokenIDE.ini and change all of the forward-slashes to back-slashes<br />
Unable to load default file, Tokens/DCSE.xml quitting<br />
<br />
= Commands =<br />
=== real(0 - xLIBCSetup ===<br />
<br />
----<br />
<br />
The basic of the the xLIBC functions is the half-resolution. This works as follows: the screen as you normally see will being splitted in two halves. One half would be stretched, the other half you don't see, that would being our buffer. That would look like this: <br />
<br />
[[File:Half-res.gif]]<br />
<br />
As you can see, there is no second half. <br />
<br />
'''Very important!''' All the xLIBC functions expected to be in half-res mode! <br />
<br />
These are the functions of real(0 : <br />
<br />
'''GetXLIBCVersion'''<br />
:real(0,0) -> returns the version of xLIBC in Ans, for me it returns 2.<br />
<br />
'''SetupGraphics'''<br />
:real(0,1,1) -> this enables the half-res mode, as you can see in the previous image.<br />
:real(0,1,0,0) -> this returns to the normal mode, WITHOUT redrawing the status bar! This might being useful for some games, which are not in the half-res mode, but do not want to see the status bar. <br />
:real(0,1,0,1) -> this returns to the normal mode, and redraws the statusbar. <br />
<br />
'''Very important!''' Don't forget to switch the half-res mode off, or the TIOS will stuck in this mode! <br />
<br />
[[File:Half-res-program-ended.gif]]<br />
<br />
<br />
'''SetSpeed'''<br />
:real(0,2,0) -> Disable fast (15MHz) mode, switching to 6MHz mode <br />
:real(0,2,1) -> Enable fast (15MHz) mode<br />
<br />
Note: the default CPU speed is 15MHz. Try it, and see the difference. <br />
<br />
'''SetupColorMode'''<br />
:real(0,3,0) -> enables all the possible colors in xLIBC <br />
:real(0,3,1) -> enables 8COLOUR - I have no idea what changes with this. <br />
:real(0,3,2) -> inverts the screen, like black->white and white->black. It gets each color value per pixel, and then 255-(color_value) would be the new color value. To restore it back, invert it again, or -> <br />
:real(0,3,3) -> restores the colors back to normal, useful for moments if you do not know whether the colors are inverted or not. <br />
:real(0,3,4,(color_value),(update_LCD)) -> fills the active half of the screen with one color from the color palette, useful for backgroud. I will explain the update_LCD later. <br />
:real(0,3,5,(color_value)) -> I cannot get this working, but the wiki says that it will change the color value per pixel with shapes and sprites <br />
<br />
[[File:invertscreen.gif]]<br />
<br />
=== real(1 - UserVariables ===<br />
<br />
----<br />
<br />
xLIBC has the facility to utilize 'internal user variables' for data storage and calculations as opposed to using TI-OS variables. They work exactly the same, but the main difference is, is that they are faster, and temporary, which means that you cannot 'save' them for other programs. Some xLIBC functions expected (only) UserVars, so it is always handy to learn and use these. <br />
<br />
These are the functions of real(1: <br />
<br />
'''GetUservar'''<br />
real(1,0,(uservar_num))<br />
This returns the value of the UserVar in Ans <br />
<br />
'''SetUservar'''<br />
real(1,1,(uservar_num),(value))<br />
This function writes (value) to UserVar <br />
<br />
'''AddToUservar'''<br />
real(1,2,(uservar_num),(value))<br />
This function add (value) to UserVar <br />
<br />
'''SubFromUservar'''<br />
real(1,3,(uservar_num),(value))<br />
This function subtracts (value) to UserVar <br />
<br />
'''Example'''<br />
:real(1,1,1,5 // Sets uservar 1 to 5<br />
:Disp real(1,0,1 // Displays Uservar 1<br />
:real(1,2,1,3 // Adds 3 to uservar 1<br />
:Disp real(1,0,1<br />
:real(1,3,1,7 // Subtracts 7 from uservar 1<br />
:Disp real(1,0,1<br />
:Pause //Pauses program<br />
<br />
Try the above code out on your calculator!<br />
<br />
=== real(2 - GetKey ===<br />
<br />
----<br />
<br />
These routines have been significantly overhauled from the TI-BASIC getKey function and are even more comprehensive. <br />
<br />
These are the functions of real(2: <br />
<br />
'''GetKey'''<br />
real(2,0,0)<br />
Key code stored in Ans <br />
'''Very important!''' These values are NOT the same as the values of getKey, but it returns the values of _GetCSC: <br />
<br />
[[File:Keycodes xLIBC.png]]<br />
<br />
'''GetKeyCheckList'''<br />
real(2,0,1,(getkey_checknum),(getkey_keyvalue),(getKey_uservar),(getkey_value),... )<br />
This updates (getkey_uservar) by (getkey_value) if you pressed (getkey_keyvalue). (getkey_checknum) is the amount of UserVars to update. Useful for counters or sprites. <br />
<br />
'''GetKeyArrows'''<br />
real(2,1,(uservar_x),(uservar_y),(value_x),(value_y))<br />
This updates (uservar_x) and (uservar_y) with respective (value_x) and (value_y) if you pressed any arrow. <br />
<br />
* If up is pressed then USERVAR_Y = USERVAR_Y - VALUE_Y <br />
* If down is pressed then USERVAR_Y = USERVAR_Y + VALUE_Y <br />
* If left is pressed then USERVAR_X = USERVAR_X - VALUE_X <br />
* If right is pressed then USERVAR_X = USERVAR_X + VALUE_X <br />
<br />
'''GetKeyArrowsDiagonals'''<br />
real(2,2,(uservar_x),(uservar_y),(value_x),(value_y))<br />
This works the same as GetKeyArrows, with the exception that a combination of the arrows also will update the UserVars. <br />
<br />
* If up is pressed then USERVAR_Y = USERVAR_Y - VALUE_Y <br />
* If down is pressed then USERVAR_Y = USERVAR_Y + VALUE_Y <br />
* If left is pressed then USERVAR_X = USERVAR_X - VALUE_X <br />
* If right is pressed then USERVAR_X = USERVAR_X + VALUE_X <br />
* If up+left is pressed then USERVAR_Y = USERVAR_Y - VALUE_Y, USERVAR_X = USERVAR_X - VALUE_X <br />
* If up+right is pressed then USERVAR_Y = USERVAR_Y - VALUE_Y, USERVAR_X = USERVAR_X + VALUE_X <br />
* If down+left is pressed then USERVAR_Y = USERVAR_Y + VALUE_Y, USERVAR_X = USERVAR_X - VALUE_X <br />
* If down+right is pressed then USERVAR_Y = USERVAR_Y + VALUE_Y, USERVAR_X = USERVAR_X + VALUE_X <br />
<br />
'''GetKeyArrowsCheckTile'''<br />
real(2,3,(uservar_x),(uservar_y),(value_x),(value_y),(uservar_mapwidth),(collisiontile),(mapstring),(x_left),(y_up),(x_right),(y_bottom))<br />
This routine will only update the UserVars with their values if the move is to a walkable tile (see real(3) - DrawMap). You must specify an UserVar with the width of the map (that is often 20, 160/Cool. It checks for a box from (X_left, Y_top) to (X_right, Y_bottom). For a single sprite of 8x8 pixels, that would be (X_sprite+0, Y_sprite+0, X_sprite+7, Y_sprite+7). <br />
<br />
'''GetKeyArrowsDiagonalsCheckTile'''<br />
real(2,4,(uservar_x),(uservar_y),(value_x),(value_y),(uservar_mapwidth),(collisiontile),(mapstring),(x_left),(y_up),(x_right),(y_bottom)) -> same as above, now with diagonals.<br />
<br />
<br />
'''GetKeyArrowsCheckTileList'''<br />
real(2,5,(uservar_x),(uservar_y),(value_x),(value_y),(uservar_mapwidth),(collisiontile),(mapstring),(x_left),(y_up),(x_right),(y_bottom))<br />
It works the same as real(2,3....), but now it will return information regarding any keypress and any collided tiles in a 'real list' contained in a user-defined list named "XL". <br />
XL have the following format: <br />
{key_press , num_collided_tiles , collided_tiles_list} <br />
key_press returns ~1 for noarrow, 0 for up, 1 for down, 2 for left and 3 for right. <br />
num_collided_tiles is the number of tiles collided against <br />
collided_tiles_list is a list of collided tiles against. <br />
<br />
'''GetKeyArrowsDiagonalsCheckTileList'''<br />
real(2,6,(uservar_x),(uservar_y),(value_x),(value_y),(uservar_mapwidth),(collisiontile),(mapstring),(x_left),(y_up),(x_right),(y_bottom))<br />
Same as above, now with diagonals. <br />
<br />
All of these routines are pretty useful, for smarter and better movement.<br />
<br />
=== real(3 - DrawMap ===<br />
<br />
----<br />
<br />
Explanation<br />
<br />
=== real(4 - DrawSprite ===<br />
<br />
----<br />
<br />
Explanation<br />
<br />
=== real(5 - ManagePic ===<br />
<br />
----<br />
<br />
Explanation<br />
<br />
=== real(6 - DrawString ===<br />
<br />
----<br />
<br />
Explanation<br />
<br />
=== real(7 - DrawShape ===<br />
<br />
----<br />
<br />
Explanation<br />
<br />
=== real(8 - xLIBCUtility ===<br />
<br />
----<br />
<br />
Explanation<br />
<br />
=== real(9 - UpdateLCD ===<br />
<br />
----<br />
<br />
Explanation<br />
<br />
= How to make a spritesheet =<br />
<br />
= How to make a tilemap =<br />
<br />
= Example program =<br />
In this section, we want to make a program together with you.<br />
:CODE GOES<br />
:ONE SPACE IN FROM THE MARGIN<br />
:SO MEDIAWIKI CAN PUT IT IN A BOX<br />
You can also ''add'' '''emphasis''' and use other tools to mark up text.<br />
<br />
=This Tutorial is in Development=<br />
Go [https://www.cemetech.net/forum/viewtopic.php?p=244599#244599 the development thread] for information and current progress.</div>Unicorn