Jump to content
  • entries
    940
  • comments
    5,894
  • views
    863,971

Even more GUI design + Rooster teeth


Josh

1,329 views

 Share

This code added to main.lua actually works:

--Create a window
local windowstyle = window.Titlebar
if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+window.FullScreen end
window=Window:Create(title,0,0,System:GetProperty("screenwidth","1024"),System:GetProperty("screenheight","768"),windowstyle)
window:HideMouse()

--Create the graphics context
context=Context:Create(window,0)
if context==nil then return end

--Create a GUI
local gui = GUI:Create(context)
local widget = Widget:Create(20,20,75,30,gui:GetBase())
widget:SetScript("Scripts/GUI/Button.lua")

 

And then "Button.lua" is super simple:

function Script:Draw()

self.widget.gui:SetColor(64,64,64)

self.widget.gui:DrawRect(self.widget.position.x,self.widget.position.y,self.widget.size.width,self.widget.size.height)

end

 

I'll probably be around RTX this weekend, just because I watched RvB back in the day, and it's only a few blocks away at the Austin convention center. Here's what started it all:

 

  • Upvote 1
 Share

1 Comment


Recommended Comments

I've got this all working now. It's pretty sweet because anyone can add a new GUI widget script:

function Script:Draw()
   self.widget.gui:SetColor(64,64,64)
   self.widget.gui:DrawRect(self.widget.position.x,self.widget.position.y,self.widget.size.width,self.widget.size.height)
end

function Script:MouseEnter(x,y)
   System:Print("MouseEnter")
end

function Script:MouseLeave(x,y)
   System:Print("MouseLeave")
end

function Script:MouseMove(x,y)
   System:Print("MouseMove")    
end

function Script:MouseDown(button,x,y)
   System:Print("MouseDown")    
end

function Script:MouseUp(button,x,y)
   System:Print("MouseUp")    
end

function Script:KeyDown(button,x,y)
   System:Print("KeyDown")
end

function Script:KeyUp(button,x,y)
   System:Print("KeyUp")    
end

  • Upvote 2
Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...