"fullscreen-look-like" window mode

Posted By: BySharDe2

"fullscreen-look-like" window mode - 01/22/13 15:29

Hey

In the manual of "video_set", there is a saying goes as "Thus setting a 1024x768 window on a 1024x768 desktop will always fail unless you remove border and title bar. "
But how to implement like this "unless"?

I tried a lot but failed, anyone help me?
I need to create a 1366*768 window on a 1366*768 desktop.
here is a fake implementation.
Code:
void main()
{
	level_load("");
	
	video_set(1366,760,0,2);
	//video_set(1366,768,0,2);
	//video_window(vector(0,0,0),nullvector,1,NULL);
	//video_window(vector(0.1,0.1,0),vector(1366,768,0),1,NULL);
	video_window(vector(0.1,0.1,0),nullvector,1,NULL);
	
	vec_set(sky_color.blue,nullvector);
}

Posted By: Kartoffel

Re: "fullscreen-look-like" window mode - 01/22/13 15:37

this works for me.
You'll have 1 line of pixels overlapping on every side but I think thats okay
Code:
video_window(vector(-1, -1, 0), vector(sys_metrics(0) + 2, sys_metrics(1) + 2, 0), 1, NULL);
video_set(sys_metrics(0) + 2, sys_metrics(1) + 2, 0, 2);

Posted By: BySharDe2

Re: "fullscreen-look-like" window mode - 01/22/13 15:43

during the test, my result is like this,

video_set(1366,760,0,2); // almost OK
video_set(1368,760,0,2); // almost OK
video_set(1366,761,0,2); // failed --> 800x600

// looks like fullscreen but F11 tells it is 800 x 600.
// Is this "remove border and title bar"?
video_window(vector(0.1,0.1,0),vector(1366,768,0),1,NULL);
Posted By: Kartoffel

Re: "fullscreen-look-like" window mode - 01/22/13 15:52

did you try what I suggested?
Posted By: BySharDe2

Re: "fullscreen-look-like" window mode - 01/22/13 15:52

Wow thanks for your fast reply.
Based on your code, It will work like this
The order of the two functions seems to be a problem.
Perfect without "a line border".
Code:
void main()
{
	level_load("");
	video_window(vector(0.1, 0.1, 0), vector(1366, 768,0), 1, NULL);
	video_set(1366, 768, 0, 2);
}

Posted By: Kartoffel

Re: "fullscreen-look-like" window mode - 01/22/13 17:08

video window just changes the window size, but not the rendered resolution wink
that's why you have to use something like video_set afterwards
Posted By: MasterQ32

Re: "fullscreen-look-like" window mode - 01/22/13 17:23

some small snippet which applies this for all video resolutions:

Code:
#include <acknex.h>
#include <windows.h>

typedef void *HMONITOR;

typedef struct tagMONITORINFO
{
	DWORD cbSize;
	RECT  rcMonitor;
	RECT  rcWork;
	DWORD dwFlags;
} MONITORINFO;

long WINAPI MonitorFromWindow(long hwnd,long dwFlags);
#define PRAGMA_API MonitorFromWindow;user32!MonitorFromWindow

#define MONITOR_DEFAULTTONULL       0x00000000
#define MONITOR_DEFAULTTOPRIMARY    0x00000001
#define MONITOR_DEFAULTTONEAREST    0x00000002

function main()
{
	wait(1); // Wait because we need a window handle!
	video_window(NULL, NULL, 1, NULL);
	MONITORINFO info;
	memset(&info, 0, sizeof(MONITORINFO));
	info.cbSize = sizeof(MONITORINFO);
	HMONITOR primary = MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY);
	GetMonitorInfo(primary, &info);
	video_set(info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top, 32, 2);
	SetWindowPos(hWnd, HWND_TOP, info.rcWork.left, info.rcWork.top, info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top, SWP_SHOWWINDOW);
}

Posted By: Kartoffel

Re: "fullscreen-look-like" window mode - 01/22/13 17:28

you don't need windows.h in this case
there's already sys_metrics(); wink
0 and 1 return the x and y size

besides that using sys metrics is much easier for a beginner
Posted By: MasterQ32

Re: "fullscreen-look-like" window mode - 01/22/13 17:35

it's not complete fullscreen but more like fullscreen without the taskbar
Posted By: Kartoffel

Re: "fullscreen-look-like" window mode - 01/22/13 17:39

Nothing against your solution, it's nice and gives a lot of other possibilities but if he just wants windowed fullscreen this is better, especially for a beginner:
Code:
#include <acknex.h>

function main()
{
	wait(1);
	video_window(vector(0.1, 0.1, 0), vector(sys_metrics(0), sys_metrics(1), 0), 1, NULL);
	video_set(sys_metrics(0), sys_metrics(1), 0, 2);
}


(this one is better than my first suggestion, with this there are no overlapping pixels)
© 2024 lite-C Forums