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 - Ignoscite Mihi

Pages: [1]
1
Graphics / Re: Error with simple code
« on: May 30, 2015, 11:33:43 am »
p.s. I don't know if you realised but your second code has the body of main() pasted twice.

Just little mistake while copying. Both codes were made fast. Okay now I see what I was making wrong. Thanks for help. :-)

2
Graphics / Re: Error with simple code
« on: May 29, 2015, 05:29:10 pm »
The linker error gets generated because you don't implement the draw function.
And the compiler error gets generated because as G. said that's not how you initialize member variables (I was wrong again).

I'm confused now. Anyway it don't work with initializing other class members than draw.

3
Graphics / Re: Error with simple code
« on: May 28, 2015, 06:18:39 pm »
It's not working.

4
Graphics / Re: Error with simple code
« on: May 28, 2015, 05:08:06 pm »
Okay, does it work if you get rid of virtual? Also, you should be using
Code: [Select]
while(b) not
Code: [Select]
while(b=1)

1>------ Build started: Project: TEST, Configuration: Debug Win32 ------
1>  Source.cpp
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall Rysunek::draw(class sf::RenderTarget &,class sf::RenderStates)const " (?draw@Rysunek@@MBEXAAVRenderTarget@sf@@VRenderStates@3@@Z)
1>C:\Users\user\Documents\Visual Studio 2013\Projects\TEST\Debug\TEST.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

5
Graphics / Re: Error with simple code
« on: May 28, 2015, 05:01:15 pm »
Try making draw() protected not private.

Still not working.

1>------ Build started: Project: TEST, Configuration: Debug Win32 ------
1>  Source.cpp
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall Rysunek::draw(class sf::RenderTarget &,class sf::RenderStates)const " (?draw@Rysunek@@MBEXAAVRenderTarget@sf@@VRenderStates@3@@Z)
1>C:\Users\user\Documents\Visual Studio 2013\Projects\TEST\Debug\TEST.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

6
Graphics / Error with simple code
« on: May 28, 2015, 04:48:02 pm »
Hi all. My problem is that I can't draw classes. Can anyone help me?



#include <SFML\Graphics.hpp>
using namespace sf;
class Rysunek : public Drawable
{
public:
private:
        virtual void draw(RenderTarget &target, RenderStates states) const;
};

int main()
{
        RenderWindow window(VideoMode(512, 512, 32), " aaa " , Style::Close);
        bool b = 1;
        Rysunek rys;
        while (b = 1)
        {
                Event a;
                while (window.pollEvent(a))
                {
                        if (a.key.code == Keyboard::Escape){
                                b = 0;
                                window.close();
                        }
                }

                window.clear(Color::Blue);
                window.draw(rys);
                window.display();
        }
        return 0;
}



1>------ Build started: Project: TEST, Configuration: Debug Win32 ------
1>  Source.cpp
1>Source.obj : error LNK2001: unresolved external symbol "private: virtual void __thiscall Rysunek::draw(class sf::RenderTarget &,class sf::RenderStates)const " (?draw@Rysunek@@EBEXAAVRenderTarget@sf@@VRenderStates@3@@Z)
1>C:\Users\user\Documents\Visual Studio 2013\Projects\TEST\Debug\TEST.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

And second code:

#include <SFML\Graphics.hpp>
using namespace sf;
class Rysunek : public Drawable
{
public:
        Texture texture;
        Sprite sprite(texture);
private:
        virtual void draw(RenderTarget &target, RenderStates states) const
        {
                target.draw(sprite);
        }
};

int main()
{
        RenderWindow window(VideoMode(512, 512, 32), " aaa ", Style::Close);
        bool b = 1;
        Rysunek rys;
        rys.texture.loadFromFile("a.png");
        while (b = 1)
        {
                Event a;
                while (window.pollEvent(a))
                {
                        if (a.key.code == Keyboard::Escape){
                                b = 0;
                                window.close();
                        }
                }

                window.clear(Color::Blue);
                window.draw(rys);
                window.display();
        }
        return 0;
}
{
        RenderWindow window(VideoMode(512, 512, 32), " aaa " , Style::Close);
        bool b = 1;
        Rysunek rys;
        while (b = 1)
        {
                Event a;
                while (window.pollEvent(a))
                {
                        if (a.key.code == Keyboard::Escape){
                                b = 0;
                                window.close();
                        }
                }

                window.clear(Color::Blue);
                window.draw(rys);
                window.display();
        }
        return 0;
}

