c++ - SDL - Window data -
I was browsing the SDL documentation and found me the WindowData (and). What is the use of these works? It stores the
zero
pointer attached to the name, is it only to store my items, which I can use later? Or what is the significance of its SDL
?
These actions should let you know arbitrary data with an indicator object (like a memory of your choice Buffer or an object):
MyObject * object_ptr = new MyObject (); // Your custom object object_ptr-> Data = 42; // Your custom data SDL_SetWindowData (window, "mycustomdata", object_ptr); // elsewhere in your code where you have access to 'window' MyObject * object_ptr = SDL_GetWindowData (window, "mycustomdata");
This behavior mimics SetWindowLong (hwnd, GWL_USERDATA, indicator);
Call the Win32 API.
Comments
Post a Comment