jkub Posted April 24, 2009 Share Posted April 24, 2009 (edited) I have a picture I have put together for a bomb shop script I am working on and I have a basic gui for it Buit I can not figure out how to get the picture im using into the gui??? I am using the Gui Classes for pretty much the whole gui I got everything set up in the meta already First I tried the way it was in gui classes like StaticImage:Create( int/float x, int/float y, int/float width, int/float height, string filename, [ bool relative = false, guielement parent = guiroot ] ) then I tried the original way from the wiki elementname = guiCreateStaticImage ( x, y, width, height, filename, relative, parent ) etc... Here is the main part of the gui function createGarageGui ( ) garageWindow = Window:Create ( .02, .3, .3, .6, "Car Bombs", true ) garageWindow:Visible ( false ) garageWindow:Movable ( false ) garageWindow:Sizable ( false ) showCursor ( false ) image = guiCreateStaticImage ( 0.5, 0.5, 0.5, 0.5, "bomb.png", true, garageWindow ) btnClsGarageGui = garageWindow:AddButton ( .35, .9, .3, .05, "Close", true ) btnEngineBomb = garageWindow:AddButton ( .25, .1, .5, .05, "Engine Bomb", true ) btnRemoteBomb = garageWindow:AddButton ( .25, .2, .5, .05, "Remote Bomb", true ) btnTimeBomb = garageWindow:AddButton ( .25, .3, .5, .05, "Time Bomb", true ) btnDudBomb = garageWindow:AddButton ( .25, .4, .5, .05, "Dud Bomb", true ) end addEventHandler ( "clientRequestsOpenGarageGui", getRootElement(), function ( ) garageWindow:Visible ( true ) showCursor ( true ) guiBringToFront ( garageWindow, true ) btnClsGarageGui:AddOnClick ( closeGarageGui ) btnEngineBomb:AddOnClick ( requestEngineBomb ) btnRemoteBomb:AddOnClick ( requestRemoteBomb ) btnTimeBomb:AddOnClick ( requestTimeBomb ) btnDudBomb:AddOnClick ( requestDudBomb ) end ) Edited April 25, 2009 by Guest Link to comment
jkub Posted April 25, 2009 Author Share Posted April 25, 2009 should I make it relative to the original window or what?... Link to comment
Gamesnert Posted April 25, 2009 Share Posted April 25, 2009 Is "bomb.png" added to the meta.xml? If not, any errors or anything? Link to comment
jkub Posted April 25, 2009 Author Share Posted April 25, 2009 ya its in the meta correctly and no errors Link to comment
50p Posted April 26, 2009 Share Posted April 26, 2009 When you're using that GUI Classes and you have a window object (created with Window:Create) then to get actual GUI element to be used with native GUI functions, just use .gui variable of that window object (you can read more about it in "Useful information" section), like so: garageWindow = Window:Create ( .02, .3, .3, .6, "Car Bombs", true ) img = guiCreateStaticImage(.5, .5, .5, .5, "bomb.png", true, garageWindow.gui) -- note the .gui But, you can use the GUI Classes for this as well (sorry for not documented all functions/methods but I don't really have time, even for MTA). To make an image within a window with the GUI Classes you can do this: garageWindow = Window:Create ( .02, .3, .3, .6, "Car Bombs", true ) garageWindow:AddStaticImage( .5, .5, .5, .5, "bomb.png", true ) And again, sorry for unfinished documentation. You can take a look into wndtab_class.lua to find out all methods that you can use with Window and Tab objects (by saying objects I mean GUI element created with classes, in this case garageWindow). Hope that will help. Link to comment
jkub Posted April 27, 2009 Author Share Posted April 27, 2009 Thanks:) the first method seemed to work. I had to move around some of my gui elements such as the buttons to get the pic to fit in their. I put it at the top and the text on the picture is kind of hard to read so im gonna make another picture for it with the text larger. How do I make the font size bigger on text labels Im trying to get some way for instructions when a player buys a time bomb or a dud bomb. Either a pic with the instrutions or somthin Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now