////////////////////////////////////////////////////////////////////// // // // Routines to realize the use of sprite fonts // // by Quiest // // // // // // Usage: // // ------ // // Make your own fonts and store them in a seperate FPG. // // Look below for a list of what number every symbol,letter, // // etc., should have in the font FPG. // // // // Then just copy&paste the processes qwrite, qwrite_int, // // qwrite_float, qwrite_graph to your code and use like this: // // // // qwrite(font,int x, int y, int qdist, string qvar); // // -font == the ID for the font fpg // // -int x == x coord of the first letter // // -int y == y coord of the first letter // // -int qdist == distance between the sprites // // -string qvar == the string you want to be displayed on screen // // // // qwrite_int(font,int x, int y, int qdist, int qvar); // // -font == the ID for the font fpg // // -int x == x coord of the first letter // // -int y == y coord of the first letter // // -int qdist == distance between the sprites // // -int qvar == the integer you want to be displayed on screen // // // // qwrite_float(font,int x, int y, int qdist, float qvar); // // -font == the ID for the font fpg // // -int x == x coord of the first letter // // -int y == y coord of the first letter // // -int qdist == distance between the sprites // // -float qvar == the float you want to be displayed on screen // // // // Notes: // // ------ // // *The routines need to be called in a loop to stay on screen. // // *I used racemaniacs standart fpg, which is included in the // // zip file, for the included fonts. // // Note that the font fpgs need to have the same palette as // // the fpgs used for your game. // // *What is still missing is the ability for the routines to // // get the proper distance between the sprites by themselves // // and to align them to the center or the right of the x value // // you give to the processes. // // *Do whatever you want with this prg. // // If you can optimize it or add more functions to it, do so! // // But please let me know! :-) // // // ////////////////////////////////////////////////////////////////////// program qwrite_test; global font1; font2; //IDs used for the fonts string var1="1234567890"; string var2="ABCDEFGHIJKLM"; string var3="NOPQRSTUVWXYZ"; string var4="!?#$%&'()*,-./:;<=>"; //just some example strings int var8=99; float var9=0.99; //examples to demonstrate integer and float begin set_mode(320,240,8); //screen init set_fps(30,0); //fps init font1=load_fpg("font1.fpg"); //loading FPG font font2=load_fpg("font2.fpg"); //loading FPG font loop //examples start qwrite(font2,20,10,8, "Quiests 'qwrite' routines"); qwrite(font2,20,20,8, "to realize sprite fonts."); qwrite(font1,20,50,17, var1); qwrite(font2,20,65,8, var1); qwrite(font1,20,85,17, var2); qwrite(font1,20,105,17, var3); qwrite(font2,20,120,8, var2); qwrite(font2,20,130,8, var3); qwrite(font2,20,160,8, var4); qwrite(font2,17,200,8, "Integer:"); qwrite(font2,20,220,8, "Float:"); qwrite_int(font1,150,200,17, var8); qwrite_float(font1,150,220,17, var9); //examples end var8++; if(var8>150)var8=-150;end; var9+=0.01; if(var9>1.50)var9=-1.50;end; //alternat the integer and float values frame; end; end; process qwrite(qfont,x,y,int qdist,string qvar); private int qcounter=0; string qdisplay; begin while(qcounter - 62 ^ - 94 ~ - 126 // // ? - 63 _ - 95 // // // ///////////////////////////////////////////////