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 - Paki Programmer

Pages: 1 [2] 3
16
General discussions / Re: SFML 2.0 RC
« on: May 03, 2012, 12:31:48 am »
Actually i found that to be true too...that exact line of code seemed to slow down my computer

17
Graphics / 2.0 RC sf::Text bug
« on: May 03, 2012, 12:06:43 am »
When using sf::Text, there seems to be a bug where the letters of the string seem to be surrounded by a light blue outline. I took a screen print to show you what i mean. Any clues why this is happening or how to fix it? Or is it really just a bug in the API?



[attachment deleted by admin]

18
General / Entity System Not Working Right
« on: February 07, 2012, 12:26:59 am »
Never mind guys...i fixed it :) just had to make some pointers

19
General / Entity System Not Working Right
« on: February 06, 2012, 11:18:43 pm »
So in the game that I'm working on at the moment, I've encountered a small bug that i can't seem to fix. I set up the beginning of my entity system to keep track of all the objects in the game and update them accordingly. It works fine for now except for the fact that it doesn't render them to the screen as it is suppose to. It renders the white shape of the sprite instead of the actual image with it.

Here's some of the code for it. If you need more let me know and ill post it.

//Entity Manager

Code: [Select]


#include "Manager.h"
#include "engine.h"

Manager cManager;

void Manager::Update()
{
this -> iter = this -> entities.begin();

Object object;

while (this -> iter != this -> entities.end())
{
object = *iter;

cEngine.cWindow.Draw(object.Sprite);

iter++;
}
}

void Manager::Add(Object object)
{
this -> entities.push_back(object);
}




//Game.cpp

Code: [Select]


#include "Game.h"
#include "Manager.h"
#include "engine.h"

Game cGame;

void Game::Game_Init()
{
Character player;
player.Create("ball.bmp", 200, 200, 45, 45);

cManager.Add(player);
}

void Game::Game_Run()
{
cEngine.cWindow.Clear();
cManager.Update();
cEngine.cWindow.Display();
}



//Character.pp

Code: [Select]


#include "Object.h"
#include "engine.h"

int Character::Create(std::string filename, float x, float y, int width, int height)
{
if (!this -> Image.LoadFromFile(filename.c_str()))
{
return 0;
}

this -> Image.CreateMaskFromColor(sf::Color(255, 0, 255));

this -> Sprite.SetImage(this -> Image);
this -> Sprite.Resize(width, height);
this -> Sprite.SetPosition(x, y);

this -> PosX = this -> Sprite.GetPosition().x;
this -> PosY = this -> Sprite.GetPosition().y;

this -> Rect.Left = this -> PosX;
this -> Rect.Top = this -> PosY;
this -> Rect.Width = width;
this -> Rect.Height = height;

return 1;
}


20
General / Unhandled Exception
« on: January 27, 2012, 02:46:38 am »
I dont know what im doing wrong but for some reason I keep getting an unhandled exception my my entity manager. I try to draw the sprite to the screen and right before the entity manager updates and trys to draw it everything is fine. But as soon as it attempts to draw the sprite i get an exception. Here's the code. Can someone please help me ? This is driving me nuts :( if you need the whole project just let me know and ill email it to you

//Game.cpp

Code: [Select]

#include "EntityManager.h"

void System::Init()
{
engine = new System();

engine -> SetWindow(800, 600, "Test");

Entity player;
player.Load("test.png", 100, 100);

manager.Add(player);
}

void System::Run()
{
sf::Event ev;

while (engine -> window -> IsOpened())
{
engine -> window -> PollEvent(ev);


engine -> window -> Clear();
manager.Update();
engine -> window -> Display();
}
}


//System.cpp

Code: [Select]

#include "System.h"

void System::SetScreenDim(int width, int height)
{
this -> SCREENW = width;
this -> SCREENH = height;
}

void System::SetTitle(std::string title)
{
this -> Title = title;
}

void System::SetWindow(int width, int height, std::string title)
{
this -> SCREENW = width;
this -> SCREENH = height;
this -> window = new sf::RenderWindow(sf::VideoMode(width, height), title.c_str());
}


//EntityManager.cpp

Code: [Select]

#include "EntityManager.h"
#include "System.h"

void Manager::Update()
{
Entity entity;

std::list<Entity>::iterator iter = eList.begin();

while (iter != eList.end())
{
entity = *iter;

entity.GetSprite().SetPosition(entity.GetX(), entity.GetY());

engine -> window -> Draw(entity.GetSprite());

iter++;
}
}

void Manager::Add(Entity entity)
{
eList.push_back(entity);
}


//Entity.cpp

Code: [Select]

#include "Entity.h"

