Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function int fx_px(int x, int scale)
- {
- return (FixedMul(x,scale<<16)>>16)<<16;
- }
- function int scalerange(int oldmin, int oldmax, int newmin, int newmax, int oldvalue)
- {
- int OldRange = (OldMax - OldMin);
- int NewRange = (NewMax - NewMin) ;
- int newvalue = fixeddiv(fixedmul((oldvalue -oldmin),newrange),oldrange)+newmin;
- return newvalue;
- }
- function int MagicRatioX (void)
- {
- int ratio_current = itof(getscreenwidth()) / getscreenheight();
- int ratio_43 = 0.75;
- int ret = fixedmul(ratio_current,ratio_43);
- ret -=1.0;
- ret = ret/2;
- return ret;
- }
- script "testprint"
- {
- int hudx= 640;
- int hudy = 480;
- int xpos = 0.15; //anything from 0.0 to 1.0
- int ypos = 0.10; //anything from 0.0 to 1.0
- sethudsize(hudx,hudy,0);
- while(true)
- {
- HudMessage(s:"A"; HUDMSG_PLAIN 4, CR_UNTRANSLATED, fx_px(scalerange(0.0,1.0,-magicratiox() ,1.0 + magicratiox(),xpos),hudx), fx_px(ypos,hudy), 1.0/35);
- delay(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement