Jump to content

dxDrawText or dxDrawRectangle all screen resolutions problem


longsnake34

Recommended Posts

Posted (edited)

Hi dude how are you ?

My problem is screen resolution for example(1360x and 1690x or 2960x) and how to make all screen resolutions ?

 

Edited by longsnake34
Posted
local screenX, screenY = guiGetScreenSize()
local responsiveMultiplier = (screenX + 2048) / (2048 * 2)

local testRectangleWidth = 256 * responsiveMultiplier
local testRectangleHeight = 128 * responsiveMultiplier
local testFont = dxCreateFont("fontPath.ttf", 14 * responsiveMultiplier, false, "antialiased")

local marginOffset = 10
local rightSideOfTheScreen = (screenX - marginOffset) - testRectangleWidth
local centerTheBoxY = (screenY - testRectangleHeight) / 2

dxDrawRectangle(rightSideOfTheScreen, centerTheBoxY, testRectangleWidth, testRectangleHeight, tocolor(0, 0, 0, 150))

-- on dxDrawText scale is 1.0 or smaller when you have custom font, responsiveMultiplier only using it in dxCreateFont

 

Posted (edited)

how to move text to red zone ?

Image

local screenX, screenY = guiGetScreenSize()
local responsiveMultiplier = (screenX + 2048) / (2048 * 2)

local testRectangleWidth = 350 * responsiveMultiplier
local testRectangleHeight = 225 * responsiveMultiplier
local testFont = dxCreateFont("font.ttf", 14 * responsiveMultiplier, false, "antialiased")

local marginOffset = 10
local rightSideOfTheScreen = (screenX - marginOffset) - testRectangleWidth
local centerTheBoxY = (screenY - testRectangleHeight) / 2


function render()
dxDrawRectangle(rightSideOfTheScreen, centerTheBoxY, testRectangleWidth, testRectangleHeight, tocolor(0, 0, 0, 150))
for i = 1, 5 do 
 dxDrawText ( ""..i..". GridList DX",rightSideOfTheScreen, centerTheBoxY+50*i, testRectangleWidth, testRectangleHeight, tocolor ( 255, 255, 255, 255 ), 0.8,testFont,"center","center",true,true,true,true,false)  
end
end
addEventHandler("onClientRender", root, render)

 

Edited by longsnake34

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...