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

Author Topic: Full screen problem  (Read 6578 times)

0 Members and 1 Guest are viewing this topic.

wcale

  • Newbie
  • *
  • Posts: 7
    • View Profile
Full screen problem
« on: February 12, 2013, 01:19:26 am »
C# SFML 2.0
I have problem with full screen mode:

I have 2 forms.
1st form is a standarw form.

2nd form is form with partialy display gfx with this declaration:
SFMLWindow = new RenderWindow(this.Handle);

What i need to do to change this to full screen mode?
                if (SFML.Window.Keyboard.IsKeyPressed(SFML.Window.Keyboard.Key.F))
                {
                    //How to get full screen modes?
                    //How to switch from windowed size to full screen?
                }

krzat

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: Full screen problem
« Reply #1 on: February 12, 2013, 09:19:27 am »
Close current window and create new one.
SFML.Utils - useful extensions for SFML.Net

wcale

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Full screen problem
« Reply #2 on: February 13, 2013, 12:22:41 am »
I can't close that window, because i have few graphical components on this window displayed on SFMLWindow.
« Last Edit: February 13, 2013, 01:59:33 am by wcale »

krzat

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: Full screen problem
« Reply #3 on: February 13, 2013, 02:16:13 am »
You will redraw them on next loop, when the switch is done.

Example(Alt + Enter toggles fullscreen): http://pastebin.com/yn1qJrGa
SFML.Utils - useful extensions for SFML.Net

wcale

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Full screen problem
« Reply #4 on: February 13, 2013, 08:19:46 pm »
Ok, I have something like this:

Form2:
SFMLWindow = new RenderWindow(this.Handle);
inside Form2 I have also:
panel1
 on panel1 is: many componentsl like labels, buttons, displays components and so on...

Now I close:
SFMLWindow.Close();

And create this:
SFMLWindow = new RenderWindow(new VideoMode(1920, 1080), "Game", Styles.Default);

What about panel, labels and other? I don't know how to move it (panels, labels, other display components) into new window.

This is worst problem :(

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Full screen problem
« Reply #5 on: February 14, 2013, 01:23:02 pm »
Wooahh there, slow down! First please post all of your code of what you are doing. Because from what I understand from what you are posting you are attempting to use GDI+ control components (labels, panels, textboxes, ect...) inside a SFML window which will not work.

If you want to use the .NET controls you have to use them inside a standard .NET form because SFML has no way to render them (or handle them). If all you want with your standard .NET form is to be full screen set the border style to none, the topmost to true, and window state to maximized.

If you are instead want an SFML render window there is no way to put .NET controls inside it. Instead try some of the existing GUI libraries for use with SFML.

SFMLWindow = new RenderWindow(this.Handle);
I think you need to reread the documentation of what this really does. All this does is create an SFML rendow window that is drawn ON TOP of your form (or whatever control this.Handle references).

SFMLWindow.Close();
All this does is close your SFML render window which is drawn on top of your .NET form, this code will not close the .NET form.

SFMLWindow = new RenderWindow(new VideoMode(1920, 1080), "Game", Styles.Default);
No wonder you are wondering where your .NET controls got to... Your creating a SFML render window which is incapable of handling these objects. All in all try my suggestion above and just bring your .NET window (with the SFML window contained inside) to full screen and see if that helps. If that doesn't please post your ENTIRE code related to how you handle the windows.

BTW krzat, there is nothing wrong with your pastebin code, trouble is it sounds like he wants to use an SFML render window along with GDI+ components.
« Last Edit: February 14, 2013, 01:25:59 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

wcale

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Full screen problem
« Reply #6 on: February 14, 2013, 03:49:01 pm »
@zsbzsb
Yes, i try to use graphical .net components on SFMLWindow.

I know, that code:
SFMLWindow = new RenderWindow(this.Handle);
is drawing on some window handle (i.e. form).

I can't simply draw .net components anything on SFMLWindow?

If not, then i must change screen resolution by myself, and maximize form?

@krzat - your code is ok (and thank you for your answer). But i try to do something what i don't know is possible...

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Full screen problem
« Reply #7 on: February 14, 2013, 05:16:31 pm »
Quote
Yes, i try to use graphical .net components on SFMLWindow.
This will not work. SFML has no idea how to use .NET components. If you want controls rendered in a SFML window you need to either make your own controls or use an existing library that is designed for SFML.
Quote
I can't simply draw .net components anything on SFMLWindow?
Nope, see above^^

Mind you, you can host the SFML window in a Panel control on your .NET form and then surround the panel with the .NET controls (textboxes, labels, ect...) while they are still hosted in the .NET form.

If you just want a full screen SFML window use the code that was posted above by krzat.
If you want a full screen .NET form use this.
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.TopMost = true;
            this.WindowState = FormWindowState.Maximized;
« Last Edit: February 18, 2013, 08:23:02 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

wcale

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Full screen problem
« Reply #8 on: February 18, 2013, 02:42:21 pm »
Thanks for many answers.

@zsbzsb i see no file there.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Full screen problem
« Reply #9 on: February 18, 2013, 08:22:30 pm »
@zsbzsb i see no file there.
Screw that hosting site, the file was there..... Anyways if you would like I could make up another example for you if you need it.  :D
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor