Page 1 of 1

How to create a window?

Posted: 27 Aug 2010, 23:49
by Karotte
How can i create a "window"? if would be alsow ok if its only a gray square.

Re: How to create a window?

Posted: 28 Aug 2010, 02:29
by Niobium

Code: Select all

function widget:DrawScreen()
	gl.Color(0.5, 0.5, 0.5, 1)
	gl.Rect(left, bottom, right, top)
end
Code above will get you a simple gray window, just replace left/bottom/right/top with wherever you want the window to be

Re: How to create a window?

Posted: 28 Aug 2010, 05:25
by zwzsg
It's not like a desktop app, you don't need windows. You can write and Draw anywhere in the Screen, anywhere in the World, anywhere InMiniMap.

Re: How to create a window?

Posted: 28 Aug 2010, 06:21
by knorke
windows.
in spring they are just grey squares.
---
if you want a window that can be moved around and maybe even resized you could use one of the many UI frameworks like RedUI, chilli, LolUI, IceUI and whatever their names are.

Re: How to create a window?

Posted: 28 Aug 2010, 23:32
by Karotte
Thx, but is that right now?


Or have i to write anything for end? or to start?

function widget:GetInfo()
return {
name = "Blupp",
desc = "BluppBlupp",
author = "Karotte",
date = "2010",
license = "WTFOMG",
layer = 0,
enabled = true
}

function widget:DrawScreen()
gl.Color(0.5, 0.5, 0.5, 1)
gl.Rect(left, bottom, right, top)

end

Re: How to create a window?

Posted: 29 Aug 2010, 00:42
by SirMaverick
Karotte wrote: gl.Rect(left, bottom, right, top)
Of course you need to define these values.

Re: How to create a window?

Posted: 30 Aug 2010, 13:33
by Karotte
ok, and how can i aktivate my widget ingame? when im pressing F11 it doesn't appear. i have the plugin in Spring/LuaUI/wigets/ xxx.lua

Do i have to modify a file?

Re: How to create a window?

Posted: 30 Aug 2010, 13:42
by zwzsg
Read infolog.txt, especially the parts where widgets are loaded and initialised. Maybe you'll see an error message there.


You forgot an end:
function widget:GetInfo()
return {
name = "Blupp",
desc = "BluppBlupp",
author = "Karotte",
date = "2010",
license = "WTFOMG",
layer = 0,
enabled = true,
}
end

function widget:DrawScreen()
gl.Color(0.5, 0.5, 0.5, 0.5)
gl.Rect(100,100,500,500)
end
Karotte wrote:wigets
Hum!

Re: How to create a window?

Posted: 30 Aug 2010, 13:49
by Beherith
I find it tons easier to start from a widget that is close to what I want to make.

Re: How to create a window?

Posted: 30 Aug 2010, 17:24
by Karotte
No widget is similiar what i want so make. but thx