LynxJam2023 - day 9


I spent the last days working on the game engine.

While trying to optimize the text part, I browsed CC65 TGI driver to look how it handles text.
I talk about tgi_outtextxy( ) mainly.

What it does :

  • store x,y on 2 zero page vars for faster access
  • call outtext native method
  • compute size based on number of characters
  • create a bitmap of this size
  • copy each char bitmap from the tgi font to this large bitmap
  • create a sprite with this large bitmap as sprite data
  • compute size (again !) based on number of characters 
  • add it to store x,y

So

Pros : 

  1. you can use tgi_outtext right after, the text will be at the right position
  2. you can also use tgi_gotoxy any time

Cons:

  1. The size is computed twice so we lost ticks
  2. The bitmap isn't cache (and you can't get it either to cache it yourself), so it's done EVERY frame
  3. You can't change the font
  4. You could make you're own outtext with own font...but you can't remove the native one so more bytes lost 

Get Hero Dust

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.