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

Author Topic: Nothing being displayed, but images work fine.  (Read 2270 times)

0 Members and 1 Guest are viewing this topic.

Rodaxoleaux

  • Newbie
  • *
  • Posts: 2
    • View Profile
Nothing being displayed, but images work fine.
« on: June 23, 2012, 01:47:34 am »
Okay, so I'm making a little engine wrapper type deal that relates to the java slick game library. Loading of images work fine, and everything else and using sfeMovie, the audio plays but no video plays, and no sprites or anything are actually displayed onto the screen when window.display() is called. The way the engine works, a class is derived from the hGame class, containing pure virtual functions (abstract class with the rendering and updating functions to be overwritten.)

Here, the game system (after being given an instance of a derived hGame class in the main function) carries out the loop of the game using the redefined functions. "Window" is a wrapper around RenderWindow (hWindow class)

void hGameSystem::Run(hGame* g)
{
    g->init();

    hInput input;
    hGameSystem sys = (*this);
    sf::Clock Clock;
    Clock.restart();

    while (Running)
    {
        input.GlobalGetInput(Window);

        g->update(sys,input);
        g->render(sys,Window); //Here's the problem I suppose?

        sf::Time Time = Clock.getElapsedTime();

        if (Time.asMilliseconds() < (1000/FPSLimit))
        {
            Sleep((1000/FPSLimit)-Time.asMilliseconds());
        }

        Clock.restart();
    }
    g->cleanup();
}
 

The redefined render function
window->Clear();

    sf::Sprite b(a);
    window->rw->draw(b);

    window->Display();
 

Is there something else I'm not understanding? SFML 2.0, by the way. And there's nothing wrong with the SFML installation itself, as if I run the same video file or any sprite through a barebones main like the sfeMovie example, it works fine.

Edited for language specification? o.o
« Last Edit: June 23, 2012, 02:12:42 am by Rodaxoleaux »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Nothing being displayed, but images work fine.
« Reply #1 on: June 23, 2012, 01:58:00 am »
I still wonder why people can't just use code=cpp tags... ::)

Although you provide some code it's really not possible to tell what happens behind all your functions and classes... Also I've no idea what sfeMovies does.

Do the examples that come with SFML work for you, i.e. do they display sprites etc?

window->Clear();

    sf::Sprite b(a);
    window->rw->draw(b);

    window->Display();
 
What is a? Does it hold a valid texture?

Please read this carefully.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Rodaxoleaux

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Nothing being displayed, but images work fine.
« Reply #2 on: June 23, 2012, 02:11:57 am »
They didn't have language specification back with allegro forums or anything, just the lone code tags~ (along with start=1 for line numbers but...) I said that the examples do work for me. It's just this that won't. a is a valid texture
Quote
Loading of images work fine
I was only trying to give the minimal amount of code I could in reference to the problem.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Nothing being displayed, but images work fine.
« Reply #3 on: June 23, 2012, 09:58:51 am »
I said that the examples do work for me. It's just this that won't.
I was only trying to give the minimal amount of code I could in reference to the problem.

So it's not a problem with your hardware or SFML but your code which leads me to the same conclusion, from the given code I can't determin your problem.
The line you've commented, does the render function take the window as reference? Since you asume the problem is with that function, could you post the function?

The loop you use to call Sleep does kind of already exist with the function on the render window: setFramerateLimit(int), but you're free to use yours since it could give you more freedom.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/