How to create a window?

How to create a window?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Karotte
Posts: 72
Joined: 03 Aug 2009, 17:30

How to create a window?

Post by Karotte »

How can i create a "window"? if would be alsow ok if its only a gray square.
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: How to create a window?

Post 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
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: How to create a window?

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: How to create a window?

Post 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.
User avatar
Karotte
Posts: 72
Joined: 03 Aug 2009, 17:30

Re: How to create a window?

Post 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
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: How to create a window?

Post by SirMaverick »

Karotte wrote: gl.Rect(left, bottom, right, top)
Of course you need to define these values.
User avatar
Karotte
Posts: 72
Joined: 03 Aug 2009, 17:30

Re: How to create a window?

Post 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?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: How to create a window?

Post 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!
Last edited by zwzsg on 30 Aug 2010, 13:55, edited 1 time in total.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: How to create a window?

Post by Beherith »

I find it tons easier to start from a widget that is close to what I want to make.
User avatar
Karotte
Posts: 72
Joined: 03 Aug 2009, 17:30

Re: How to create a window?

Post by Karotte »

No widget is similiar what i want so make. but thx
Post Reply

Return to “Lua Scripts”