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

Pages: [1]
1
General / Drawing lots of shapes
« on: May 25, 2011, 04:04:24 am »
Do you know of any examples I can check out?

2
General / Drawing lots of shapes
« on: May 24, 2011, 09:32:42 pm »
Is it at all possible that the object instantiated in Projectile() goes out of scope and the pointer is left pointing to nothing?

3
General / Drawing lots of shapes
« on: May 24, 2011, 08:50:46 pm »
Here you go:
Code: [Select]




class Entity{


public:
sf::Sprite mySprite;
sf::Image *myImage;
std::vector<sf::IntRect> &frames;
sf::RenderWindow &myApp;
Vector2 dir;
float speed;

public:
Entity(sf::RenderWindow &app, sf::Image &myImage, std::vector<sf::IntRect> &framesVec, float x, float y, float dirx = 0.0f, float diry = 0.0f)
: myApp(app), frames(framesVec), myImage(&myImage)
{
dir.setXY(dirx,diry);

mySprite.SetImage(myImage);

mySprite.SetPosition(x,y);    

}

void update(float delta){

}




void draw(){
myApp.Draw(mySprite);
}


};


std::vector<Projectile*> entities;

void AddEntity(Projectile *ent){
entities.push_back(ent);
}

class Projectile: public Entity{
public:
Direction direction;
Animator myAnimator;

Projectile(sf::RenderWindow &app, sf::Image *myImage, std::vector<sf::IntRect> &framesVec, float x, float y, Direction DIR)
: Entity(app, *myImage, framesVec, x,  y)  {

speed = 10.0f;

if (DIR == RIGHT)
dir.setXY(speed,0);
else
dir.setXY(-speed,0);

myAnimator.AddNewSequence("start", 0, 0);
myAnimator.AddNewSequence("fly", 1, 3);

myAnimator.PlayAnimation("start","fly");
mySprite.SetSubRect(frames[myAnimator.UpdateAndGetFrame(.0001)]);
AddEntity(this);
}

...


class Character: public Entity{
public:

bool moving;
Direction direction;
const float speed;
const float jumpSpeed;

bool shooting;
bool falling;
bool jumping;
int jumpStartHeight;
int fallStartHeight;
int maxJumpHeight;

Animator myAnimator;

Character(sf::RenderWindow &app, sf::Image &myImage, std::vector<sf::IntRect> &framesVec, float x, float y, float dirx = 0.0f, float diry = 0.0f)
: Entity(app, myImage, framesVec, x,  y,  dirx, diry,  maskr,  maskg,  maskb), speed(120.0f), jumpSpeed(370.0f), maxJumpHeight(140)

...

Character::Shoot(){
Projectile FIRE(myApp, myImage, LoadProjectileFrames(), mySprite.GetPosition().x, mySprite.GetPosition().y, direction);

}


When the new Projectile's Draw() is called, it stops, throws the above error, and doesn't remember anything about the Entity. I am sure the problem is something stupid, but I can't seem to find the problem.

4
General / Drawing lots of shapes
« on: May 24, 2011, 04:36:22 pm »
How do you cycle through your objects and draw/update them in a typical program? I am currently using a std::vector of pointers to Entity objects(a class I wrote) that each have a Draw() and Update() function. However, when I initialize a "bullet" for my game and pass in a reference to the App, the image it will use, and some information regarding its location and animation and then add it to the vector using push_back(*this) (I don't have the code in front of me, so I don't know if I actually used an asterisk there). However, on the first iteration after it is added and Entity.Draw() is called, it throws an error(something about  an "unhandled exception at 0x01290f71"). When I investigated this using the debugger, I found that the object is completely "naked" i.e. none of its variables have been initialized/saved from when the object was created.

5
General / SFML Installation issue
« on: April 12, 2011, 02:38:10 am »
I don't know what that is, so no?

I am sure that everything is working correctly now, but for some reason, when I run the code, my compter slows to a crawl(20% +) CPU usage, and my physical machine makes a high pitched noise. Interestingly, it only makes this noise when the window is in the foreground(when I cover it up, noise stops). The actual window appears to be unresponsive, but I can close the cmd and it closes the whole thing.

6
General / SFML Installation issue
« on: April 12, 2011, 02:08:46 am »
Could the problem be because I was building in debug mode, but using the regular .lib files? I have corrected that problem, and now have a new one:

 The program '[1620] SFML Setup.exe: Native' has exited with code -1072365566 (0xc0150002).

In case it matters, I am running 64 bit windows 7 ultimate with 6 gb of ram. Using SFML 1.6.

Thanks for your time!

7
General / SFML Installation issue
« on: April 11, 2011, 01:46:38 am »
So I instaled SFML(to the best of my ability) and the Window example runs, but slows down my computer dramatically and throws errors like this:

'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Users\Name\Documents\Visual Studio 2010\Projects\SFML Setup\Debug\sfml-system.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb\msvcp90.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb\msvcr90.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\nvoglv32.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0xfd0) has exited with code 0 (0x0).
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll', Cannot find or open the PDB file
'SFML Setup.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file



I think this is a problem with the fact that I am running it on a 64 bit system. What steps do I need to take to get everything working and running correctly?

Pages: [1]
anything