Text tutorials 1. Hello, World! Hello World in TempleOS is very easy. It's only one line actually. In this tutorial, you actually get to learn the basics of navigating the terminal and make your first program. Terminal commands{ DirMk("Tutorials"); //Create directory, also known as a folder. Cd("Tutorials"); //Go into the newly created directory/folder. Ed("Tutorial1.HC");//Create a new .HC file named Tutorial1 inside the current folder. } Code{ "Hello, World!/n";//Type "Hello, World!" in the current command terminal. "\n" character creates a new line. } When you are done writing your program, hit F5 to run it! Play around with the text widgets by hitting <ctrl-l>. If anything were to go wrong, you can kill the program by hitting <ctrl-shift-x> and you can focus on the next task with <ctrl-alt-n>. 2. Input Input in TempleOS can be a little tricky. In this tutorial, we only go thruogh how to capture arrow keys input, which is captured diffrently from the others. If you want to learn more about input in TempleOS, I recommend using the Man() command to see where functions like ScanMsg() are defined. TempleOS is 100% open source, even the kernel. Code{ U0 Main() { I64 msg_code,arg1,arg2,sc,ch; //I64 = Long. try{ //try{} and catch{} cause all variables in a function do be non-reg. do{ if(msg_code=ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN) { ch=arg1; sc=arg2; switch(sc.u8[0]) { //Arrow keys are stored diffrently from the other normal keys. /*Try adding your own cases with Char2ScanCode('x'), with x being a letter of your choise.*/ case SC_CURSOR_LEFT: "Left\n"; break; case SC_CURSOR_DOWN: "Down\n"; break; case SC_CURSOR_UP: "Up\n"; break; case SC_CURSOR_RIGHT: "Right\n"; break; }while(ch!=CH_ESC&&ch!=CH_SHIFT_ESC); }catch; } Main; //No parenthesis required if the function has no parimiters } If you don't want to go in depth about input, you can skip this part. The average TempleOS programmer wont have to think too much about this, so please don't let all this text scare you away. Why is the msg_code declaration in an if statement? First of all, the 1<<MSG_KEY_DOWN is a flag we give to ScanMsg. If ScanMsg detects that no message fits the mask, it immediatly returns FALSE. The first perimeter in ScanMsg is ASCII, (those starting in CH), and the second is scan_code(those starting in SC). Why do we detect arrow keys diffrently? If you want to go even more in depth about input, check out "::/Doc/CharOverview.DD". The short answer is that a char,or a U8 as it's known in TempleOS, has it's code in the 4th byte, which is how most input is stored. Arrow keys and numpad keys are stored diffrently. 3. Graphics This is where TempleOS code gets hard to type out. It is well known that sprites are stored in source code in TempleOS. <ctrl-r> to make sprites and put pointers to sprites. In TXT tutorials, I will not include pictures of sprites. Instead i will type "<1>" for every sprite in the code. There is a lot you can do with sprites in TempleOS. I recommend looking into it. If you chose to look into it, check out the "::/Adam/Gr" directory where (almost) all sprite code is stored. There are actually 2 diffrent variations of the code in this tutorial. Code1{ //Easier variant. <1>//<ctrl-r> and pick "Make Sprite" Main() { "Here's a sprite\n"; Sprite(<1>);//<ctrl-r> and pick "Pointer to sprite". "\n\n\n\n\n\n\n\n\n\n"; } Main; } Code2{ //For games and most other software. <1>//<ctrl-r> and pick "Make Sprite" U0 DrawIt(CTask *,CDC *dc)//You can specify CTask *task if you want. { // dc=Device Context. I.e the screen. Sprite3ZB(dc,50,50,0,<1>,tS); // x y z rotation //View Sprite3 and Sprite3ZB to learn more about sprite flags //To learn more about GR files, see GrBlot. Use the Man() command. } Main() { Fs->draw_it=&DrawIt;//Only one window per task. Tasks can spawn other tasks to get more windows. Those other tasks can then use their own DrawIt. See JukeBox, for example. "Here's a sprite\n"; "\n\n\n\n\n\n\n\n\n\n"; } Main; } TempleOS is very good for beginners because of how easy it is to put a sprite on the screen. Getting input takes more code than putting a sprite on the screen! You can make your own sprites using code. Either by making a bitmap pixle by pixle, or by making a sprite by putting your own elements. Try typing dc->color=BLACK before the Sprite3 in DrawIt and see what happens.