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 - Debonair

Pages: [1]
1
Graphics / [Solved] Fade effect
« on: July 30, 2015, 12:43:37 pm »
Been trying to create a fading effect, made a separate class for it, everything works fine, except not really. The basic idea was to draw a RectangleShape across the whole screen with a black fillcolor, and an alpha of 0, then the class gradually increases it over a period of time. When I run the thing, that period of time is noticeable, so the class does what it is supposed to do, except I don't see the rectangleshape at all, even though it is being drawn, it is transparent during the whole thing. Tried to do it just within the loop as well, without the class, the issue is the same.

Without class version:
        Clock clock;
        RectangleShape fade;
        fade.setPosition(Vector2f(0,0));
        fade.setFillColor(Color(0,0,0,0));
        fade.setSize(Vector2f(800,600));
        int i=0;
    while (window.isOpen())
    {
        if(clock.getElapsedTime()>seconds(0.04)){
            i++;
            fade.setFillColor(Color(0,0,0,i));
            clock.restart();
        }
     ///other stuff
        window.draw(fade);
     }
 

Am I just not supposed to be doing this with a RectangleShape?

2
Graphics / [Solved] Custom icon for renderwindow
« on: July 17, 2015, 05:51:05 pm »
window.setIcon(image.GetWidth(), image.GetHeight(), image.GetPixelsPtr());

Tried using this, but it's telling me the methods aren't within Image as members. Is this an outdated way of doing it, or am I doing it wrong? Using SFML 2.2.

3
Window / [Solved] Making key pressed event fire only once
« on: July 16, 2015, 07:18:51 pm »
Did some search about this, found a solution, which is to use this: window.setKeyRepeatEnabled(false);
But it does not seem to be working, the event is still firing continuously. Is this no longer functional? My SFML version is 2.2.

4
Graphics / [SOLVED] Failed to create texture, internal size too big
« on: February 19, 2015, 06:11:13 pm »
Greetings.
Started learning to use SFML, took a while to set up libraries and whatnot but it works. Now, the first image I want to display gives me this error, and it can't be the size because it's 32x32 px. It's a jpg.
This is the bit of code that handles the texture:
Code: [Select]
    sf::Texture texture;
    if (!texture.loadFromFile("texture.jpg", sf::IntRect(100, 100, 32, 32)))
{
    // error...
}

What am I doing wrong?

Pages: [1]
anything