Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Fullscreen SFML app and CreateProcess  (Read 1582 times)

0 Members and 1 Guest are viewing this topic.

doomista

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Fullscreen SFML app and CreateProcess
« on: July 16, 2017, 05:53:40 pm »
Hi,
I am trying to create an App Launcher with SFML for launching my games. I am using CreateProcess to launch a game. So far I've discovered that when my app has sf::Style::Default, game launched by CreateProcess (namely FTL) will go to fullscreen and play just fine. Unfortunately, when my app has sf::Style::Fullscreen, FTL will run in fullscreen, in foreground, has focus, will apply alternate style to mouse cursor, but nothing draws on the screen. Music plays, I can even click buttons (and exit FTL), but I can't see anything. I've tried to unset visibility of sfml window with setVisibility(false), but it didn't helped. Also I didn't find function to disable and reenable fullscreen.

Can you please help? Thanks in advance. App launching code:
STARTUPINFO si;
PROCESS_INFORMATION pi;

ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));

if (!CreateProcess("FTLGame.exe", NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))    {
        printf("CreateProcess failed (%d).\n", GetLastError());
}
else {
        printf("Prcess Creation Success");
}

WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: Fullscreen SFML app and CreateProcess
« Reply #1 on: July 16, 2017, 07:16:16 pm »
I can imagine that two fullscreen applications can cause issues (both want exclusive screen rights).
Question I ask myself is, why does your launcher need to run in fullscreen mode?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

doomista

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Fullscreen SFML app and CreateProcess
« Reply #2 on: July 16, 2017, 11:40:06 pm »
Cosmetic reasons, mostly. I have my gaming PC under TV (I don't have any console) and a convenient game launcher with interface similar to console interface that can be controlled by a gamepad is a nice touch. At this point I have one written in HTML+JS interpreted as HTA. That's a deprecated Windows feature that allows running processes from javascript. But it is buggy at best and I want different layout and I simply don't have the nerves to write it again in HTML+JS.

Anyways, I've probably found a solution:
Simply close SFML window right before executing a proces and then recreate context when launched game has been exited. Hopefully it will not unload my textures, we'll see. But I am quite surprised that setVisible() hasn't done the trick.

dabbertorres

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • website/blog
Re: Fullscreen SFML app and CreateProcess
« Reply #3 on: July 18, 2017, 03:14:59 am »
You might consider making your launcher borderless-windowed fullscreen. I believe that's what Steam Big Picture does by default.

doomista

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Fullscreen SFML app and CreateProcess
« Reply #4 on: July 18, 2017, 05:32:38 pm »
I've tried that, raises the same issue as using fullscreen.

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Fullscreen SFML app and CreateProcess
« Reply #5 on: July 18, 2017, 10:55:05 pm »
At what size of window does it stop causing the issue? i.e. How large can it be before it causes your issue?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything