time-killer-games
|
|
Posted on: March 20, 2014, 09:59:31 am |
|
|
"Guest"
|
GMStudio uses "true fullscreen" on windows, mac, and linux meaning if you try to use show_message(), get_open_filename(), etc or any other functions that produce small dialog boxes, the game if running in fullscreen will automatically switch to windowed mode. I'm creating a dll/dylib for Windows and Mac that will force GMS games one these platforms to use "fake fullscreen", meaning it will look identical to "true fullscreen" but it will allow dialog windows to appear without switching the game to windowed mode. Linux and Windows 8 won't be supported until YYG announce the 1.3 extention system works on those platforms.
I'm doing it all in Code:Blocks for cross-compatibility. I made a DLL in the past called HostExe. It launches an external exe, removes the exe's border, and embeds it. It doesn't work anymore because I must have modified it by accident and I don't know how to fix it. But it does remove the external exe's window border, at least. I don't care about HostExe anymore because I'm not working on it. But for a referense to what I was talking about here's the HostExe.dll's source main.cpp...
#include "main.h" #define DLL extern "C" _declspec(dllexport)
HANDLE handle; HWND apphwnd; RECT rect;
int CALLBACK EnumWindowsProc(HWND hwnd, LPARAM param) { DWORD pID; DWORD TpID = GetWindowThreadProcessId(hwnd, &pID); if (TpID == (DWORD)param) { apphwnd=hwnd; return false; } return true; }
HANDLE StartProcess(LPCTSTR program,LPCTSTR args) {
HANDLE hProcess = NULL; PROCESS_INFORMATION processInfo; STARTUPINFO startupInfo; ::ZeroMemory(&startupInfo,sizeof(startupInfo)); startupInfo.cb=sizeof(startupInfo); if(::CreateProcess(program,(LPTSTR)args, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInfo)) { Sleep(5000); ::EnumWindows(&EnumWindowsProc,processInfo.dwThreadId); hProcess=processInfo.hProcess; } return hProcess; }
DLL double HostingStartEmbed(char *Exe) { GetClientRect(GetActiveWindow(),&rect); handle=StartProcess(Exe,""); if(apphwnd!=NULL) { ::SetParent(apphwnd,GetActiveWindow()); SetWindowLong(apphwnd, GWL_STYLE, WS_VISIBLE); ::MoveWindow(apphwnd,rect.left,rect.top,rect.right,rect.bottom, true); } return 0; }
DLL double HostingEndEmbed() { TerminateProcess(handle,0); return 0; }
DLL double HostingSetRectangle(int Left,int Top,int Right,int Bottom) { ::MoveWindow(apphwnd,Left,Top,Right,Bottom,true); return 0; }
The DLL I'm working on now does something similar, it just removes the border of the current game window and resizes the rectangle to fill the entire screen, otherwise known as "fake fullscreen". Though removing the border works in HostExe.dll, I'm not sure why it isn't working in FakeFullscreen.dll. The window isn't resizing, either. The dll can be called from my GMS game without trouble or errors, but the game just runs and acts as if the DLL isn't even being called. Here's the main.cpp code for FakeFullscreen.dll...
#include "main.h" #define DLL extern "C" _declspec(dllexport)
DLL double FakeFullscreen(LPCTSTR Title,int Width,int Height) { HWND Handle; Handle=FindWindow(Title, NULL); SetWindowLong(Handle, GWL_STYLE, WS_VISIBLE); MoveWindow(Handle,0,0,Width,Height,true); return 0; }
Anyone have an idea why FakeFullscreen.dll isn't working? I think it has to do with a problem in how I'm using FindWindow(), but then again, I'm using the correct title bar text my game has in the first argument, so idk...
Thanks. ~Samuel
|
|
« Last Edit: March 20, 2014, 10:39:09 am by time-killer-games »
|
Logged
|
|
|
|
|
time-killer-games
|
|
Reply #2 Posted on: March 20, 2014, 01:12:31 pm |
|
|
"Guest"
|
They removed that from the global game settings, and they deprecated the associated GML function. No, it won't at all effect the game's performance because the demo I'm going to distribute with the DLL will only switch the game to use fakeFS whenever there's a dialog box opened, so if the main game window is the only window the game has opened, you'll be using true fs instead.
|
|
|
Logged
|
|
|
|
Darkstar2
|
|
Reply #3 Posted on: March 20, 2014, 01:33:10 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
They removed that from the global game settings, and they deprecated the associated GML function.
Oh silly me How could I have missed that, deprecating stuff and all They remove stuff at their convenience just because THEY don't find it useful No, it won't at all effect the game's performance because the demo I'm going to distribute with the DLL will only switch the game to use fakeFS whenever there's a dialog box opened, so if the main game window is the only window the game has opened, you'll be using true fs instead.
Ok, so it would seamlessly switch right ? BTW, this can be done in ENIGMA the borders can be disabled in global settings although never tried it.
|
|
« Last Edit: March 20, 2014, 03:05:25 pm by Darkstar2 »
|
Logged
|
|
|
|
time-killer-games
|
|
Reply #4 Posted on: March 20, 2014, 03:38:58 pm |
|
|
"Guest"
|
I know Enigma can do that, I needed GameMaker to do that. But I found an easy solution, a DLL someone else already made.To see how 'seemless' it is, here are two of games that use it, first-thing shown after their title screens... * Attack of the Naked Blockheads 3D* Real Men Wear Pink HDThe only issue is the main game window behind the message box turns solid white, for as long as the message remains opened. But oh well, it's better than switching to windowed mode.
|
|
« Last Edit: March 20, 2014, 03:41:05 pm by time-killer-games »
|
Logged
|
|
|
|
|
time-killer-games
|
|
Reply #6 Posted on: March 20, 2014, 04:01:10 pm |
|
|
"Guest"
|
Cool, thanks. But I already knew that and used it in the past and I needed it for GM not Enigma. But anyway, at least my discovery fixed the issue for Windows. Now if I could get someone to port that guy's DLL to a DyLib with code:blocks, so it will work on Mac too.
|
|
|
Logged
|
|
|
|
Goombert
|
|
Reply #7 Posted on: March 21, 2014, 02:34:28 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
I don't understand why this is useful exactly. My biggest complaint with full screen games is when they don't freeze when losing focus, so if they are doing mouse capture, you can't ALT+TAB to the desktop to like chat with someone real fast or something. I hate applications that do that.
Also, all extension topics GM or ENIGMA belong in the 3rd party subforum.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
Darkstar2
|
|
Reply #8 Posted on: March 21, 2014, 03:13:41 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
I don't understand why this is useful exactly. My biggest complaint with full screen games is when they don't freeze when losing focus, so if they are doing mouse capture, you can't ALT+TAB to the desktop to like chat with someone real fast or something. I hate applications that do that.
Also, all extension topics GM or ENIGMA belong in the 3rd party subforum.
You could fix this by including a proper pause menu in your games. BTW, GMS has a OS focus command, you could use it to trigger your pause menu / routine. Is this function active in ENIGMA ? I know what you mean about some games and ALT-TAB issues, lol, there are times when I was stuck in a game after hours of trying, and I would use a help /walkthru and would need to ALT-TAB, remember how problematic it was with some games and all the cussing Those were the days.
|
|
|
Logged
|
|
|
|
TheExDeus
|
|
Reply #9 Posted on: March 21, 2014, 05:48:26 pm |
|
|
Joined: Apr 2008
Posts: 1860
|
BTW, GMS has a OS focus command, you could use it to trigger your pause menu / routine. Is this function active in ENIGMA ? No, I don't think we currently have that function. I guess I could add it. What is it called in GM? All I found was "os_is_paused()". I would prefer be called window_get_focus() or something. But I guess we can overload it for os_is_paused() as well. And while GM says os_is_paused() will return true only for 1 step, I think it would be better if it was true all the time while out of focus. I know what you mean He is actually talking about mouse issues in 3D shooters. In 3D games your mouse is always centered every step. This means if you ALT+TAB and it still does that, then you cannot move your mouse (even though you are in the desktop). That is often a problem with 3D examples in GM.
|
|
|
Logged
|
|
|
|
Darkstar2
|
|
Reply #10 Posted on: March 21, 2014, 08:17:10 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
BTW, GMS has a OS focus command, you could use it to trigger your pause menu / routine. Is this function active in ENIGMA ? No, I don't think we currently have that function. I guess I could add it. What is it called in GM? All I found was "os_is_paused()". I would prefer be called
I thought it was already functional in ENIGMA. Is it a lot of work to add this ? He is actually talking about mouse issues in 3D shooters. In 3D games your mouse is always centered every step. This means if you ALT+TAB and it still does that, then you cannot move your mouse (even though you are in the desktop). That is often a problem with 3D examples in GM.
I've had this exact problem too before with some games and some more severe. Usually before ALT-TAB I usually go to a pause menu in the game first. I have not had any issues with recent games.
|
|
|
Logged
|
|
|
|
time-killer-games
|
|
Reply #11 Posted on: March 21, 2014, 08:26:14 pm |
|
|
"Guest"
|
Darkstar - it is in ENIGMA, just have a look at the global game settings, I've used it before and can verify it works. [checkbox] Freeze the game when the window loses focus
|
|
|
Logged
|
|
|
|
Darkstar2
|
|
Reply #12 Posted on: March 22, 2014, 02:36:40 am |
|
|
Joined: Jan 2014
Posts: 1238
|
Darkstar - it is in ENIGMA, just have a look at the global game settings, I've used it before and can verify it works.
[checkbox] Freeze the game when the window loses focus Thanks I will keep that in mind. However it would be good to check for focus through a function, this would allow for automatic pause menus or other actions.
|
|
|
Logged
|
|
|
|
Goombert
|
|
Reply #13 Posted on: March 22, 2014, 10:58:04 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Darkstar - it is in ENIGMA, just have a look at the global game settings, I've used it before and can verify it works. Sadly, I haven't gotten it working for Linux yet, well because, XLIB is fucking shite compared to Win32. I thought it was already functional in ENIGMA. Is it a lot of work to add this ? No it is very easy to add os_is_paused() since I've already implemented the lost focus stuff, we literally just need to make that function return a boolean value (enigma::gameFroze) that already exists in code. https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSmain.cpp#L330All I found was "os_is_paused()". I would prefer be called window_get_focus() or something. But I guess we can overload it for os_is_paused() as well. I would prefer you just name it their version, no need otherwise you'll have to wrap like 50 functions, they have several more, YYG is just trying to make those functions more cross-platformish I suppose. And while GM says os_is_paused() will return true only for 1 step, I think it would be better if it was true all the time while out of focus. Because of ENIGMA's current implementation, it will behave exactly the same as GM, please do not change it, just implement the function and be done. That is often a problem with 3D examples in GM. This is not just a problem with GM games, but also DirectInput games such as GTA: San Andreas, and it's a bitch for me to try and play it while connected to #enigma using Hexchat, since Hexchat also uses DirectInput and they fuck with each other. DirectInput is deprecated for a reason, RawInput is better, and Microsoft even advises not using DirectInput, all it does is add bloat to your games and make them run shitty. Microsoft does recommend using them for Joysticks, however ENIGMA uses RawInput for Joystick functions just like GM does. Edit: I have gone ahead and implemented os_is_network_connected and os_is_paused for Win32 in the following pull request. https://github.com/enigma-dev/enigma-dev/pull/673
|
|
« Last Edit: March 22, 2014, 12:27:41 pm by Robert B Colton »
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
TheExDeus
|
|
Reply #14 Posted on: March 22, 2014, 12:49:18 pm |
|
|
Joined: Apr 2008
Posts: 1860
|
function return a boolean value (enigma::gameFroze) that already exists in code. That wouldn't work, as the boolean is set only when "Freeze the game" thing is enabled. But that check isn't really necessary and can be put in the main loop instead. YYG is just trying to make those functions more cross-platformish I suppose. But that again break not only the naming convention but common sense. The OS is NOT paused when that function returns true, the game is not even paused. The game just lost focus. But at least if I make two versions they can be both used - this one will work just like GM:S and the window_get_focus() will work like it really should. Because of ENIGMA's current implementation, it will behave exactly the same as GM, please do not change it, just implement the function and be done. It will NOT work like GM implementation. It will actually not work at all. The bool will be set to true only when you have "Freeze the game when the window looses focus" enabled and that will then break because the bool will be the false again when the window regains focus. This means no events are going to be executed in the middle and in the game os_is_paused() is never going to return true. Edit: I have gone ahead and implemented os_is_network_connected and os_is_paused for Win32 in the following pull request. It seems you still don't try your own pull requests. I wrote why it wouldn't work and after testing that commit - surprise - it doesn't work. There are about 4 reasons why it wouldn't. I will implement this to make it work like a window function and then implement the os_ one to work like GM.
|
|
|
Logged
|
|
|
|
|