When we create device in window mode, and do device.SetWindowResize(true), we get resize-able window. But how to catch the event when the window actually resized, so we can react properly if needed?
The only way i currently found is:
Code: Select all
// somewhere in device' event handling routine:
if (evnt.Type == EventType.Log)
{
// we check for log message like "Resizing window (640 480)"
string b = "Resizing window (";
string s = evnt.Log.Text;
if (s.StartsWith(b))
{
s = s.Substring(b.Length, s.Length - b.Length - 1);
string[] v = s.Split(' ');
int w = int.Parse(v[0]);
int h = int.Parse(v[1]);
// HERE WE KNOW THAT WINDOW HAS BEEN RESIZED TO w x h
}
}
I don't know which method is better, they both looks to me quite ugly
Please, let me know is there any other way to catch the moment when user has changed window size.