Jump to content

[Solved] what's wrong ?


Sora

Recommended Posts

Posted (edited)

hi .. i've drew a text with guieditor and my screen resolution was 800x600x32

dxDrawText("Sora :",13.0,167.0,55.0,182.0,tocolor(255,0,0,255),1.0,"default-bold","left","top",false,false,false) 
dxDrawText(message,58.0,168.0,799.0,224.0,tocolor(255,255,255,255),1.0,"default-bold","left","top",false,false,false) 
  

( works fine )

and i found out that the text place changes on another screen resolutions

i wanted the script to be shown in the same place on all screen resolutions so i used this function

guiGetScreenSize() 

i've followed the tutorial step by step and the results was this

  
local sWidth,sHeight = guiGetScreenSize() 
dxDrawText("Sora :",13.0/800*sWidth,167.0/600*sHeight,55.0/800*sWidth,182.0/600*sHeight,tocolor(255,0,0,255),1.0,"default-bold","left","top",false,false,false) 
    dxDrawText(message,58.0/800*sWidth,168.0/600*sHeight,799.0/800*sWidth,224.0/600*sHeight,tocolor(255,255,255,255),1.0,"default-bold","left","top",false,false,false) 

( doesn't work )

but the text didn't show up on the screen

Edited by Guest
Posted
I had this problem too not long ago, and a friend told me to use offsets instead of pixels and that worked.

thanks for replay ^^

how do i get offsets , and how to set them on the same place up there ^

Posted (edited)
Instead of numbers like:

245, you do 0.245 * screenWidth.

do you mean like that? ^^

local sWidth,sHeight = guiGetScreenSize() 
dxDrawText("Sora :",0.13*sWidth,0.167*sHeight,0.55*sWidth,0.182*sHeight,tocolor(255,0,0,255),1.0,"default-bold","left","top",false,false,false) 
    dxDrawText(message,0.58*sWidth,0.168*sHeight,0.799*sWidth,0.224*sHeight,tocolor(255,255,255,255),1.0,"default-bold","left","top",false,false,false) 

Edited by Guest
Posted
        dxDrawText ( "Sora:", ( 0.025 * sWidth ), ( 0.279 * sHeight ), ( 0.55 * sWidth ), ( 0.182 * sHeight ), tocolor ( 255, 0, 0, 255 ), 1.0, "default-bold", "left", "top", false, false, false ) 
        dxDrawText ( message, ( 0.08 * sWidth ), ( 0.280 * sHeight ), ( 0.799 * sWidth ), ( 0.224 * sHeight ), tocolor ( 255, 255, 255, 255 ), 1.0, "default-bold", "left", "top", false, false, false ) 

Seems to be fine on 800x600x32 and 1024x768x32.

Posted
        dxDrawText ( "Sora:", ( 0.025 * sWidth ), ( 0.279 * sHeight ), ( 0.55 * sWidth ), ( 0.182 * sHeight ), tocolor ( 255, 0, 0, 255 ), 1.0, "default-bold", "left", "top", false, false, false ) 
        dxDrawText ( message, ( 0.08 * sWidth ), ( 0.280 * sHeight ), ( 0.799 * sWidth ), ( 0.224 * sHeight ), tocolor ( 255, 255, 255, 255 ), 1.0, "default-bold", "left", "top", false, false, false ) 

Seems to be fine on 800x600x32 and 1024x768x32.

worked

thanks a lot ^^

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...