Hi,
I'm having a slight problem with "guiCreateWindow", it just doesn't appear at all.
Here's my client.lua:
x, y = guiGetScreenSize ()
function createGUI ()
local guiWidth, guiHeight = 500, 300
local centerX, centerY = (x / 2) - (guiWidth / 2), (y / 2) - (guiHeight / 2)
myWindow = guiCreateWindow(centerX, centerY, 500, 300, "Information", true)
guiSetVisible(myWindow, true)
end
addEventHandler( "onClientResourceStart", getRootElement( ), createGUI)
and here's my meta.xml
<meta>
<script src="server.lua" type="server" />
<script src="client.lua" type="client" />
</meta>
I can't see a single reason for it not to work, checked in debug and no errors there.
I think I'm not fully understanding how the different types of positioning work. Earlier on I used the "centerX, centerY" variables on a "dxDrawImage" element, to position it in the exact center of the screen, and it worked fine.
The Wiki explains about the position arguments of the "dxDrawImage" function:
posX: the absolute X coordinate of the top left corner of the image
posY: the absolute Y coordinate of the top left corner of the image
However the explanation for the arguments of positioning on the "guiCreateWindow" function are slightly different:
x: A float of the 2D x position of the GUI window on a player's screen. This is affected by the relative argument.
y: A float of the 2D y position of the GUI window on a player's screen. This is affected by the relative argument.
Maybe that's where I'm going wrong.
Thanks for reading, hope I've provided enough info.