how to solve border distortion

Posted By: Reconnoiter

how to solve border distortion - 05/13/15 10:47

Hi all,

How to prevent window distortion when moving a window with a resizeable border and buttons like close, maximize etc. ? The manual says that one can do first video_window followed by video_set to solve the problem, but that doesn't work for me and also makes everything ugly (very ugly edges around drawedlines etc.). I have tried a few things but haven't found a solution yet:

Click to reveal..
Code:
var reso_x = 1000;
var reso_y = 600;
video_window(NULL, NULL, 4+16+32+64+128, "my game");
video_set(reso_x, reso_y, 0, 0);



Code:
var reso_x = 1000;
var reso_y = 600;
video_window(NULL, NULL, 4+16+32+64+128, "my game");
reso_x -= SM_CXBORDER;
reso_y -= SM_CYBORDER;
video_set(reso_x, reso_y, 0, 0);




Code:
video_window(NULL, NULL, 4+16+32+64+128, "my game");
vec_set(screen_size,vector(1000,600,0));



etc.


Anyone know how to do this?
Posted By: sivan

Re: how to solve border distortion - 05/13/15 13:05

I played with this earlier, but don't remember exactly why I gave up... but now have a usable result:

you can use an event on resizing like:

on_resize = ScreenSize_Event;
on_maximize = ScreenSize_Event;

and in the event you can use:

Code:
void ScreenSize_Event() 			
{
	if (video_screen==(var)2)		// if windowed
		{
		   RECT r;
   		GetClientRect(hWnd,&r); 
   		video_set(r.right,r.bottom,0,0); 
   	}
}



the 3d level is adopting fine, but 2d panels can get clipped if set smaller, or leaving uncovered border if set larger, so panels positions should be managed by this event.
Posted By: Reconnoiter

Re: how to solve border distortion - 05/13/15 17:18

Hi Sivan,

Thanks for commenting. I get ugly jagged edges when doing that the first frame or after a wait(1). I had already that code for border resize event (when you drag the border with the left mouse button) where it does work without creating jagged edges / ugly visuals but still leaving a distortion moving the window. , but for initializing it doesn't seem to work. crazy

Besides the jagged edges, the picture beneath resembles a bit the distortion problem I have when moving the window through the screen, but with me the visual error disappear after releasing the left mouse button:



I have also got a problem where the close, maximize and minimize buttons are not visible till when you move the mouse cursor over that end of the border.
Posted By: sivan

Re: how to solve border distortion - 05/14/15 07:32

in is fine here with Win7
Posted By: Reconnoiter

Re: how to solve border distortion - 05/14/15 10:30

I too have windows 7 (32 bit). And now that I look at it again, models look fine. But drawn lines look really crappy. I think this is a bug with video_set+border_window:

Ugly lines here cause of using video_set:


Better looking lines, not using video_set but vec_set to change screen_size:
Posted By: Reconnoiter

Re: how to solve border distortion - 05/14/15 10:42

the differences are better visible when watching the pics at their original size (copy image url / location in the address bar). The above is not the best example, in some cases its better visible.

© 2023 lite-C Forums