1>------ Build started: Project: TEST, Configuration: Debug Win32 ------
1>  Source.cpp
1>c:\users\user\documents\visual studio 2013\projects\test\test\source.cpp(7): error C2061: syntax error : identifier 'texture'
1>c:\users\user\documents\visual studio 2013\projects\test\test\source.cpp(11): error C3867: 'Rysunek::sprite': function call missing argument list; use '&Rysunek::sprite' to create a pointer to member
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

7
Graphics / Re: Run-Time Check Failure and something
« on: May 16, 2015, 11:19:13 am »
Okey guyz problem is solved.  ;D Only what I have done was delete visual studio and all components and install it again. I know it sounds stupid. Anyway thanks all for help :)

8
Graphics / Re: Run-Time Check Failure and something
« on: May 15, 2015, 08:55:41 pm »
A quick google just told me that the error is usually when you are accessing part of an array that doesn't exist (is out of bounds). I couldn't see that in the code you'd given but I know you omitted some things so it might be in there. Basically the error means you are accessing something that doesn't exist when you access it.
EDIT: I wasn't sure whether you had completely solved the problem or whether it had just stopped coming up for the moment and this seemed like useful information so it doesn't happen again.
Problem is not solved.

9
Graphics / Re: Run-Time Check Failure and something
« on: May 15, 2015, 04:39:58 pm »
That's because a still equals true. If you do what Hapax said then it should solve the problem. Just because the window is gone, it doesn't mean that all loops will automatically stop. If you want to end your program using window.close(), you need to put window.isOpen() as your loop condition.

You are right. I had written that after I added order to close program (x = false) a Run-Time Check Failure is still appearing :)

10
Graphics / Re: Run-Time Check Failure and something
« on: May 15, 2015, 06:34:41 am »
I changed
goto EXIT;
to
window.close();
and program after close window is running. After I added order to close program Run-Time error is appearing again.

Quote
Why is the font getting created and loaded on every cycle in the main loop? It should be created and loaded before the loop so it only gets loaded once. It wouldn't hurt to take the text object out of the loop too

Becouse it's fast-made program. In my main project where all declarations are before loop Run-Time Check Failure is also appearing.

11
Graphics / Re: Run-Time Check Failure and something
« on: May 14, 2015, 07:54:24 pm »
I think I don't understand you :/ I always was about the thread is keeping music alive.

EDIT:
Okay so I delete all
goto EXIT;
and there is no Run-Time Check Failure yet.

12
Graphics / Re: Run-Time Check Failure and something
« on: May 14, 2015, 08:23:26 am »
I'm using
else if(text.getGlobalBounds().contains(mysz) && event.type == Event::MouseButtonReleased && event.mouseButton.button == Mouse::Left)
and still don't working.

EDIT:
I changed
Event::MouseButtonReleased
to
Event::MouseButtonPressed
and it's working but I expect to do something when i release button.

EDIT2:
In first post I forgot to tell you that music isn't playing.

EDIT3: However
Event::MouseButtonPressed
is working like
Event::MouseButtonReleased
.

13
Graphics / Run-Time Check Failure and something
« on: May 13, 2015, 10:31:53 pm »
Hi guyz!

At the beggining I want to provide you that I've google my problem and did't get solve.
So.. I am working on a rpg game and update my old VS 10 to 12 and SFML 2.2 to 2.3.
Firstly I'm getting now random "Run-Time Check Failure #2" becouse of Font,Text, Music and Thread. Sometimes is working fine and error is appearing when I close my program.

Font and Text:
http://wklej.org/id/1710918/

Thread and Music:
http://wklej.org/id/1710942/

Secondly after update my buttons don't work.

if(text.getGlobalBounds().contains(mouse) && event.type == Event::MouseButtonReleased && event.key.code == Mouse::Left)
//code here

It's working only when i delete:
 
event.type == Event::MouseButtonReleased
But then mouse is hiting 2 times.

Could someone help me?

Pages: [1]