Jump to content

Problema con multiresolucion


-Rex-

Recommended Posts

Posted

Hola tengo un problema de multiresolucion.

Es que lo que pasa que en resoluciones menores a 1280 x 600 ( la mia ), sale la mitad del texto y el problema esta en esta funcion

local ancho = dxGetTextWidth( texto, 0.60, font2, true ) 

Yo quiero que salga de la misma forma que en la resolucion de 1280 x 600, Pero no es asi, hay les dejo una foto de como sale en las dos resoluciones.

Que deberia hacer?

http://imgur.com/a/XWOz3

Posted

Puedes hacer que el tamaño de la letra varie según la resolución o puedes usar el ancho del texto y hacer que se dibuje desde esa distancia al final de la pantalla.

Posted
Puedes hacer que el tamaño de la letra varie según la resolución o puedes usar el ancho del texto y hacer que se dibuje desde esa distancia al final de la pantalla.

¿Como podría hacerlo, Me das un ejemplo?

Posted (edited)

No esta completo, Solo puse el codigo que lo hace mover en eje de las X

    local sx, sy = 1280,600 
local x, y = guiGetScreenSize ( ) 
local font2 = dxCreateFont( "img/font2.ttf", ( 15 / sy ) * y ) 
function joinQuit() 
    for _, v in ipairs( textos ) do 
        local i = v[1] 
        local texto = v[2] 
        local ancho = dxGetTextWidth(  texto,  0.60, font2, true )  
        --outputDebugString( ancho ) 
        local cuenta = ( getTickCount(  ) - textos["tick2_"..tostring(i)] )  
        local endTime = textos["tick_"..tostring(i)] + 1000 
        local elapsedTime = getTickCount() - textos["tick_"..tostring(i)] 
        local duration = endTime - textos["tick_"..tostring(i)] 
        local progress = elapsedTime / duration 
        local xe, x2, ae = interpolateBetween ( 0, 0, 0, ancho+2, ancho+1, 255, progress, "OutQuad") 
        --outputDebugString( xe ) 
        local alp = 0 
        textos["rectangle_"..tostring(i)], textos["text_"..tostring(i)], alp =  xe , x2 , ae 
  
        if cuenta >= 2500 then 
            alp = 0 
            local newcount = math.floor( ( cuenta / 10  ) - 250 ) 
            if newcount <= 100 then 
                textos["texty_"..tostring(i)] = newcount 
            end 
            if newcount <= 100 then 
                textos["rectangley_"..tostring(i)] = newcount 
            end 
            local newcounts = math.floor( ( ( cuenta / 10 ) - 250 ) * 2.5 ) 
            if newcounts <= 250 then 
                textos["alpha_"..tostring(i)]  = newcounts 
            end 
            if newcounts >= 240 then 
                textos["alpha_"..tostring(i)] = 250 
                table.remove( textos, 1 ) 
            end      
        end 
          if 200 - textos["alpha_"..tostring(i)]  - 175 > 0 then 
               dxDrawRectangle(  ( ( 1270- ( textos["rectangle_"..tostring(i)] / sx ) * x ) / sx ) * x , ( ( 290 -textos["rectangley_"..tostring(i)]) / sy ) * y , ( 165+ancho / sx ) * x, ( 15 / sy ) * y, tocolor(0, 0, 0, 200 -( textos["alpha_"..tostring(i)]  - 175 ) ), false) 
          end 
          if 200 -textos["alpha_"..tostring(i)] > 0 then 
               dxDrawText(texto, ( ( 1275 - ( textos["text_"..tostring(i)] / sx ) * x) / sx ) * x  , ( ( 290-textos["texty_"..tostring(i)] ) / sy ) * y , ( 500 / sx ) * x, ( 315 / sy ) * y, tocolor(255, 255, 255, 200 -textos["alpha_"..tostring(i)] ), 0.60, font2, "left", "top", false, false, false, true, false) 
          end 
     end 
end 
addEventHandler("onClientRender", root, joinQuit ) 
  
