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

Pages: [1]
1
Graphics / Re: Cannot create an image from scratch.
« on: September 13, 2012, 01:17:06 pm »
That's funny, I did try without it, but some some reason it crashed. I tried again now, and poof! It worked!

Thank you, Laurent!

2
Graphics / Cannot create an image from scratch.
« on: September 12, 2012, 06:26:07 am »
I appear to have run into an error within SFML 2.0. From the example given in the documentation, I cannot create an image based on the code given.

Here is my main.cpp.

#include <SFML/Graphics.hpp>


#define spritewidth 32
#define spriteheight 32

int main()
{


    sf::RenderWindow Window(sf::VideoMode(800, 600, 32), "SFML woo");

    sf::Image spritesheet;
    if (!spritesheet.loadFromFile("spritesheet.png"))
        return -1;


    sf::Image image;
    if (!image.create(20, 20, sf::Color(0, 0, 0, 255)))
        return -1;

    while (Window.isOpen())
    {

            sf::Event Event;
            while (Window.pollEvent(Event))
            {
                switch (Event.type)
                {
                    case sf::Event::Closed:
                        Window.close();
                        break;
                    default:
                        break;

                }
            }
            Window.clear(sf::Color(255, 255, 255));
            Window.display();
    }
    return 0;
}
 

Compiling with the GNU/GCC/MinGW compiler base, running sfml 2.0 rc.

Here is my compiler error.
In function 'int main()':
error: could not convert 'image.sf::Image::create(20u, 20u, (*(const sf::Color*)(& sf::Color(0, 0, 0, 255))))' from 'void' to 'bool'
error: in argument to unary !
=== Build finished: 2 errors, 0 warnings ===
 

Searching led me nowhere, I only seemed to run into dead-ends, as apparently no-one has suffered the same problem I have!

Thank you!

Pages: [1]