Guppy Posted August 30, 2014 Posted August 30, 2014 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. Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k
CrazyM Posted August 30, 2014 Posted August 30, 2014 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. Quote CrazyMinnowStudio.com Youtube, Twitter, Facebook, G+
CrazyM Posted August 30, 2014 Posted August 30, 2014 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 Quote CrazyMinnowStudio.com Youtube, Twitter, Facebook, G+
Recommended Posts
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.