Jump to content

Recommended Posts

Posted

Is there something like glutReshapeFunc for leadwerks? That is a call back that can be registed to be notified when the user resizes the window.

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Posted

If there isn't a built in function, maybe store the window size in a variable in start, then compare that variable with the current window size and when it's different, update the variable with the current size and call a separate function. If getting the current window size is expensive, you could limit a check to every n iterations of the the loop.

 

Possibly use System::AddHook?

 

I'm not new to programming, but I am new to Leadwerks, so this may be a terrible idea. :)

Posted

I tested this in App.lua, but it should work the same in the App.cpp. it does work.

 

Create a variable to store the window size

prevScreenSize = Vec2(0,0)

Get the initial window size in start

self.prevScreenSize = Vec2(Math:Round(self.window:GetWidth()), Math:Round(self.window:GetHeight()))

Check for change, update the variable when change is detected, and call a function

if self.prevScreenSize.x ~= Math:Round(self.window:GetWidth()) or self.prevScreenSize.y ~= Math:Round(self.window:GetHeight()) then
   self.prevScreenSize = Vec2(Math:Round(self.window:GetWidth()), Math:Round(self.window:GetHeight()))
   self:ScreenSizeChanged()
end

function App:ScreenSizeChanged()
   System:Print("ScreenSizeChanged: " .. self.prevScreenSize:ToString())
end

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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...