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

Pages: [1] 2 3 4
1
System / Re: SFML 2 Randomizer
« on: June 12, 2012, 06:57:12 pm »
Oh...heheh... :o

Thanks for the quick answer Laurent.  :D

2
System / SFML 2 Randomizer
« on: June 11, 2012, 06:08:17 pm »
Hello,
I've used SFML 1.6 for a little while, and when I made the switch to SFML 2, I noticed sf::Randomizer is gone.  Why was it removed?  And is there a new method built into SFML 2 that I could use to get random numbers?

Thanks.

3
Graphics / Re: Trouble with sf::Text
« on: June 03, 2012, 01:45:13 am »
I'll probably just add something like
playerName = new sf::Text(p1Name, data.mainFont, 30);
in the constructor.
Please don't use new unless really necessary. Why can't the sf::Text be an automatic variable?
Without the new, the process continues to run after I close the program window.

4
Graphics / Re: Trouble with sf::Text
« on: June 02, 2012, 05:29:09 pm »
Thanks, mateandmetal.  ;D
I'll probably just add something like
playerName = new sf::Text(p1Name, data.mainFont, 30);
in the constructor.

Does anyone know if Laurent will fix this bug before the official SFML 2 release?  It seems like it will get pretty annoying.  :(

5
Graphics / Trouble with sf::Text
« on: June 01, 2012, 06:39:07 pm »
Hello,
I'm having trouble with the sf::Text class.  Here is part of my code:

// gui.cpp

playerCardGUI::playerCardGUI()
{
    texture.loadFromFile("data\\GUI\\playercard.png");
    texture.setSmooth(false);
    sprite.setTexture(texture);
}

playerCardGUI::~playerCardGUI()
{
}

void playerCardGUI::create(unsigned short int argOwner, NATIONALITY natl, sf::Vector2f pos)
{
    texture.loadFromFile("data\\GUI\\playercard.png");
    texture.setSmooth(false);
    sprite.setTexture(texture);

    playerName.setFont(data.mainFont);
    health.setFont(data.mainFont);
    ammoMag.setFont(data.mainFont);
    ammoTotal.setFont(data.mainFont);

    playerName.setString("Name");

    owner = argOwner;

    if(natl == US)
        txNational.loadFromFile("data\\GUI\\ally_US.png");
    else if(natl == GR)
        txNational.loadFromFile("data\\GUI\\axis_GR.png");

    sprite.setPosition(pos);
    playerName.setPosition(pos);
}

void playerCardGUI::update(int HP, int ammo, int totalAmmo)
{
    std::stringstream stream;

    stream << HP;
    health.setString(stream.str());

    stream.clear();
    stream << ammo;
    ammoMag.setString(stream.str());

    stream.clear();
    stream << totalAmmo;
    ammoTotal.setString(stream.str());
}

void playerCardGUI::draw()
{
}
// gui.h
#ifndef GUI_H
#define GUI_H

class playerCardGUI
{
    private:
        // graphics variables
        sf::Sprite sprite;
        sf::Texture texture;
        sf::Sprite spClass, spNational;
        sf::Texture txClass, txNational;

        // text variables
        sf::Text playerName;
        sf::Text health;
        sf::Text ammoMag, ammoTotal;

        // misc variables
        unsigned short int owner;
    public:
        playerCardGUI();
        ~playerCardGUI();
        void create(unsigned short int argOwner, NATIONALITY natl, sf::Vector2f pos);

        void update(int HP, int ammo, int totalAmmo);
        void draw();

    friend class Player;
};

#endif // GUI_H

Specifically, the issue is with playerName.  When I try to compile this, it works fine-- until I close the main program window.  Then the process continues to run until I manually end it using the Windows Task Manager.

I don't see anything wrong with my code.  Does anyone else see anything wrong?
Thanks in advance.

6
Graphics / Re: Is there a way to rotate sf::Rects?
« on: May 15, 2012, 04:27:38 pm »
I'm using SFML 2, so would I use a vertex array and the getBounds() function?

7
Graphics / Is there a way to rotate sf::Rects?
« on: May 15, 2012, 01:11:22 am »
Hello,
I'm developing a World War II shooter.  Look at this screenshot:

The red line represents where the bullet of the rifle will go.  Due to low FPS when trying an actual bullet approach, I've gone with a hitscan approach.
Here is where the problem comes in: I don't want my bullet to go through solid blocks.  The first step in coding this is to find where the bullet will actually go.  My typical method of collision detection (create rects of the 2 objects that might collide, compare their edges) won't work, since I'm dealing with a line (actually a thin, rotated sf::RectangeShape, but anyways), not a box.  What I need is a way to rotate a sf::Rect so it would fit the profile of the line.
Is there a way to do this?  Other solutions are also appreciated.  :)

8
Hello,
Is there a function (in SFML 2) that will allow me to maximize/resize my window without changing how big the sprites look onscreen?

Thanks in advance. 

9
General discussions / Re: SFML 2.0 RC
« on: April 18, 2012, 04:46:36 pm »
SFML 2!?


10
SFML projects / Re: 2dCraft (Minecraft 2d port)
« on: April 13, 2012, 05:21:29 pm »
Looking good!  :)
Though here's a list of a couple of bugs I've found:
  • When you run too far against a block, you can't jump
  • Block placement/destruction is a little off the mouse (usually 1 block below where my cursor is)
Keep up the good work!  Looks very good so far.   ;D

11
General / Re: Can't understand CMake tutorial for SFML 2
« on: April 12, 2012, 06:35:05 pm »
I suppose I'll just wait for the RC then  :D  Is there a set date for when it will come out?

12
General / Can't understand CMake tutorial for SFML 2
« on: April 12, 2012, 05:36:14 pm »
Excuse me if I'm incompetent.
I'm fairly new to C++, and after using SFML 1.6 for a while, I've decided to try out SFML 2 (my algorithms weren't very efficient which lead to poor performance, and I'm hoping SFML 2 will run a bit better).  Thing is, I don't understand the CMake tutorial.  At all.

If you need my computer information, I wish to use SFML 2 with the MinGW compiler on Code::Blocks, and my computer OS is Windows 7.

To start off:
How exactly do I run CMake-gui?  I can't find an .exe file anywhere.

13
SFML projects / Re: Fireteam
« on: April 09, 2012, 08:18:26 pm »
Oops.   :o  I'll convert it to SFML 2, can someone give me a list of what's different between 1.6 and 2?

14
Graphics / Re: Blurry sprites?
« on: April 06, 2012, 06:39:34 pm »
Ah.  Thank you.

15
Graphics / Blurry sprites?
« on: April 06, 2012, 05:02:10 pm »
Hello,
Using SFML I've noticed my sprites end up blurry.  For example, this is my source .png file:
http://us.fotolog.com/chuckleluck/124000000000004931/
This is the sprite, assembled in my SFML program:
http://us.fotolog.com/chuckleluck/124000000000004932/?share=1
As you can see, the edges are blurry.  Is there a way to disable this feature?  I want my program to be pixel-perfect.

Pages: [1] 2 3 4
anything