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.


Topics - YellowShadow

Pages: [1]
1
General discussions / Help with VC++ Express 2010
« on: August 17, 2010, 08:42:54 am »
Hey,

I'm using the latest SDK of SFML. I followed this guide http://ggammon.wordpress.com/2010/02/14/compiling-and-running-an-sfml-application-in-visual-studio-2010-rc/ and compiled SFML with VC++ Express 2010 but when I go in and create a project and link to the libraries the linker complains and says it can't find the files.

I setup the include and lib paths and I know the files are there.

Am I doing something wrong?

Thanks,
YellowShadow

2
Graphics / RenderWindow draws white sprites
« on: January 16, 2010, 09:34:21 pm »
How come when I'm drawing sprites on my RenderWindow they come up as white? I'm on Windows, and SFML 1.5.

Any ideas?

Here is some loading and drawing code:
Code: [Select]

void Board::LoadContent()
{
sf::Image boardImage;
boardImage.LoadFromFile("data/board.png");
boardTexture = sf::Sprite(boardImage);
tileSize = boardTexture.GetSize().x / BOARDSIZE;

sf::Image pieceSetImage;
pieceSetImage.LoadFromFile("data/jewels.png");
pieceSet.SetImage(pieceSetImage);
}

void Board::Draw()
{
renderWindow.Draw(boardTexture);
renderWindow.Draw(pieceSet);
}


If anyone could help me that would be great :)

3
General / [C++] Help with classes
« on: January 15, 2010, 02:33:14 am »
I'm trying to write some classes for my game, but I keep running into some stupid errors.

Here is my Board.h file:
Code: [Select]

#ifndef BOARD_H
#define BOARD_H

#define PIECE_WIDTH 65
#define PIECE_HEIGHT 67
#define BOARDSIZE 8

#include <SFML/Graphics.hpp>
#include <list>

enum BoardState { INTERACTIVE, FALLING_JEWELS, SWAPPING_JEWELS };

class Board
{
public:
Board();
Board(sf::Randomizer rand);
~Board();

int TileSize() { return tileSize; }
int CurrentlyMovingPieces;
sf::Vector2f TopLeft;

protected:
int tileSize;
BoardState boardState;
bool isActive;
bool canSwap;

sf::Sprite pieceSet;
sf::Sprite pieceHighlight;
sf::Sprite selectionSprite;
sf::Sprite bonusBarSprite;

//Piece pieceMap[BOARDSIZE][BOARDSIZE];
int mouseTileX, mouseTileY;
//Piece highlighedPiece;
float hilightAlpha;
int currenltyMOvingJewels;
float delayDrop;

float swapAlpha;
//SwapInfo swappingInfo;
bool validateSwap;

bool needToDropJewels;

sf::Randomizer rand;

//std::list<Piece> pieceRemains;
//std::list<Piece> hintPieces;
float hintTimer;
float hintDelay;

int baseScore;
int bonusLevel;
int removedPieces;
float removedPieceCounter;
int nextLevelLimit;
int totalRemovedPieces;
bool aboutToChangeLevel;
int longestChain;

float bonusFlashAlpha;

float timeLeft;
float maxTimeLeft;
float timePerJewel;
float timeReductionSpeed;
float timeLeftCounter;
float noMovesAlpha;

bool populatingPieces;
bool populatePieceCounterX;
bool populatePieceCounterY;
int populatePieceCursorDir;
float delayPerPiece;
};

#endif


and here is my Piece.h file:
Code: [Select]

#ifndef PIECE_H
#define PIECE_H

#include <SFML/Graphics.hpp>
#include "Board.h"

enum Direction { NONE, UP, DOWN, LEFT, RIGHT };
enum Type { YELLOW = 0, BLUE, CYAN, GREEN };

