We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi folks! I have created a simple button class which changes colour when the mouse is over it and when it clicks. i have implemented the
surface.setResizable(true); function and am having difficulty updating the buttons position when the window changes size.
i instantiate the class and give it the x and y positional coordinates. all goes well until i resize the window and the button doesn't react despite the coordinates being in reference to the width and height of the window.
So it seems that the coordinate data is given to the object upon instantiation but is not updated which makes it unable to update its coordinates according to the newly resized window.
I can get around this by adding a function in the class which references the specific coordinates of the object and updates within draw continuously but this of course makes the reusable nature of the class pointless because i am required to put the individual objects locations in it.
so my question is: How can i get objects to update their positional data after their instantiation.
I hope this makes sense and any help would be much appreciated. Thanks! Danny.