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

Pages: [1]
1
Graphics / Oops
« on: February 19, 2012, 10:08:55 pm »
F:\CodeBlocks-Programs\SFML Tutorial 02\main.cpp||In function 'void GameLoop()':|
F:\CodeBlocks-Programs\SFML Tutorial 02\main.cpp|38|error: no matching function for call to 'sf::RenderWindow::Display(Object&)'|
F:\CodeBlocks-Programs\SFML Tutorial 02\main.cpp|38|note: candidate is:|
F:\Libraries\SFML-1.6-sdk-windows-mingw\SFML-1.6\include\SFML\Window\Window.hpp|249|note: void sf::Window::Display()|
F:\Libraries\SFML-1.6-sdk-windows-mingw\SFML-1.6\include\SFML\Window\Window.hpp|249|note:   candidate expects 0 arguments, 1 provided|
||=== Build finished: 4 errors, 0 warnings (0 minutes, 1 seconds) ===|

I tried it and this is what I got. Maybe window is not a class? What am I doing wrong? I wrote it verbatim.

2
Graphics / texus
« on: February 19, 2012, 09:15:51 pm »
Now that was what i was looking for. passing in the window like that should be simple to figure out. I would have after a couple days of tearing my hair out. Passing the window by reference was perfect.

Code: [Select]
Object fred;
fred.Create("imagefile.PNG");
fred.Display(window);


That was so simple...so simple I couldn't figure it out. Seriously...I was freakin' floundering over here. Thanks texus. I guess you could call me nebus. lol

3
Graphics / obvious
« on: February 19, 2012, 08:55:20 pm »
So does that mean I am not getting an answer? I'll take an answer from anyone in the know.

What's the deal with this?:
states.Transform.Translate(GetPosition());
states.Transform.Scale(GetScale());

I have no idea what it is or what to do with it.

I am dying to learn something about SFML. You know...moving  sprite(check), firing a laser(check), time control(not done), Implementing SFML in my own class(Kind of check and kind of not done). SFML tutorials seem to be sparse. I was warned but at the ame time I was told SFML is C++ and not C. I would rather not waste my time mucking about with C.

Sorry about the post with dual personalities but that's what you get reading something wrote by someone with extreme ADHD.

4
Graphics / Why don't you do like every other transformable class?
« on: February 19, 2012, 08:21:52 pm »
Quote
Why don't you do like every other transformable class?

Because I have no idea what a transformable class is. I am using SFML version 1.6.

5
Graphics / sf::RenderStates states
« on: February 19, 2012, 07:50:16 pm »
Thanks for your response.

How will sf::RenderStates states be different?

I know nothing about states...
states.Transform.Translate(GetPosition());
states.Transform.Scale(GetScale());
How does the above two lines work? Is it a SFML thing or just 2. or your own bag of tricks?

sf::Edit()   (<- :P)
{

Does this look like what you were talking about?

Code: [Select]
struct Picture : public sf::Drawable
{
    bool Load(const std::string filename);
    void Draw(sf::RenderTarget& target, /**/sf::RenderStates states/**/) const;

    sf::Image Image_m;
    sf::Sprite Sprite_m;
};

bool Picture::Load(const std::string filename)
{
    if (Image_m.LoadFromFile(filename))
    {
        Sprite_m.SetTexture(m_Texture);
        return true;
    }
    else
         return false;
}

void Picture::Draw(sf::RenderTarget& target, /**/sf::RenderStates states/**/) const
{
        states.Transform.Translate(GetPosition());
        states.Transform.Scale(GetScale());

        target.Draw(m_Sprite, states);
}

}

6
Graphics / sf::RenderTarget& Question
« on: February 19, 2012, 02:33:45 pm »
I cannot figure out how to draw my object using my own Object class using SFML.

Here is my class:

Code: [Select]
Object.h
#ifndef OBJECT_H
#define OBJECT_H

#include "SFML/Graphics.hpp"


class Object
{
    public:
        Object();
        virtual ~Object();
        virtual void Create(char* ImageFileName);
        virtual void Update();
        virtual void Display();

    protected:
    private:
//        Vector2d position;
        bool visible;
        char* ImageFileName;
        sf::Sprite sprite;
        sf::Image image;
};

#endif // OBJECT_H


Code: [Select]

Object.cpp
#include "Object.h"
#include "SFML/Graphics.hpp"

Object::Object()
{
    //ctor
}

Object::~Object()
{
    //dtor
}

void Object::Create(char* ImageFileName)
{
    visible = true;//may be moved/changed
    image.LoadFromFile(ImageFileName);//load an image file for object
    sprite.SetImage(image);//set the object sprites image
}

void Object::Update()
{
    //set location etc...
}

void Object::Display()
{
    sf::Sprite::Draw();
}


Here is the error:

E:\CodeBlocks-Programs\SFML Tutorial 02\Object.cpp||In member function 'virtual void Object::Display()':|
E:\CodeBlocks-Programs\SFML Tutorial 02\Object.cpp|27|error: no matching function for call to 'sf::Sprite::Draw()'|
E:\CodeBlocks-Programs\SFML Tutorial 02\Object.cpp|27|note: candidate is:|
e:\programs\codeblocks-ep\mingw\bin\..\lib\gcc\mingw32\4.6.2\..\..\..\..\include\SFML\Graphics\Drawable.hpp|333|note: void sf::Drawable::Draw(sf::RenderTarget&) const|
e:\programs\codeblocks-ep\mingw\bin\..\lib\gcc\mingw32\4.6.2\..\..\..\..\include\SFML\Graphics\Drawable.hpp|333|note:   candidate expects 1 argument, 0 provided|
||=== Build finished: 4 errors, 0 warnings (0 minutes, 2 seconds) ===|

I just want to do this:

Code: [Select]
Object fred;
fred.Create("fredimage.png");
fred.Draw();

Pages: [1]
anything