class Piece
{
public:
Piece();
Piece(Board parent);
Piece(Board parent, int x, int y, Type type);

void StartMoving(Direction dir, int howManySlots);
void StartMoving(Direction dir);
void Die();

void Update(float elapsedTime);
void Draw(sf::RenderWindow &App, sf::Color color, sf::Sprite sprite);

private:
sf::Vector2f position;
Type pieceType;
Board parentBoard;

bool moving;
int movedSlots;
bool reportedMove;
Direction movingDir;
float movingCounter;
sf::Vector2f targetPosition;
sf::Vector2f startPosition;
sf::Vector2f moveDirVector;
float movingAccel;

bool isDying;
float deathCounter;
bool readyToGo;
};

#endif


If I uncomment the Piece highlightedPiece in the Board.h file, or add the line:
Code: [Select]
#include "Piece.h" to my Board.H file, I get a ton of compiler errors, I don't know how to fix.

Can anyone help me?

Here is the compiler log when I added
Code: [Select]
#include "Piece.h" and uncommented the Piece highlitedPiece line in my Board.h file:

Quote
1>------ Build started: Project: TreasureHunt, Configuration: Debug Win32 ------
1>Compiling...
1>Board.cpp
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(14) : error C2061: syntax error : identifier 'Board'
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(14) : error C2535: 'Piece::Piece(void)' : member function already defined or declared
1>        c:\dev\treasurehunt\treasurehunt\src\piece.h(13) : see declaration of 'Piece::Piece'
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(15) : error C2061: syntax error : identifier 'Board'
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(15) : error C2535: 'Piece::Piece(void)' : member function already defined or declared
1>        c:\dev\treasurehunt\treasurehunt\src\piece.h(13) : see declaration of 'Piece::Piece'
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(27) : error C2146: syntax error : missing ';' before identifier 'parentBoard'
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\dev\treasurehunt\treasurehunt\src\board.cpp(10) : warning C4482: nonstandard extension used: enum 'BoardState' used in qualified name
1>Main.cpp
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(14) : error C2061: syntax error : identifier 'Board'
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(14) : error C2535: 'Piece::Piece(void)' : member function already defined or declared
1>        c:\dev\treasurehunt\treasurehunt\src\piece.h(13) : see declaration of 'Piece::Piece'
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(15) : error C2061: syntax error : identifier 'Board'
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(15) : error C2535: 'Piece::Piece(void)' : member function already defined or declared
1>        c:\dev\treasurehunt\treasurehunt\src\piece.h(13) : see declaration of 'Piece::Piece'
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(27) : error C2146: syntax error : missing ';' before identifier 'parentBoard'
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\dev\treasurehunt\treasurehunt\src\piece.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>Piece.cpp
1>c:\dev\treasurehunt\treasurehunt\src\board.h(39) : error C2146: syntax error : missing ';' before identifier 'highlighedPiece'
1>c:\dev\treasurehunt\treasurehunt\src\board.h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\dev\treasurehunt\treasurehunt\src\board.h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\dev\treasurehunt\treasurehunt\src\piece.cpp(27) : warning C4482: nonstandard extension used: enum 'Direction' used in qualified name
1>c:\dev\treasurehunt\treasurehunt\src\piece.cpp(37) : warning C4482: nonstandard extension used: enum 'Direction' used in qualified name
1>c:\dev\treasurehunt\treasurehunt\src\piece.cpp(40) : warning C4482: nonstandard extension used: enum 'Direction' used in qualified name
1>c:\dev\treasurehunt\treasurehunt\src\piece.cpp(43) : warning C4482: nonstandard extension used: enum 'Direction' used in qualified name
1>c:\dev\treasurehunt\treasurehunt\src\piece.cpp(46) : warning C4482: nonstandard extension used: enum 'Direction' used in qualified name
1>Generating Code...
1>Build log was saved at "file://c:\Dev\TreasureHunt\TreasureHunt\Obj\Debug\BuildLog.htm"
1>TreasureHunt - 17 error(s), 6 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


If anyone could help me that would be great!
Thanks :)

4
General discussions / Memory Leak?
« on: January 11, 2010, 10:39:55 pm »
I think there is a memory leak in the latest release of SFML. I'm using the CRT Debugging feature to check for memory leaks while debugging the application in Visual C++.

Here is my output:

Quote

