Jump to content

Photo

[2.55] Support for shadows on all text drawing functions


  • Please log in to reply
No replies to this topic

#1 Orithan

Orithan

    Studying Scientist - Commission from Silvixen

  • Members
  • Location:Australia

Posted 21 March 2021 - 05:14 PM

I love the shadow drawing args for the text drawing functions because it means I don't have to do some janky stuff to get shadows on my text. However only "Screen/Bitmap->DrawString" supports it. None of the other text drawing functions have support for this, which means I need to do janky workarounds if I am to say use an integer for this.

//If the other text drawing functions supported shadows I'd only have to do this:
Screen->DrawInteger(7, 185, SUBSCREEN_TOP+37, FONT_Z1, Player->HP >= Player->MaxHP ? C_PINK+3 : C_WHITE, NULL, NULL, NULL, Player->HP, 0, OP_OPAQUE, SHD_OUTLINEDPLUS, C_BLACK);
Screen->DrawCharacter(7, 213, SUBSCREEN_TOP+37, FONT_Z1, C_WHITE, NULL, NULL, NULL, 46, OP_OPAQUE, SHD_OUTLINEDPLUS, C_BLACK);
Screen->DrawInteger(7, 216, SUBSCREEN_TOP+37, FONT_Z1, Player->Misc[PMISC_RECOVERHEALTH] >= Player->MaxHP ? C_PINK+3 : C_WHITE, NULL, NULL, NULL, Player->Misc[PMISC_RECOVERHEALTH], 0, OP_OPAQUE, SHD_OUTLINEDPLUS, C_BLACK);

//Instead I have to make this dumb workaround to the limitation of shadows only being built into DrawString.
char32 hpstr = "%i";
char32 notshulkskey = "/";
char32 buff[6];
Screen->DrawString(7, 209, SUBSCREEN_TOP+37, FONT_Z1, C_WHITE, C_NULL, TF_NORMAL, notshulkskey, OP_OPAQUE, SHD_OUTLINEDPLUS, C_BLACK);
sprintf(buff, hpstr, Player->HP);
Screen->DrawString(7, 208, SUBSCREEN_TOP+37, FONT_Z1, Player->HP >= Player->MaxHP ? C_PINK+3 : C_WHITE, C_NULL, TF_RIGHT, buff, OP_OPAQUE, SHD_OUTLINEDPLUS, C_BLACK);
sprintf(buff, hpstr, Player->Misc[PMISC_RECOVERHEALTH]);
Screen->DrawString(7, 217, SUBSCREEN_TOP+37, FONT_Z1, Player->Misc[PMISC_RECOVERHEALTH] >= Player->MaxHP ? C_PINK+3 : C_WHITE, C_NULL, TF_NORMAL, buff, OP_OPAQUE, SHD_OUTLINEDPLUS, C_BLACK);

Edited by Orithan, 21 March 2021 - 05:16 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users