1 registered members (M_D),
1,501
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
"fullscreen-look-like" window mode
#415694
01/22/13 15:29
01/22/13 15:29
|
Joined: Jan 2013
Posts: 17
BySharDe2
OP
Newbie
|
OP
Newbie
Joined: Jan 2013
Posts: 17
|
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.
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);
}
|
|
|
Re: "fullscreen-look-like" window mode
[Re: BySharDe2]
#415695
01/22/13 15:37
01/22/13 15:37
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
this works for me. You'll have 1 line of pixels overlapping on every side but I think thats okay
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);
POTATO-MAN saves the day! - Random
|
|
|
Re: "fullscreen-look-like" window mode
[Re: BySharDe2]
#415696
01/22/13 15:43
01/22/13 15:43
|
Joined: Jan 2013
Posts: 17
BySharDe2
OP
Newbie
|
OP
Newbie
Joined: Jan 2013
Posts: 17
|
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);
|
|
|
Re: "fullscreen-look-like" window mode
[Re: Kartoffel]
#415701
01/22/13 15:52
01/22/13 15:52
|
Joined: Jan 2013
Posts: 17
BySharDe2
OP
Newbie
|
OP
Newbie
Joined: Jan 2013
Posts: 17
|
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".
void main()
{
level_load("");
video_window(vector(0.1, 0.1, 0), vector(1366, 768,0), 1, NULL);
video_set(1366, 768, 0, 2);
}
|
|
|
Re: "fullscreen-look-like" window mode
[Re: BySharDe2]
#415710
01/22/13 17:08
01/22/13 17:08
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
video window just changes the window size, but not the rendered resolution that's why you have to use something like video_set afterwards
POTATO-MAN saves the day! - Random
|
|
|
Re: "fullscreen-look-like" window mode
[Re: Kartoffel]
#415714
01/22/13 17:23
01/22/13 17:23
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
some small snippet which applies this for all video resolutions:
#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);
}
|
|
|
Re: "fullscreen-look-like" window mode
[Re: MasterQ32]
#415717
01/22/13 17:28
01/22/13 17:28
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
you don't need windows.h in this case there's already sys_metrics(); 0 and 1 return the x and y size besides that using sys metrics is much easier for a beginner
POTATO-MAN saves the day! - Random
|
|
|
Re: "fullscreen-look-like" window mode
[Re: MasterQ32]
#415719
01/22/13 17:39
01/22/13 17:39
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
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:
#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)
Last edited by Kartoffel; 01/22/13 17:43.
POTATO-MAN saves the day! - Random
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|