'TreasureHunt.exe': Loaded 'C:\Dev\TreasureHunt\TreasureHunt\Build\Debug\TreasureHunt.exe', Symbols loaded.
'TreasureHunt.exe': Loaded 'C:\Windows\System32\ntdll.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\kernel32.dll'
'TreasureHunt.exe': Loaded 'C:\Dev\TreasureHunt\TreasureHunt\Build\Debug\sfml-window-d.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\opengl32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\msvcrt.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\advapi32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\rpcrt4.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\gdi32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\user32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\glu32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\ddraw.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\dciman32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\setupapi.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\oleaut32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\ole32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\dwmapi.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\winmm.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\oleacc.dll'
'TreasureHunt.exe': Loaded 'C:\Dev\TreasureHunt\TreasureHunt\Build\Debug\sfml-system-d.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\msvcp90d.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\msvcr90d.dll'
'TreasureHunt.exe': Loaded 'C:\Dev\TreasureHunt\TreasureHunt\Build\Debug\sfml-graphics-d.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\imm32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\msctf.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\lpk.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\usp10.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\uxtheme.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\atioglxx.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\version.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\ws2_32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\nsi.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\atiadlxx.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\wintrust.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\crypt32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\msasn1.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\userenv.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\secur32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\imagehlp.dll'
Detected memory leaks!
Dumping objects ->
{145} normal block at 0x00116350, 20 bytes long.
 Data: <Pc  Pc  Pc      > 50 63 11 00 50 63 11 00 50 63 11 00 CD CD CD CD
{144} normal block at 0x00116238, 216 bytes long.
 Data: < u              > AC 75 03 10 01 00 00 00 01 00 00 00 00 00 00 00
{143} normal block at 0x001161F8, 4 bytes long.
 Data: <8b  > 38 62 11 00
Object dump complete.
'TreasureHunt.exe': Loaded 'C:\Windows\System32\dinput.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\hid.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\clbcatq.dll'
The program '[5672] TreasureHunt.exe: Native' has exited with code 0 (0x0).


and here is the code I'm using:
Code: [Select]

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

#include <SFML/Graphics.hpp>

int main()
{
_CrtDumpMemoryLeaks();

sf::RenderWindow App(sf::VideoMode(1024, 728, 32), "Treasure Hunt");

sf::Image Image;
if (!Image.LoadFromFile("data/background.png"))
return EXIT_FAILURE;

sf::Sprite Sprite(Image);

while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
}

float ElapsedTime = App.GetFrameTime();

App.Clear();
App.Draw(Sprite);
App.Display();
}

return EXIT_SUCCESS;
}


Just wanted to let you guys know. I don't know if it's in my application or in the actual SFML library, but hopefully a better developer than me can help me :)

5
General / Visual C++ Questions
« on: January 14, 2009, 04:51:14 am »
Hey guys, I recently switched from CodeBlocks and MinGW to Visual C++ Express 2008. But I've been running into some problems with the current code I have.

1. Where do I put the SFML_DYNAMIC macro? The image in the tutorial doesn't show so I don't know where to put it.

2. Right now I'm linking against the static libs so I can get some work done, till I fix issue #1 but when I try to load an image, it says can't be found. I've manually checked to see if that image is there but the program can't find it.

Here is my code so you can see how I'm doing my image loading.

Code: [Select]

#include <iostream>

#include <SFML/Graphics.hpp>

int main()
{
    //Create the window of the application
    sf::RenderWindow App(sf::VideoMode(1024, 728, 32), "GunKnights");

    //Set the frame rate
    App.SetFramerateLimit(60);

    //Ground Image
    sf::Image groundImage;

    //Load the ground image
    if (!groundImage.LoadFromFile("gfx\\maps.png"))
{
std::cout << "Error loading maps.png" << std::endl;
return EXIT_FAILURE;
}

    //Create a ground sprite
    sf::Sprite ground(groundImage);

    //Set the position of the ground image
    //ground.SetPosition(0, App.GetHeight() - ground.GetSize().y);

    bool IsPlaying = true;
    while (App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            //Window closed or escape key pressed : exit
            if ((Event.Type == sf::Event::Closed) ||
                ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)))
            {
                App.Close();
                break;
            }
        }

        if (IsPlaying)
        {
        }

        //Clear the Window
        App.Clear(sf::Color(100, 149, 237, 100));

        //Draw the ground image
        App.Draw(ground);

        App.Display();
    }

    return EXIT_SUCCESS;
}


