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.


Messages - Fumasu

Pages: [1]
1
Hi,

as stated in http://www.sfml-dev.org/tutorials/2.4/start-vc.php

Quote
If you want to get rid of these DLLs and have SFML directly integrated into your executable, you must link to the static version. Static SFML libraries have the "-s" suffix: "sfml-xxx-s-d.lib" for Debug, and "sfml-xxx-s.lib" for Release.
 In this case, you'll also need to define the SFML_STATIC macro in the preprocessor options of your project.
and
Quote
Starting from SFML 2.2, when static linking, you will have to link all of SFML's dependencies to your project as well. This means that if you are linking sfml-window-s.lib or sfml-window-s-d.lib for example, you will also have to link opengl32.lib, winmm.lib and gdi32.lib. Some of these dependency libraries might already be listed under "Inherited values", but adding them again yourself shouldn't cause any problems.

Have you tried that??

2
Graphics / Re: fastPixelRendering
« on: August 10, 2015, 07:16:02 pm »
Hello.
I just start to play with C++ and SFML.
I use Code::Blocks with  TDM-GCC 4.9.2, 64 bit and SFML-2.3.1-windows-gcc-4.8.1-tdm-64-bit.zip.
My system is: Windows 7 64 bit, NVIDIA GeForce GT610
The versions of your compiler and SFML-package do not match. There is no official package for the TDM-GCC 4.9.2 compiler so you have to compile SFML from the source yourself (it is very easy). Just follow this tutorial.
http://www.sfml-dev.org/tutorials/2.3/compile-with-cmake.php

Quote
window.setVerticalSyncEnabled(true);
window.setFramerateLimit(60);
 
You should not use window.setVerticalSyncEnable and window.setFramerateLimit at the same time.

The problem seems to be the rand() random number generator. When i use the c++11 rng the problem disapears.
#include <SFML/Graphics.hpp>
#include <iostream>
#include <sstream>
#include <time.h>
#include <stdlib.h>

using namespace std;

string num2str(int i){
    stringstream s;
    s << i;
    return s.str();
}

int main()
{
    const unsigned int s = 512;
    const unsigned int sz = s*s*4;
    sf::Uint8 px[sz];

    //for (unsigned int i=3; i<sz; i+=4) px[i] = 255; // set alfa once


    sf::RenderWindow window(sf::VideoMode(s, s),
                            "Random",
                            sf::Style::Close);
    //window.setVerticalSyncEnabled(true);
    window.setFramerateLimit(60);

    sf::Texture texture;
    texture.create(s, s);

    sf::Sprite sprite;
    //window.setTitle(num2str(sf::Texture::getMaximumSize()));
    //window.setTitle(num2str(RAND_MAX));
    sprite.setTexture(texture);

   // use the c++11 random number generator
        std::random_device rd;
        std::mt19937 gen(rd());
        std::uniform_int_distribution<> dis(1, 2);
       
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
                {
            if (event.type == sf::Event::Closed)
                                window.close();
                }

        for (unsigned int i=0; i<sz-4; i+=4){
            //px[i] = (rand()%2 == 0) ? 0 : 255;
                        px[i] = (dis(gen)%2 == 0) ? 0 : 255;
            px[i+1] = px[i]; px[i+2] = px[i]; px[i+3] =255;
        }

        texture.update(px);

        window.clear();
        window.draw(sprite);
        window.display();
    }
    return 0;
}
 

3
Graphics / Re: Learning sf::View ; can't display a single thing
« on: June 12, 2014, 03:26:30 pm »
Hi.

The RectangleShape is not shown beause it is not inside your view.
It's position is 0,0 with a size of 100, 100 and your view starts at position 100, 100 with a size of 400, 200. So it is outside your view.

You have to move the rect inside the view e.g:
Code: [Select]
rect.setPosition(sf::Vector2f(100, 100));

Pages: [1]