User Tools

Site Tools


notes:discrete:fall2023:projects:yol0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:discrete:fall2023:projects:yol0 [2023/10/17 23:35] – [Creating a custom font] walleynotes:discrete:fall2023:projects:yol0 [2023/10/18 02:50] (current) – [yol0] mfee1
Line 32: Line 32:
     define_region_matrix( FirstRegionTextFont,  0,0,  21,31,  0,31,  16,8,  0 );     define_region_matrix( FirstRegionTextFont,  0,0,  21,31,  0,31,  16,8,  0 );
 </code> </code>
 +
 +After calling select_texture() , all texture functions will apply to that texture from that moment.  If you’re using multiple textures, you may need to call select_texture again depending on the order of things in your program to make sure the correct texture is being referenced.
  
 ===scaling numbers=== ===scaling numbers===
Line 62: Line 64:
  
 Lastly, we run a while loop until ''check'' is zero. ''print'' gets assigned to the number divided by the check. Then, the number gets assigned to the remainder of that division. ''print'' is used to get the texture region ID for the number digit in our custom font, and that character gets printed at the given location. Lastly the positional data is updated so that the digits aren't all in the same position. Lastly, we run a while loop until ''check'' is zero. ''print'' gets assigned to the number divided by the check. Then, the number gets assigned to the remainder of that division. ''print'' is used to get the texture region ID for the number digit in our custom font, and that character gets printed at the given location. Lastly the positional data is updated so that the digits aren't all in the same position.
 +
 +====Drawing strings using a custom font====
 +Vircon32 stores string values as an array of integers containing the ASCII value for the given character. Since our font sheet uses a different ID system to the ASCII standard, they'll need to be converted. This involves a new function to return an int with the proper value. (it involves too many if statements)
 +
 +The main while loop for printing out strings is roughly the same as our function for printing integers. Once the proper texture region ID is selected, it prints out and the positional data is adjusted.
  
notes/discrete/fall2023/projects/yol0.1697585732.txt.gz · Last modified: 2023/10/17 23:35 by walley