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

Pages: [1] 2 3 4
1
Graphics / R6025 Error, pure virtual function call
« on: September 04, 2011, 09:09:01 pm »
Thanks guys, I am going to read into this stuff and thanks for helping again :)

2
Graphics / R6025 Error, pure virtual function call
« on: September 04, 2011, 08:55:06 pm »
But if I didn't use pointer wouldn't it just call the underlying class his think / draw methods ?

I probably sound very stupid (obviously still learning) but could you point me out to some better design patterns for game development then ? This is just something I came up with because I saw xna has something that looks like this :P

3
Graphics / R6025 Error, pure virtual function call
« on: September 04, 2011, 08:31:28 pm »
So, I yea this is really what happens, just tested, but how would one fix this ?

edit :

Oke well this worked :
Code: [Select]
sf::Image sub;
sub.LoadFromFile("Assets//submarine.png");
sub.CreateMaskFromColor(sf::Color::White);
player plyr1 = player(sf::Vector2<float>(10,10), sf::Sprite(sub), &world.GetWindow()->GetInput(), world.GetWindow());

world.entityList.push_back(&plyr1);


Is this the proper way to do it ?

4
Graphics / R6025 Error, pure virtual function call
« on: September 04, 2011, 05:07:03 pm »
Hey, sorry for the late respone, my internet is broken I guess because it took like 30 min to upload this 10mb zip.

http://www.2shared.com/file/upsjLUmP/SFML.html

It contains the project with just the 3 classes : World, BaseEntity and player.

5
Graphics / R6025 Error, pure virtual function call
« on: September 04, 2011, 03:41:05 pm »
Ahh sorry

Code: [Select]
player(sf::Vector2<float>(10,10), sf::Sprite(sub), &world.GetWindow()->GetInput(), world.GetWindow())

from the world class :
Code: [Select]
sf::RenderWindow * GetWindow() {return &renderWindow;}

6
Graphics / R6025 Error, pure virtual function call
« on: September 04, 2011, 03:35:03 pm »
I am using sfml 2.0, its pointing to a render window and what do you mean with : Also show us the code where render target is set for the player entity.

7
Graphics / R6025 Error, pure virtual function call
« on: September 02, 2011, 09:22:51 pm »
Hello, I got a problem where when I start my program it crashes with the R6025 error (link : http://support.microsoft.com/kb/125749 )

I managed to find what was causing it but no idea why :

Code: [Select]
void BaseEntity::Draw(float frameTime)
{
renderWindow->Draw(sprite);
}


which is in BaseEntity.cpp

Here is the header file :
Code: [Select]

#pragma once
#include <SFML\Graphics.hpp>

class BaseEntity
{
protected:
sf::RenderWindow * renderWindow;
public:
sf::Vector2<float> position;
sf::Sprite sprite;

BaseEntity();
BaseEntity(sf::Vector2<float>, sf::Sprite);
virtual void Draw(float);
virtual void Think(float);
};


Here is the object implementing baseentity :

Code: [Select]

#pragma once
#include <SFML\Graphics.hpp>
#include "BaseEntity.h"

class player : public BaseEntity
{
const sf::Input * input;
public:
// Physics variables :
sf::Vector2<float> velocity;
sf::Vector2<float> acceleration;
sf::Vector2<float> friction;
sf::Vector2<float> maxAccelerationSpeed;

player(sf::Vector2<float>, sf::Sprite, const sf::Input*, sf::RenderWindow *);
void Draw(float);
void Think(float);
};


Code: [Select]

#include "player.h"

player::player(sf::Vector2<float> pos, sf::Sprite spr, const sf::Input * inp, sf::RenderWindow * window) : BaseEntity()
{
//Physics :
velocity = sf::Vector2<float>(0,0);
acceleration = sf::Vector2<float>(5,5);
friction = sf::Vector2<float>(0.97f,0.97f);
maxAccelerationSpeed = sf::Vector2<float>(25,25);

position = pos;
sprite = spr;
input = inp;
renderWindow = window;
}

void player::Draw(float frameTime)
{
BaseEntity::Draw(frameTime);
}



I left out the think method since its only calculating physic related things.

Also I have a world class which just has a basic think and draw loop which is called all of the entity's in the scene (currently only a player entity)
I hope this is detailed enough and if not please tell me what you need. I also know this was causing this since I just removed the
Quote
renderWindow->Draw(sprite);

part and it didn't give the error.

8
Graphics / Problem with creating a renderwindow
« on: June 13, 2011, 06:56:20 pm »
Wow, thanks I still need to get used to c++, I have already caught myself trying to type class name = new class haha.

9
Graphics / Problem with creating a renderwindow
« on: June 13, 2011, 04:52:27 pm »
No I am just using http://www.cplusplus.com/doc/tutorial/ to teach myself.

Also what does my name have to do with me reading a book about c++ haha ?

also thanks for clearing that up

10
Graphics / Problem with creating a renderwindow
« on: June 13, 2011, 04:29:37 pm »
So I am switching from C# to c++, I managed to compile sfml 2.0 and create a renderwindow. Then I wanted to wrap it inside a world class and for some reason it keeps spitting out these errors :

Code: [Select]

c:\users\quincy\sfml-2.0\laurentgomila-sfml-79d5217\include\sfml\window\window.hpp(500): error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'
1>          c:\users\quincy\sfml-2.0\laurentgomila-sfml-79d5217\include\sfml\system\noncopyable.hpp(67) : see declaration of 'sf::NonCopyable::NonCopyable'
1>          c:\users\quincy\sfml-2.0\laurentgomila-sfml-79d5217\include\sfml\system\noncopyable.hpp(42) : see declaration of 'sf::NonCopyable'
1>          This diagnostic occurred in the compiler generated function 'sf::Window::Window(const sf::Window &)'
1>c:\users\quincy\sfml-2.0\laurentgomila-sfml-79d5217\include\sfml\graphics\rendertarget.hpp(304): error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'
1>          c:\users\quincy\sfml-2.0\laurentgomila-sfml-79d5217\include\sfml\system\noncopyable.hpp(67) : see declaration of 'sf::NonCopyable::NonCopyable'
1>          c:\users\quincy\sfml-2.0\laurentgomila-sfml-79d5217\include\sfml\system\noncopyable.hpp(42) : see declaration of 'sf::NonCopyable'
1>          This diagnostic occurred in the compiler generated function 'sf::RenderTarget::RenderTarget(const sf::RenderTarget &)'


Now I have looked at other problems and I am not or at least I think not passing the renderwindow by value anywhere.

My code :

main.cpp
Code: [Select]

//Some includes

int main()
{
World world = World(sf::VideoMode(1280, 1024, 32), "Sfml is finaly set up properly !");

while(world.GetWindow().IsOpened())
{
double frameTime = world.GetWindow().GetFrameTime() / 1000;
std::cout << "Frametime in sec : " << frameTime;
world.Think(frameTime);
world.Draw(frameTime);
}

    return EXIT_SUCCESS;
}


world.cpp / world.h

Code: [Select]

//.h

#pragma once
#include <SFML\Graphics.hpp>
#include <string>

class World
{
private:
sf::RenderWindow RenderWindow;
public:
sf::RenderWindow &GetWindow() {return RenderWindow;}
void Think(double);
void Draw(double);
World(sf::VideoMode, std::string);
~World();
};
//.cpp
#include "World.h"

World::World(sf::VideoMode videoMode, std::string title)
{
RenderWindow.Create(videoMode, title);
}

World::~World()
{

}

void World::Draw(double frameTime)
{
RenderWindow.Clear();

//Do drawing in between

RenderWindow.Display();
}

void World::Think(double frameTime)
{
sf::Event event;
while (RenderWindow.PollEvent(event))
{
// Close window : exit
if (event.Type == sf::Event::Closed)
RenderWindow.Close();
}
}


Also a small c++ question, I thought this :
Code: [Select]

sf::RenderWindow &GetWindow() {return RenderWindow;}


Would give a reference of the window and that I had to access its members with -> but it seems I have to do

Code: [Select]

while(world.GetWindow().IsOpened())


why is that ?

11
DotNet / SFML multiple shaders to RenderImage
« on: May 09, 2011, 05:52:09 pm »
Worked perfectly, thanks again laurent :)