If anyone can help me fix the following problems, I would really appreciate it!

Thanks,
YellowShadow

6
General / Compile error when writing own class. - HELP!
« on: January 09, 2009, 04:09:48 am »
I'm kinda new to C++ but I love how easy it was for me to get a simple sprite setup and moving with SFML. Now I'm trying to refactor my code so that I take everything related to "player" outside of the int main call and put it in its own class.

So I wrote out my header file and started to write the actual .cpp file when I ran into errors compiling. I don't know what I'm doing wrong.

If anyone would be kind enough to help me or point me the direction of help that would be great.

I have included the header, cpp, and compile log below.

BTW: I'm using SFML-1.4, CodeBlocks with MinGW. I'm also compiling on Windows.

Code: [Select]

#ifndef PLAYER_H
#define PLAYER_h

#include <string>

#include <SFML/Graphics.hpp>

class Player
{
    private:
        std::string name;
        sf::RenderWindow window;
        sf::Vector2 position;
        bool isWalking;

    public:
       Player(std::string name, sf::Vector2 position, sf::RenderWindow window);
       ~Actor();

       void update();
       void draw();

       std::string getName();
       sf::Vector2 getPosition();
};

#endif


Code: [Select]

#include "Player.h"

Player::Player(std::string name, sf::Vector2 position, sf::RenderWindow *window)
    : name(name), position(position), window(window)
{

}

Player::~Player()
{

}

void Player::update()
{

}

void Player::draw()
{

}

std::string Player::getName()
{
    return name;
}

sf::Vector2 Player::getPosition()
{
    return position;
}


Code: [Select]

-------------- Build: Debug in Client ---------------

Compiling: src\main.cpp
Compiling: src\Player.cpp
In file included from C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.cpp:1:
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.h:13: error: using-declaration for non-member at class scope
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.h:13: error: expected `;' before "position"
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.h:17: error: `sf::Vector2' is not a type
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.h:17: error: ISO C++ forbids declaration of `position' with no type
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.h:18: error: expected class-name before '(' token
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.h:24: error: using-declaration for non-member at class scope
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.h:24: error: expected `;' before "getPosition"
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.cpp:3: error: `sf::Vector2' is not a type
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.cpp:4: error: ISO C++ forbids declaration of `position' with no type
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.cpp:4: error: prototype for `Player::Player(std::string, int, sf::RenderWindow*)' does not match any in class `Player'
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.h:9: error: candidates are: Player::Player(const Player&)
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.h:17: error:                 Player::Player(std::string, int, sf::RenderWindow)
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.cpp: In constructor `Player::Player(std::string, int, sf::RenderWindow*)':
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.cpp:4: error: class `Player' does not have any field named `position'
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.cpp: At global scope:
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.cpp:10: error: definition of implicitly-declared `Player::~Player()'
C:\Documents and Settings\Dro\Desktop\GunKnights\client_code\src\Player.cpp:29: error: expected constructor, destructor, or type conversion before "Player"
Process terminated with status 1 (0 minutes, 1 seconds)
15 errors, 0 warnings


Again, thanks in advance to anyone who could help me.

7
General / Loud Fan Noise When Drawing Sprite
« on: January 05, 2009, 07:07:32 am »
Hey guys,

I'm following this tutorial http://www.sfml-dev.org/tutorials/1.3/graphics-sprite.php. I literally copy-pasted the code and changed the line that loads the image to the path of my own image.

Every time I run the "game" my GPU fan starts to spin really fast and the temperature of the video-card goes to the 100's (Celsius).

Is this a bug or am I writing code in a wrong way?

Here are my specs for my GPU (According to GPU-Z):
ATI Radeon HD 4800 Series - My Video Card
Driver Version: ati2mtag 6.14.10.6879 (Catalyst 8.11) / XP

If anyone can help that would be great!

Thanks,
YellowShadow

Pages: [1]
anything