Posted By: preacherX
How to display text with different resolutions? - 04/16/17 08:27
What do you think would be the best way to use text in a way that it won't change its size or position when changing the resolution of the game?
#include <acknex.h> #include <default.c> #include <atypes.h> #include <d3d9.h> #include <litec.h> // Call this, if your font is not default Window Font like Arial... void AddFontType(STRING* name) { int res = AddFontResource(name); if(!res) printf("Font %s not found....", name); } // ...in Main function AddFontType("XerosTheorem.ttf"); // Declare your Fonts FONT* FontMenuMain = "Xero's Theorem#36"; FONT* FontMenuSub = "Xero's Theorem#28"; // Call this after switched Resolution // MnuSettings.Resolution is an integer in a struct (7,8,9...) // Override Fonts void CreateFont() { // Fonts für den Auflösungswechsel neu erstellen switch(MnuSettings.Resolution) { case 1: case 2: FontMenuMain = font_create("Xero's Theorem#29"); FontMenuSub = font_create("Xero's Theorem#23"); break; case 3: FontMenuMain = font_create("Xero's Theorem#36"); FontMenuSub = font_create("Xero's Theorem#28"); break; } } // Use it at runtime like this... pan_setdigits(MnuPMainScreen, mainDigNum[0], mainDigPosXY[0][0],mainDigPosXY[0][1],StrBtnMnuMission, FontMenuMain,1,0);