function outputBarMessage( msj ) 
    if not textos then 
        textos = {} 
    end 
    if not id then 
        id = {} 
    end 
    textos["tick2_"..tostring(#id+1)] = getTickCount(  ) 
    textos["tick_"..tostring(#id+1)] = getTickCount(  ) 
    textos["rectangle_"..tostring(#id+1)] = 0 
    textos["text_"..tostring(#id+1)] = 0 
    textos["rectangley_"..tostring(#id+1)] = 0 
    textos["texty_"..tostring(#id+1)] = 0 
    textos["alpha_"..tostring(#id+1)] = 0 
    table.insert( textos, { #id+1, tostring( msj ) }) 
    table.insert( id, { #id+1 }) 
end 
           

EDIT2: Lo he puesto completo, no importa de igual voy a liberar este recurso.

Edited by Guest
Posted (edited)

Hay un par de tablas que no se que contienen, así que sería bastante complicado corregirlo.

Edited by Guest
Posted
Puedes hacer que el tamaño de la letra varie según la resolución o puedes usar el ancho del texto y hacer que se dibuje desde esa distancia al final de la pantalla.

¿Como podría hacerlo, Me das un ejemplo?

local _, y = guiGetScreenSize() 
local fy = (y / 600) 
local fontSize = fy*0.60 
local ancho = dxGetTextWidth( texto, fontSize, font2, true ) 

Posted
function joinQuit() 
    for _, v in ipairs( textos ) do 
        local i = v[1] 
        local texto = v[2] 
        local ancho = dxGetTextWidth(  texto,  0.60, font2, true ) 
        --outputDebugString( ancho ) 
        local cuenta = ( getTickCount(  ) - textos["tick2_"..tostring(i)] ) 
        local endTime = textos["tick_"..tostring(i)] + 1000 
        local elapsedTime = getTickCount() - textos["tick_"..tostring(i)] 
        local duration = endTime - textos["tick_"..tostring(i)] 
        local progress = elapsedTime / duration 
        local xe, x2, ae = interpolateBetween ( 0, 0, 0, ancho+2, ancho+1, 255, progress, "OutQuad") 
        --outputDebugString( xe ) 
        local alp = 0 
        textos["rectangle_"..tostring(i)], textos["text_"..tostring(i)], alp =  xe , x2 , ae 
  
        if cuenta >= 2500 then 
            alp = 0 
            local newcount = math.floor( ( cuenta / 10  ) - 250 ) 
            if newcount <= 100 then 
                textos["texty_"..tostring(i)] = newcount 
            end 
            if newcount <= 100 then 
                textos["rectangley_"..tostring(i)] = newcount 
            end 
            local newcounts = math.floor( ( ( cuenta / 10 ) - 250 ) * 2.5 ) 
            if newcounts <= 250 then 
                textos["alpha_"..tostring(i)]  = newcounts 
            end 
            if newcounts >= 240 then 
                textos["alpha_"..tostring(i)] = 250 
                table.remove( textos, 1 ) 
            end     
        end 
          if 200 - textos["alpha_"..tostring(i)]  - 175 > 0 then 
               dxDrawRectangle(  x - textos["rectangle_"..tostring(i)], ( ( 290 -textos["rectangley_"..tostring(i)]) / sy ) * y , ( 165+ancho / sx ) * x, ( 15 / sy ) * y, tocolor(0, 0, 0, 200 -( textos["alpha_"..tostring(i)]  - 175 ) ), false) 
          end 
          if 200 -textos["alpha_"..tostring(i)] > 0 then 
               dxDrawText(texto, x - textos["text_"..tostring(i)]  , ( ( 290-textos["texty_"..tostring(i)] ) / sy ) * y , ( 500 / sx ) * x, ( 315 / sy ) * y, tocolor(255, 255, 255, 200 -textos["alpha_"..tostring(i)] ), 0.60, font2, "left", "top", false, false, false, true, false) 
          end 
     end 
end 
addEventHandler("onClientRender", root, joinQuit ) 
  
function outputBarMessage( msj ) 
    if not textos then 
        textos = {} 
    end 
    if not id then 
        id = {} 
    end 
    textos["tick2_"..tostring(#id+1)] = getTickCount(  ) 
    textos["tick_"..tostring(#id+1)] = getTickCount(  ) 
    textos["rectangle_"..tostring(#id+1)] = 0 
    textos["text_"..tostring(#id+1)] = 0 
    textos["rectangley_"..tostring(#id+1)] = 0 
    textos["texty_"..tostring(#id+1)] = 0 
    textos["alpha_"..tostring(#id+1)] = 0 
    table.insert( textos, { #id+1, tostring( msj ) }) 
    table.insert( id, { #id+1 }) 
end 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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