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

Author Topic: Window not updateing unless clicked upon.  (Read 4045 times)

0 Members and 1 Guest are viewing this topic.

Head

  • Newbie
  • *
  • Posts: 5
    • View Profile
Window not updateing unless clicked upon.
« on: April 01, 2013, 03:54:07 pm »
Console project, wont update unless dragged.
VS2012,Win8
SFML 2.0RC
   
VideoMode mode = new VideoMode(1024,768);
            RenderWindow window = new RenderWindow(mode, "test", Styles.Default);
            Texture tex = new Texture(new Image("triangle.png"));
            Sprite sprite = new Sprite(tex);
            Stopwatch clock = new Stopwatch();
            SFML.Graphics.View view = new View();
            window.SetView(view);
            clock.Start();
            window.Closed += OnClose;
            Event events;
            Boolean running = true;
            window.SetActive(true);
            //window.
            while (running)
            {
                window.DispatchEvents();
                float time = clock.ElapsedMilliseconds;
                clock.Restart();
                window.Clear(Color.Black);
                s.Tick(time);
                sprite.Position = new Vector2f(s.x, s.y);
                sprite.Rotation = s.heading;
                //view.Center = sprite.Position;
                  window.Draw(sprite);
                window.Display();
            }
        }
« Last Edit: April 01, 2013, 04:13:26 pm by Head »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
Re: Window not updateing unless clicked upon.
« Reply #1 on: April 01, 2013, 06:28:13 pm »
This is not SFML 2.0 RC, this is either SFML 1.6 or a very outdated SFML 2 version. Please use at least SFML 2.0 RC or even better compile SFML directly from source (or use my nightly builds).
Afterwards you should read the tutorials, because you're doing things completely wrong. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Head

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Window not updateing unless clicked upon.
« Reply #2 on: April 01, 2013, 06:39:16 pm »
Merely just trying to get it to run and see stuff on the window.

Edit: You did realize this is in the DotNet forum?.
« Last Edit: April 01, 2013, 06:46:29 pm by Head »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
Re: Window not updateing unless clicked upon.
« Reply #3 on: April 01, 2013, 07:03:54 pm »
Edit: You did realize this is in the DotNet forum?.
Nope I didn't. ;D

But I'd guess it would still be using camelCase for the latest release or not? ???
Sorry I've no idea about the DotNet binding, my bad. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Head

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Window not updateing unless clicked upon.
« Reply #4 on: April 01, 2013, 07:32:42 pm »
Edit: You did realize this is in the DotNet forum?.
Nope I didn't. ;D

But I'd guess it would still be using camelCase for the latest release or not? ???
Sorry I've no idea about the DotNet binding, my bad. ;)

No wonder it was looking mighty odd then :)

Lets hope someone knows.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Window not updateing unless clicked upon.
« Reply #5 on: April 01, 2013, 08:43:27 pm »
Quote
But I'd guess it would still be using camelCase for the latest release or not?
No, SFML.Net uses CamelCase, which is kind of standard in .Net ;)

Quote
Lets hope someone knows.
Your code looks ok. Can you please post a complete (I can copy-paste-compile it) and minimal (nothing unrelated to the problem) example that reproduces the problem?
Laurent Gomila - SFML developer

Head

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Window not updateing unless clicked upon.
« Reply #6 on: April 01, 2013, 10:01:38 pm »
Quote
But I'd guess it would still be using camelCase for the latest release or not?
No, SFML.Net uses CamelCase, which is kind of standard in .Net ;)

Quote
Lets hope someone knows.
Your code looks ok. Can you please post a complete (I can copy-paste-compile it) and minimal (nothing unrelated to the problem) example that reproduces the problem?
Well i fixed the issue by setting             window.SetFramerateLimit(30); before while(running)

Do you still want the complete/minimal code sample?

krzat

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: Window not updateing unless clicked upon.
« Reply #7 on: April 02, 2013, 09:55:11 am »
clock.ElapsedMilliseconds returns integer, so if the elapsed time is below 1ms, you will apply zero and your objects won't move. Use (float)clock.Elapsed.TotalMilliseconds instead.
« Last Edit: April 02, 2013, 09:56:45 am by krzat »
SFML.Utils - useful extensions for SFML.Net

Head

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Window not updateing unless clicked upon.
« Reply #8 on: April 02, 2013, 03:08:45 pm »
clock.ElapsedMilliseconds returns integer, so if the elapsed time is below 1ms, you will apply zero and your objects won't move. Use (float)clock.Elapsed.TotalMilliseconds instead.
Already does, but not in this sample, thanks anyway.