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

Author Topic: Invisible window on top of visible one  (Read 2566 times)

0 Members and 1 Guest are viewing this topic.

Randomaniac

  • Newbie
  • *
  • Posts: 3
    • View Profile
Invisible window on top of visible one
« on: November 28, 2012, 08:56:20 pm »
I'm currently working on a little game for a project.
My game is designed around a Model-View-Controller pattern. This is where I hope SFML will help me. The ideal idea was to have two separate windows: one that catches input (controller) and one that gives the user some juicy graphics (view). The controller would send some self-defined events to my model (game logic) every grame, the game would update itself accordingly and the view would query the model for a visual update. As said, this would be ideal.

In order for this to work I'd need to create an invisible window that would capture input at all times and a visible window that would never get focus: it's only there for the graphics. A little link has to be laid between them in case of rescaling, quitting,..

This is all still hypothetically speaking. How much of this can I actually realize? Any comments on the matter would be greatly appreciated.


Ruben
« Last Edit: November 28, 2012, 09:12:05 pm by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Invisible window on top of visible one
« Reply #1 on: November 28, 2012, 09:11:43 pm »
What benefits do you get with such a complicated design, compared to a single window that both catches input and draws the graphics?
Laurent Gomila - SFML developer

Randomaniac

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Invisible window on top of visible one
« Reply #2 on: November 28, 2012, 10:01:17 pm »
What benefits do you get with such a complicated design, compared to a single window that both catches input and draws the graphics?

Honestly? Fairly little. It's more of a design to fit a multiple-view, one data kind of structure. So, with future extensions in mind I could implement this and keep some separate views, for example a user view and a debug view. In the end it's really not what I need for my current game.

If no actual solutions turn up I'll turn to one client and try to separate the control (input) as much as possible from the view. Haven't had much experience with SFML except using my own graphics engine and SFML just for drawing my generated bitmaps, so I haven't quite figured out how to work with classes. I hope time will teach.

Still, any tips greatly appreciated.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Invisible window on top of visible one
« Reply #3 on: November 28, 2012, 10:06:26 pm »
I don't think you'll be able to create an invisible window that catches input. Unless you hide it by setting its opacity to zero... maybe. And SFML doesn't provide this feature.

It looks more like a hack than a clean solution, I'm not sure you should go this way.
Laurent Gomila - SFML developer

 

anything