Jump to content

dxDrawText or dxDrawRectangle all screen resolutions problem


longsnake34

Recommended Posts

@iPrestege

Would  problem in Resolution? (1360x, 800x600, 2960x, 640x)

local sx, sy = guiGetScreenSize( )

addEventHandler( "onClientRender", root,
	function( )
	     dxDrawText( "Resolution example", sx*( 684/1024 ), sy*( 731/768 ), sx*( 732/1024 ), sy( 766/768 ), tocolor(0,255,255,175), sx/1000*1.0,"bankgothic","left","top",false,false,false ) 
	end
)

 

Edited by longsnake34
Link to comment
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

 

Link to comment

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
Link to comment

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