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

Pages: [1]
1
General / Re: CMake error for SFML 2.3.2
« on: February 27, 2016, 07:41:25 pm »
It's done! I used the "ANDROID_NDK"and it worked. Thank you very much!

2
General / Re: CMake error for SFML 2.3.2
« on: February 27, 2016, 05:37:43 pm »
No, I didn't. It happens when I click in Generate.

3
General / Re: CMake error for SFML 2.3.2
« on: February 26, 2016, 08:09:00 pm »
CMake 3.4.3 and I use MinGW (I also have clang installed)

4
General / CMake error for SFML 2.3.2
« on: February 26, 2016, 07:53:14 pm »
Hello!
I'm trying to generate the makefile for SFML 2.3.2 with CMake, but I got this error:

CMake Error at CMakeLists.txt:6 (set):
  Syntax error in cmake code at

    C:/Users/MyUser/Downloads/SFML-2.3.2-sources/SFML-2.3.2/CMakeLists.txt:6

  when parsing string

    C:\Tools\Android\AndroidNDK\android-ndk-r9c

  Invalid escape sequence \T
Call Stack (most recent call first):
  CMakeLists.txt:24 (sfml_set_option)


What is wrong? And how do I fix this?
Thank you.

5
System / Re: Problem using threads
« on: June 20, 2013, 04:07:06 pm »
So at first I must create the block as pointers. Then I can use the delete. So what I did on the block class was just put in the destructor "delete this". In the main code I must declare the object as a pointer. But now I'm getting confused: how do I change the 3rd block of code I showed to you?

The line 144 is the sf::Thread blockThread(&Block::Collision<sf::CircleShape>ball, &blocks);

6
System / Problem using threads
« on: June 20, 2013, 03:30:56 am »
Hello.

I'm making a Breakout game and I'm getting some problems using sf::Threads. I'm trying to launch a thread per block to check if the ball collided with the block. I created in the class Blocks a method with a template.

I think that showing my code is the best way to understand what I'm saying.

The class:

Code: [Select]
class Block
{
public:
// Methods
Block(sf::Vector2f dimension, sf::Vector2f position, sf::Color color);
~Block();
template <class Obj>
void Collision(const Obj &object);

// Atributes
sf::RectangleShape blockShape;
sf::Vector2f blockPosition;
sf::SoundBuffer hitBuffer;
sf::Sound hitSound;
float blockLeft, blockRight, blockTop, blockBottom;
};

The method:

Code: [Select]
template <class Obj> void Block::Collision(const Obj &object)
{
// Collision variable
bool getCollision = false;

// Object borders
float objLeft   = object.getPosition().x - object.getRadius() / 2;
float objRight  = object.getPosition().x + object.getRadius() / 2;
float objTop    = object.getPosition().y - object.getRadius() / 2;
float objBottom = object.getPosition().y + object.getRadius() / 2;

if (objLeft <= blockRight)
getCollision = true;
else if (objRight >= blockLeft)
getCollision = true;
else if (objTop <= blockBottom)
getCollision = true;
else if (objBottom >= blockTop)
getCollision = true;

// Destroy the object in case of collision
if (getCollision)
this->~Block();
}

And the piece of code where I instantiate the blocks:

Code: [Select]
// "Draw" the blocks (vector)
std::vector<Block> blocks;
int row    = 4;
int colums = 15;

float spacement = 2.5f;
for (int i = 0; i < colums; i++)
{
Block block(sf::Vector2f(window.getSize().x / colums, 25), sf::Vector2f(i * window.getSize().x / colums + spacement, 100.f), sf::Color::Blue);
spacement += 2.5f;
blocks.push_back(block);

// Collision threads
sf::Thread blockThread(&Block::Collision<sf::CircleShape>ball, &blocks);
blockThread.launch();
}

The compiler says (line 114, where I create the sf::Thread):
"error: expected primary-expression before '<' token"
"error: expected primary-expression before '>' token"

Grateful for help.

Pages: [1]
anything