Jump to content

Help with GUI IMAGE Background


Evaldas101

Recommended Posts

Hi all, I'm new at MTA, P.S I'm did't know good english language, sorry for this, My question was this: How to do that photo was for these figures? ( Forest, Industry..); I'm want to make a picture like this:

guiCreateStaticImage( 0, 0, 1920, 1200, "login_bg.jpeg", false ) 

It's my code:

-- SELECTION DRAW -- 
        -- IMAGES -- 
--EXAMPLE -- 
-- bool dxDrawImage ( float posX, float posY, float width, float height, mixed image [, float rotation = 0, float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0, int color = tocolor(255,255,255), bool postGUI = false ] ) -- 
        local sx, sy = guiGetScreenSize() 
        dxDrawImage(sx/2-(275/599*sx), sy/2-(200/576*sy), 309/1600*sx, 174/900*sy, "data/img/selection_forest.jpg", 0, 0, 0, tocolor(255, 255, 255, alpha_selection["forest"])) 
        dxDrawImage(sx/2-(275/599*sx), sy/2-(80/900*sy), 309/1600*sx, 174/900*sy, "data/img/selection_industry.jpg", 0, 0, 0, tocolor(255, 255, 255, alpha_selection["industry"])) 
        --dxDrawImage(sx/2-(275/1600*sx), sy/2-(-40/900*sy), 501/1600*sx, 103/900*sy, "data/img/selection_forest.jpg", 0, 0, 0, tocolor(255, 255, 255, alpha_selection["forestas"]))-- 
        dxDrawImage(sx/2-(275/599*sx), sy/2-(-170/900*sy), 309/1600*sx, 174/900*sy, "data/img/selection_forest.jpg", 0, 0, 0, tocolor(255, 255, 255, alpha_selection["forestass"])) 
         
        -- TEXT -- 
        local scale = 0.5/1600*sx 
        dxDrawText("CHOOSE A MAP", sx/2-(200/1600*sx), sy/2-(300/900*sy), sx/2, sy/2, tocolor(255, 255, 255), scale, slender_font) 
        scale = 0.3/1600*sx 
        dxDrawText("FOREST", sx/2-(270/1600*sx), sy/2-(125/900*sy), sx/2, sy/2, tocolor(255, 255, 255, alpha_selection["forest"]), scale, slender_font) 
        dxDrawText("INDUSTRY", sx/2-(270/1600*sx), sy/2-(5/900*sy), sx/2, sy/2, tocolor(255, 255, 255, alpha_selection["forest"]), scale, slender_font) 
        dxDrawText("FOREST", sx/2-(270/1600*sx), sy/2-(-115/900*sy), sx/2, sy/2, tocolor(255, 255, 255, alpha_selection["forest"]), scale, slender_font) 
    end 
end 

me goes like this:

f941766a2420d51682d98136db6224ee171.png

But I'want to make like this:

57f9d96634303a5dbafbe6194ef7e59d284.jpg

And again sorry for my bad english. :(

Link to comment
  • Moderators
As far as i know the max - resolution in MTA is 1920x1080 so i think it's the same.

So if a player comes with a resoultion of 800 x 600, what will happen ?

Yeah, it will draw the image at 1920 x 1080. To make the image filling the screen perfectly, use the WhoAmI's code.

@Evaldas101: can you upload your login_bg.jpeg on an image hoster like imgur.com ? To know what we are trying to deal with.

Link to comment
http://imgur.com/oBFSSEg , You do not understand me. I want to be the background for the pictures, RUS : Вы меня не понимаете. Я хочу чтоб ето был фон за теми фотографиами.. POLISH: Wy mnie nie rozumiecie, chcę by ten background (fon) byl za tymi zdjęciami, (listitem te zdęcia) (Forest, Industry, gdzie MAP wybierac)
Link to comment
  • Moderators

Or just set the postGUI argument to true ...

-- SELECTION DRAW -- 
        -- IMAGES -- 
--EXAMPLE -- 
-- bool dxDrawImage ( float posX, float posY, float width, float height, mixed image [, float rotation = 0, float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0, int color = tocolor(255,255,255), bool postGUI = false ] ) -- 
        local sx, sy = guiGetScreenSize() 
        dxDrawImage(sx/2-(275/599*sx), sy/2-(200/576*sy), 309/1600*sx, 174/900*sy, "data/img/selection_forest.jpg", 0, 0, 0, tocolor(255, 255, 255, alpha_selection["forest"]), true) 
        dxDrawImage(sx/2-(275/599*sx), sy/2-(80/900*sy), 309/1600*sx, 174/900*sy, "data/img/selection_industry.jpg", 0, 0, 0, tocolor(255, 255, 255, alpha_selection["industry"]), true) 
        --dxDrawImage(sx/2-(275/1600*sx), sy/2-(-40/900*sy), 501/1600*sx, 103/900*sy, "data/img/selection_forest.jpg", 0, 0, 0, tocolor(255, 255, 255, alpha_selection["forestas"]), true)-- 
        dxDrawImage(sx/2-(275/599*sx), sy/2-(-170/900*sy), 309/1600*sx, 174/900*sy, "data/img/selection_forest.jpg", 0, 0, 0, tocolor(255, 255, 255, alpha_selection["forestass"]), true) 
        
        -- TEXT -- 
        local scale = 0.5/1600*sx 
        dxDrawText("CHOOSE A MAP", sx/2-(200/1600*sx), sy/2-(300/900*sy), sx/2, sy/2, tocolor(255, 255, 255), scale, slender_font, "left", "top", false, false, true) 
        scale = 0.3/1600*sx 
        dxDrawText("FOREST", sx/2-(270/1600*sx), sy/2-(125/900*sy), sx/2, sy/2, tocolor(255, 255, 255, alpha_selection["forest"]), scale, slender_font, "left", "top", false, false, true) 
        dxDrawText("INDUSTRY", sx/2-(270/1600*sx), sy/2-(5/900*sy), sx/2, sy/2, tocolor(255, 255, 255, alpha_selection["forest"]), scale, slender_font, "left", "top", false, false, true) 
        dxDrawText("FOREST", sx/2-(270/1600*sx), sy/2-(-115/900*sy), sx/2, sy/2, tocolor(255, 255, 255, alpha_selection["forest"]), scale, slender_font, "left", "top", false, false, true) 
    end 
end 

Link to comment

Why would you use dxDrawImage if you could use GUI? Its much handier, you don't need onClientRender or any events like that and you could easily use onClientGUIClick to spawn the player at the right place according to the image. But, you can choose the hard way.

Link to comment
  • Moderators
Why would you use dxDrawImage if you could use GUI? Its much handier, you don't need onClientRender or any events like that and you could easily use onClientGUIClick to spawn the player at the right place according to the image. But, you can choose the hard way.

It wasn't my choice, that was how this script was initially made. Didn't want him to think he couldn't do that with dx functions.

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