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

Pages: [1]
1
Window / Framerate Limit not working properly on OSX
« on: July 22, 2013, 12:55:30 pm »
Testing the same piece of code on Windows, Linux (ubuntu) and OS X (10.8.4) doesn't have the right FPS on OSX.
Here is the code sample (from base project)

#include <SFML/Graphics.hpp>

// Here is a small helper for you ! Have a look.
#include "ResourcePath.hpp"
#include "FPS.hpp"

int main(int, char const**)
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
    window.setFramerateLimit(60);

    sf::Texture texture;
    if (!texture.loadFromFile(resourcePath() + "cute_image.jpg")) {
        return EXIT_FAILURE;
    }
    sf::Sprite sprite(texture);

    sf::Font font;
    font.loadFromFile(resourcePath()+"sansation.ttf");

    FPS fps(font);
    fps.setColor(sf::Color::Black);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed || (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape))
                window.close();
        }

        window.clear();
        window.draw(sprite);

        fps.step();
        window.draw(fps);

        window.display();
    }

    return EXIT_SUCCESS;
}

This gives a framerate of 57 while it should be 60



The FPS.hpp can be found here
https://gist.github.com/posva/6052868

I created a (rejected) issue here: https://github.com/SFML/SFML/issues/433

2
SFML projects / Grav, a hard arcade game [WIP]
« on: November 07, 2011, 08:01:52 pm »
Grav


Description:
Grav is an arcade game inspired from super gravitron from VVVVVV. I wanted to test a bit myself and make a simple but full playable game in C++

In the game you bounce between two lines and you have to dodge boxes that appears. There are online highscores, create an account it's really fast and allow you to save your statistics.

How is SFML used
SFML 2 is used for almoste everything... Graphics, sound, internet, threads, windowing
I was really confortable while making the game as SFML was really easy to use and there are a lot of tutorials, furthermore the doc is very good

Screenshoots:




Lastest Video:

Hard mode (not the usual one :P)


Website:
http://www.killdaducks.com

Download an alpha version:
http://www.killdaducks.com/2011/11/grav-alpha-download.html
(Mac & windows versions, No linux for the moment, I'm sorry)

I accept any suggestion and criticism![/url]

3
Graphics / Masking in SFML 2
« on: July 28, 2011, 03:18:24 pm »
Hi, i'm wondering how to mask in SFML 2. I know that someone added a topic to the wiki for SFML 1.6 but i suppose that now that we have RenderImages we can do it with BlendModes, i cannot achieve it though...
I have being trying for a few hours now and stills doesn't work properly. I tried with many techniques but nothing...
The last one i tried was to have the sprite (lready masked) drawn to a black rectangle and then draw that rectangle with blend Add into a transparent surface but it doesn't work it about the same img.
Here is my code so far:
Code: [Select]

mask_img.Create(640,480);
    effects_img.Create(640, 480);
    light_img.Create(640, 480);
    inter_img.Create(640, 480);
mask_img.Clear(sf::Color(0,0,0,255));
    effects_img.Clear(sf::Color(0,0,0,0));
    light_img.Clear(sf::Color(0,0,0,255));

{...}

light_img.Draw(BloodHit::sprBlood[0]);
    spr_mask.SetBlendMode(sf::Blend::Multiply);
    light_img.Draw(spr_mask);
    light_img.Display();
    spr_inter.SetImage(light_img.GetImage());
    spr_inter.SetBlendMode(sf::Blend::Add);
   
    inter_img.Clear(sf::Color(0,0,0,0));

    //inter_img.Draw(sf::Shape::Rectangle(420, 340, 8, 8, sf::Color::White));
    inter_img.Draw(spr_inter);
    inter_img.Display();


This is why I think the substract blendmode should be added xD, to make masking easier. ( I already read some topics about adding BlendModes)

Thanks

Pages: [1]