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

Pages: [1]
1
SFML projects / 4 In A Row, Your First SFML game tutorial
« on: August 27, 2009, 02:59:30 am »
I'll certainly use inheritance from drawable in more advanced projects/tutorials, but I think this game would be as simple as it is right now if I inherited from drawable. Or is there something obvious I'm missing? What do you think?

2
SFML projects / 4 In A Row, Your First SFML game tutorial
« on: August 21, 2009, 11:01:59 pm »
Hi thx G.,
What would be the differences and advantages of making the board class inherit from sf::Drawable besides using App.Draw(board) instead of board.draw()?

3
SFML projects / 4 In A Row, Your First SFML game tutorial
« on: August 21, 2009, 08:08:47 pm »
Hi there!!
I've created three new posts in my blog describing how easy is to create SFML games. These are intended for new SFML developers, so I tried to do design the game 4 in a row as simple as possible. Hope you like it.

The tutorial is mostly code-commented, but I added additional comments between code parts. There's place for improvements, so if you think something is worth changing/adding/moving/... don't hesitate and tell it!^^

The three posts are here in a single page.

The first post is here. It includes the same screenshot :P and the links to the sources and the executable (for windows).

A screenshot of the game:


4
Hi forrestcupp,
Nice work!! I think you're gui toolkit is really easy to use, and the included controls are indeed very useful.
However, I don't like that when you resize the window, the gui objects used by the toolkit don't work anymore. They keep using the old coords, so when you try clicking one button when the window has been resized, nothing happens...

I've navigated through your code and I modified the required functions to make it work.

I've create a Vect2f object called mousePos using the new coords with this little line of code in every place you verify the mouse coords:

Code: [Select]
sf::Vector2f mousePos = Parent->ConvertCoords(input->GetMouseX(), input->GetMouseY());

So, Instead of using
Code: [Select]
input->GetMouseX()
input->GetMouseY()

I use :
Code: [Select]
mousePos.x
mousePos.y

For instance, this function:
Code: [Select]
/// Checks to see if mouse pointer is inside control.  Returns true if it is.
bool cpObject::CheckMouseEntered(const sf::Input *input)
{
return (input->GetMouseX() >= PosX && input->GetMouseX() <= PosX+Width &&
input->GetMouseY() >= PosY && input->GetMouseY() <= PosY+Height);
}

translates into:
Code: [Select]
/// Checks to see if mouse pointer is inside control.  Returns true if it is.
bool cpObject::CheckMouseEntered(const sf::Input *input)
{
    sf::Vector2f mousePos = Parent->ConvertCoords(input->GetMouseX(), input->GetMouseY());
return (mousePos.x >= PosX && mousePos.x <= PosX+Width &&
        mousePos.y >= PosY && mousePos.y <= PosY+Height);
}

Hope it helps.

Pages: [1]