12
DotNet / SFML multiple shaders to RenderImage
« on: May 09, 2011, 09:55:39 am »
I'm trying to implement multiple global shaders so I came up with this :

Code: [Select]

foreach (Shader shader in globalShaders)
{
     Program.renderImage.Draw(new Sprite(Program.renderImage.Image), shader);
}


But for some reason this gives me really strange artifacts and the only way I found to fix this is by copying the image over to another image(which is going to lag since its done every frame and multiple times as there is more then one shader) then clearing the renderImage and then drawing it.

Is there a workaround so I can make this work ?

13
DotNet / PostFX problems
« on: April 18, 2011, 02:07:53 pm »
Ported over to 2.0 it seems to compile good now, now I am trying the most basic shader I can think of :

Code: [Select]

void main()
{
gl_FragColor = gl_Color;
}



Only this shows completely white instead of showing my scene, what am I doing wrong ?

14
DotNet / Port to 2.0 problems
« on: April 18, 2011, 01:31:17 pm »
Thanks for the fast response, both problems are fixed !

15
DotNet / Port to 2.0 problems
« on: April 17, 2011, 11:04:05 pm »
I am porting my code over from 1.6 to 2.0 and I have 2 pretty weird problems.

One :



For some reason at a certain height some of my tiles are getting cut off and then a line is added to the bottom(you can see in the next picture how its normaly)

Two :



Did something change to subrect ? with the exact same animation code that cuts a piece of the image to show the animation it bugs and shows more then needed.

Drawing code
Code: [Select]


        public void DrawSprite(Sprite sprite, Vector2 position, Rectangle subRectangle)
        {
            if (viewPort.Intersects(new Rectangle(position.X - subRectangle.X, position.Y - subRectangle.Y, sprite.Width, sprite.Height)))
            {
                sprite.Position = position - new Vector2(viewPort.X, viewPort.Y);
                sprite.SubRect = new IntRect((int)subRectangle.X, (int)subRectangle.Y, (int)(subRectangle.X + subRectangle.Width), (int)(subRectangle.Y + subRectangle.Height));
                Program.renderImage.Draw(sprite);
            }
        }

Pages: [1] 2 3 4