void Entity::Load(std::string filename, float x, float y)
{
this -> Filename = filename;

this -> Image.LoadFromFile(this -> Filename.c_str());
this -> Sprite.SetImage(this -> Image);

this -> posx = x;
this -> posy = y;
}

void Entity::Update()
{
this -> Sprite.SetPosition(this -> posx, this -> posy);
}
[/code]

21
General / Noncopyable Error
« on: January 26, 2012, 11:36:59 pm »
never mind guys i managed to fix it :)

22
General / Noncopyable Error
« on: January 26, 2012, 11:22:45 pm »
Ive looked around on other forums and this one and i think im certain that im trying to copy the sf::RenderWindow window that i made for my game engine...and according to what i've found that's not possible. I suppose i have to make a pointer to the window or a reference but since im still fairly rusty with programming (haven't used C++ for a while) i dont know how to go about doing this. Here are the two parts of my code i think are causing the trouble. Any idea how i can go about creating a reference or pointer to the render window ?


Code: [Select]

sf::RenderWindow System::SetWindow(int width, int height, std::string title)
{
sf::RenderWindow *ref = new sf::RenderWindow();
sf::RenderWindow w(sf::VideoMode(width, height), title.c_str());

ref = &w;

return *ref;
}


Code: [Select]

void System::Init()
{
engine = new System();
window = new sf::RenderWindow();

engine -> window = &engine -> SetWindow(800, 600, "Test");
}


And also here is the error i keep getting:

    Error   1   error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'   c:\program files\sfml 2.0\include\sfml\window\window.hpp   479


    Error   2   error C2248: 'sf::NonCopyable::NonCopyable' : cannot access private member declared in class 'sf::NonCopyable'   c:\program files\sfml 2.0\include\sfml\graphics\rendertarget.hpp   304


23
General discussions / SFML 2.0
« on: January 23, 2012, 01:15:24 am »
lol well that's reassuring :) i was just wondering because i already use 2.0...i was just curious as to when it will become more widely and easily accessible than it is now :p

24
General discussions / SFML 2.0
« on: January 23, 2012, 12:59:32 am »
Just a question...when is the official version of SFML 2.0 going to come out?

25
General / Buffer overload in release build
« on: February 24, 2011, 10:00:17 pm »
Code: [Select]
#include <SFML/Graphics.hpp>
#include <cstdlib>


int main()
{
sf::RenderWindow game(sf::VideoMode(1000, 700, 32), "Pong!");

//Images/Loading
sf::Image Ball;
sf::Image LeftPaddle;
sf::Image RightPaddle;
sf::Image Background;
sf::Image Gameover;

LeftPaddle.LoadFromFile("Leftpaddle.png");
RightPaddle.LoadFromFile("Rightpaddle.png");
Ball.LoadFromFile("PongBall.png");
Background.LoadFromFile("background.png");
Gameover.LoadFromFile("gameover.png");

//Sprites
sf::Sprite leftpaddle;
sf::Sprite rightpaddle;
sf::Sprite ball;
sf::Sprite background;
sf::Sprite gameover;

ball.SetImage(Ball);
leftpaddle.SetImage(LeftPaddle);
rightpaddle.SetImage(RightPaddle);
background.SetImage(Background);
gameover.SetImage(Gameover);

Ball.CreateMaskFromColor(sf::Color(255, 0, 255, 255));
LeftPaddle.CreateMaskFromColor(sf::Color(255, 255, 255, 255));
RightPaddle.CreateMaskFromColor(sf::Color(255, 255, 255, 255));

ball.SetPosition(500, 350);
leftpaddle.SetPosition(0, 250);
rightpaddle.SetPosition(1000 - RightPaddle.GetWidth(), 250);
background.SetPosition(250, 200);


//Ball Movement
float move_x = -1.5;
float move_y = 0;


sf::Event close;

while (game.IsOpened())
{
game.GetEvent(close);

if (close.Type == sf::Event::Closed)
{
game.Close();
}

if (game.GetInput().IsKeyDown(sf::Key::Escape))
{
game.Close();
}


//Collision for everything
float ballX = ball.GetPosition().x;
float ballY = ball.GetPosition().y;
float leftPaddleX = leftpaddle.GetPosition().x;
float leftPaddleY = leftpaddle.GetPosition().y;
float rightPaddleX = rightpaddle.GetPosition().x;
float rightPaddleY = rightpaddle.GetPosition().y;

sf::IntRect ballcollision = ball.GetSubRect();
sf::IntRect leftPaddleCol = leftpaddle.GetSubRect();
sf::IntRect rightPaddleCol = rightpaddle.GetSubRect();

ballcollision.Offset(ballX, ballY);
leftPaddleCol.Offset(leftPaddleX, leftPaddleY);
rightPaddleCol.Offset(rightPaddleX, rightPaddleY);


//Ball Movement
ball.Move(move_x, move_y);


//Left Paddle Controls
if (game.GetInput().IsKeyDown(sf::Key::W))
{
leftpaddle.Move(0, -1);
}

if (game.GetInput().IsKeyDown(sf::Key::S))
{
leftpaddle.Move(0, 1);
}

//Right Paddle Controls
if (game.GetInput().IsKeyDown(sf::Key::Up))
{
rightpaddle.Move(0, -1);
}

if (game.GetInput().IsKeyDown(sf::Key::Down))
{
rightpaddle.Move(0, 1);
}


//Left Paddle Collision
if (leftPaddleCol.Top < 0)
{
leftpaddle.SetY(0);
}

if (leftPaddleCol.Bottom > 700)
{
leftpaddle.SetY(700 - LeftPaddle.GetHeight());
}


//Right Paddle Collision
if (rightPaddleCol.Top < 0)
{
rightpaddle.SetY(0);
}

if (rightPaddleCol.Bottom > 700)
{
rightpaddle.SetY(700 - RightPaddle.GetHeight());
}


//Ball Collision
if (ballcollision.Intersects(leftPaddleCol) && move_x < 0.0f)
{
move_x = -move_x;
move_y = move_y == 0.0f ? -1.5 : move_y;
}

if (ballcollision.Intersects(rightPaddleCol) && move_x > 0.0f)
{
move_x = -move_x;
move_y = move_y == 0.0f ? -1.5 : move_y;
}

if (ballcollision.Bottom > 700)
{
move_y = -1.5;
}

if (ballcollision.Top < 0)
{
move_y = 1.5;
}

if (ballcollision.Left < 0)
{
gameover.SetPosition(250, 200);
game.Draw(gameover);
game.Display();
sf::Sleep(3);
return EXIT_SUCCESS;
}

if (ballcollision.Right > 1000)
{
gameover.SetPosition(250, 200);
game.Draw(gameover);
game.Display();
sf::Sleep(3);
return EXIT_SUCCESS;
}




game.Clear();
game.Draw(background);
game.Draw(ball);
game.Draw(leftpaddle);
game.Draw(rightpaddle);
game.Display();
}




return EXIT_SUCCESS;
}


and here are the errors i get:

Code: [Select]
'Paki Pong.exe': Loaded 'C:\Users\Danielle\Documents\Visual Studio 2010\Projects\Paki Pong\Release\Paki Pong.exe', Symbols loaded.
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Users\Danielle\Documents\Visual Studio 2010\Projects\Paki Pong\sfml-system.dll', Cannot find or open the PDB file
'Paki Pong.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
'Paki Pong.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
'Paki Pong.exe': Loaded 'C:\Users\Danielle\Documents\Visual Studio 2010\Projects\Paki Pong\sfml-window.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Users\Danielle\Documents\Visual Studio 2010\Projects\Paki Pong\sfml-graphics.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\msvcp100.dll', Symbols loaded.
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Symbols loaded.
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Program Files (x86)\Common Files\Motive\McciContextHook_DSR.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Program Files (x86)\Common Files\microsoft shared\ink\tiptsf.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\atioglxx.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\atiadlxy.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\oleacc.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll', Cannot find or open the PDB file
'Paki Pong.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Cannot find or open the PDB file
First-chance exception at 0x70760149 in Paki Pong.exe: 0xC0000005: Access violation reading location 0x64646170.
A buffer overrun has occurred in Paki Pong.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

For more details please see Help topic 'How to debug Buffer Overrun Issues'.
The program '[1216] Paki Pong.exe: Native' has exited with code 0 (0x0).

26
General / Buffer overload in release build
« on: February 24, 2011, 05:02:48 pm »
i followed the tutorial and linked the right libraries but it still gives me the buffer overrun warning

27
General / Buffer overload in release build
« on: February 24, 2011, 12:52:01 pm »
im pretty sure that im linking to the right libs. could you explain to me how to recompile everything and how to set up the right library?

28
General / Buffer overload in release build
« on: February 24, 2011, 04:40:13 am »
For some reason on my version of VC++ 2010 i cant create a release build. I keep gettin a buffer overrun error. What could be the problem? I linked my libs fine because i can run it in debug.

29
General / I dont have the Clear() function :(
« on: February 17, 2011, 10:42:31 pm »
well actually i know how to do it...i was just wondering if i had to do it everytime lol. but that sucks -__-

30
General / I dont have the Clear() function :(
« on: February 17, 2011, 10:28:14 pm »
yeah you were right lol my mistake. But now i have another question. Do i have to link VC++ to SFML everytime i make a new project???

Pages: 1 [2] 3
anything