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

Pages: [1]
1
SFML projects / Re: Looking for a newby partner(s)
« on: July 14, 2012, 12:04:10 am »
PM sended, waiting for reply  :)

2
Graphics / Re: Problem Moving Shapes on 'Large' Locations
« on: July 11, 2012, 09:32:17 pm »
If the RS is a pointer you shouldn't use "->" instead of "."?
sf::ShapeRectangle * RS;
RS = new sf::ShapeRectangle[n];
RS[0]->move(MOVX, MOXY);
RS[0]->getPosition().x;
RS[0]->getPosition().y;
// do someting else
delete [] RS;
n - some unsigned int value

Edit: Oops, I forget about it. I am accustomed to object-oriented programming, when most of variables are components of class and delete part is, in most cases, in destructor. Sorry for oversight

3
SFML projects / Re: Looking for a newby partner(s)
« on: July 11, 2012, 09:24:04 pm »
Hmm... maybe... I'll think about it and then I'll send you PM or write post here

4
General / Re: Basic inventory tutorial (SFML-1.6)
« on: July 11, 2012, 08:06:46 pm »
I think you could use switch construction instead of if in 3rd code example.
int InventoryAdd(int ItemID)
{
            int x = 0;
            int y = 0;
            for (int i = 0; i < 49; i++)
            {
                if(Slot[i] == 0)
                {
                switch (i)
                {
                     case 0: x = 55; y = 210; break;
                     case 1: x = 95; y = 210; break;
                       // .......
                      // etc.

                  }
                  switch (ItemID)
                  {
                   case 1: // do something
                      break;
                   // etc.
                }
            }
}
It would be clearer and the program doesn't have to check every single case. When it find the correct case it would do what do you want and break the checking. I think you might pack all that functions and variables to some class (i. e. Inventory or something).

5
Graphics / Re: How to detect OnScreen Sprites when using views?
« on: July 10, 2012, 10:52:32 am »
It works bad, because you are checking sprite's position depending on starting view, when left upper corner is (0, 0). You should check position depending on the current view, not starting. I think you should use sf::RenderWindow::convertCoords(...) to convert sprite's position to local, depending on current view and then check if the sprite is currently on the screen. I'm not sure, because I didn't use sf::View yet, but I think here's your problem. Read the tutorial about sf::View to make sure or search the documentation.

Edit: Oops... It was small fault in bbcode... Sorry for that

Pages: [1]