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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - cha0s

Pages: [1]
1
Window / Any analog to SDL's expose event?
« on: October 10, 2012, 07:21:31 pm »
My game library is implementing a display list structure to only refresh the screen (and specifically, the dirty rectangles) when things move.

For instance, in a tile-based 2D engine, if enemies are walking around, one won't have to do the (potentially, based on the speed of the underlying graphics implementation) expensive operation of redrawing the tile matrix every single frame. The display list will keep track of only the rectangles needing updating and rendering what's necessary.

The problem I'm having is that if I let my app do this, and for instance grab the window and move it offscreen and back, or if another window is dragged over my window, there is no event to let me know that due to something outside of the scope of my application, I need to redraw some or all of the window contents.

SDL has SDL_ExposeEvent, is there an analog for SFML?

EDIT: That page really showcases how lame SDL docs are in places :P The relevant part is:

Quote from: SDL docs
SDL_ExposeEvent is a member of the SDL_Event union and is used whan an event of type SDL_VIDEOEXPOSE is reported.

A VIDEOEXPOSE event is triggered when the screen has been modified outside of the application, usually by the window manager and needs to be redrawn.

2
Graphics / RenderTexture bug?
« on: October 09, 2012, 09:03:15 am »
I'm using master from git. I'm new to SFML! So I'm sorry if this is just a newb mistake. This is just a small excerpt of code that I could get to exhibit what appears to be a bug. I'm posting the source with comments that should make it clear what I'm expecting and what I'm actually getting. Any help is much appreciated!

#include <SFML/Graphics.hpp>
#include <list>

int main()
{
    sf::RenderWindow window(sf::VideoMode(320, 240), "Test");
   
    sf::RenderTexture buffer;
    buffer.create(320, 240);

    sf::RenderTexture buffer2;
    buffer2.create(64, 64);
   
    // Pink box
    buffer.clear(sf::Color(255, 0, 255));
    buffer.display();
   
    // Blue box
    buffer2.clear(sf::Color(0, 255, 255));
    buffer2.display();
   
    // Should draw a light blue box in the upper left corner with a pink
    // background. OK!
    buffer.draw(sf::Sprite(buffer2.getTexture()));
    buffer.display();
    window.draw(sf::Sprite(buffer.getTexture()));
    window.display();
   
    // White box.
    buffer.clear(sf::Color(255, 255, 255));
    buffer.display();
   
    // Should draw a light blue box in the upper left corner with a white
    // background. NOPE! Pure white background...
    buffer.draw(sf::Sprite(buffer2.getTexture()));
    buffer.display();
    window.draw(sf::Sprite(buffer.getTexture()));
    window.display();
   
    while(window.isOpen())
    {
        sf::Event event;
        while(window.pollEvent(event))
        {
            if(event.type == sf::Event::Closed)
                window.close();
        }
    }
}
 

Pages: [1]