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

Pages: [1] 2 3 ... 16
1
Python / Re: Back and working on restoring pysfml
« on: June 21, 2019, 10:35:11 pm »
I did get the sources from github and pushed a new repo there :
https://framagit.org/Mindiell/python-sfml

I modified source code in order to include PRs from github too.

Now I'll work on a little "how to" in order to let anyone build it, and later I'll focus on next versions of SFML

2
Network / Re: UDP socket not sending packets.
« on: June 21, 2019, 10:16:38 pm »
First of all, can you provide a minimal code showing the problem ?

I'll try it on my own computer ;)

3
General / Re: SFML 2.3.2 compilation
« on: June 19, 2019, 04:16:33 pm »
Ok, finally everything should be fine, compilation has ended without any problem.

But... It seems I don't have any "install" option... Sorry for disturbing everybody here, but it's clearly "not easy" to use :P

Ah, apparently I did a mistake, I have this command in the makefile, my bad...

4
General / Re: SFML 2.3.2 compilation
« on: June 19, 2019, 02:43:55 pm »
If you don't know the basics of CMake, you'll have to look it up.
I'll do that thx :D

5
General / SFML 2.3.2 compilation
« on: June 19, 2019, 02:29:55 pm »
Hi everybody,

I'm trying to compile SFML 2.3.2 in order to compile the python-sfml binding.
My question is that the tuto is quite not explicit : what command should I go with in order to compile SFML ?

I tried cmake ./ but get an error about udev (lib is installed).

PS: I'm on a nearly fresh install on VirtualBox, my aim being to be sure to know how to compile it. Since my laptop has SFML compiled but it was a long (very long) time ago ;)

6
Python / Back and working on restoring pysfml
« on: June 19, 2019, 09:43:07 am »
After nearly 7 years of silence, I'm back :)

And I'll work on restoring pysfml since I now use mainly this fantastic language !

7
Network / What causes an sf::Socket::Error?
« on: October 19, 2010, 11:58:41 am »
and be carfeul not to send too much packets too ;)

8
Network / P2P game with VOIP/Teamspeak?
« on: October 15, 2010, 03:58:34 pm »
I didn't know this kind of "error"...

I did read the paper that this guy is talking about :
- They tested with 6 TCP connections
- They have hte problem when UDP packets are 160 bytes or more

They said :
Quote
In this paper, a single UDP stream with some parameters is dealt with, but we have done the simulations in the case where more than one UDP stream exists and the obtained results are almost the same as shown here, although some UDP streams often affect each other

Quote
From our simulation results, we conclude that, when the real-time applications use UDP as a transport protocol, the best performance can be obtained using small packet sizes at a rather high transmission rate.

Quote
However, it should be noted that packets of small size require a relatively large overhead due to UDP and IP headers. This results in the inefficiency of network use. In this sense, in order to send traffic from real-time applications with good quality, much more bandwidth than that generated by the applications will be required, whereas the quality required is not yet guaranteed.


I really think there is no problem using both a TCP and a UDP stream ;)

9
Graphics / sort program
« on: October 08, 2010, 02:21:01 pm »
You're welcome ;)

10
Graphics / sort program
« on: October 06, 2010, 09:29:30 am »
Wow, I cleaned the code a little, and separate graphic from sorting (like I said you to do) :
Code: [Select]
#include <SFML/Graphics.hpp>
#include <iostream>

class Field
{
public:
   // fill 'm_points'
   void fill(const std::size_t number_of_points)
   {
      m_sorted = false;
      //Creating the points
      for(std::size_t i = 0; i < number_of_points; ++i)
      {
         m_points.push_back(i);
      }
      //Shuffling it
      std::random_shuffle(m_points.begin(), m_points.end());
   }

   //bubble sort
   bool sort()
   {
      bool exit = false;
      for(std::size_t o = this->m_points.size()-1;o > 0; --o)
      {
         for(std::size_t pos = 0; pos < o; ++pos)
         {
            if(this->m_points[pos] < this->m_points[pos+1])
            {
               int tmp_pos = this->m_points[pos];
               this->m_points[pos] = this->m_points[pos+1];
               this->m_points[pos+1] = tmp_pos;
               exit = true;
            }
         }
         if (exit)
         {
            return m_sorted;
         }
      }
      m_sorted = true;
      return m_sorted;
   }

   //bubble sort
   void show_points(sf::RenderWindow& App)
   {
      sf::Shape point(sf::Shape::Circle(0.0, 0.0, 2, sf::Color::Red));
      for(std::size_t i = 0; i < this->m_points.size(); i++)
      {
         point.SetPosition(i, m_points[i]);
         App.Draw(point);
      }
   }

ivate:
   std::vector<int> m_points;
   bool m_sorted;
};

int main()
{
   sf::RenderWindow App;
   sf::Event Event;
   Field fieldContext;
   bool sorting = false;

   App.Create(sf::VideoMode(600, 600), "Bubble sort");

   //Filling the field
   std::cout << "Filling..." << std::endl;
   fieldContext.fill(600);

   //Let's start the app
   while (App.IsOpened())
   {
      //Verifying events
      while (App.GetEvent(Event))
      {
         // Window closed
         if (Event.Type == sf::Event::Closed)
         {
            App.Close();
         }
         //Key pressed
         if (Event.Type == sf::Event::KeyPressed)
         {
            switch (Event.Key.Code)
            {
               case sf::Key::Escape :
                  App.Close();
                  break;
               case sf::Key::S :
                  if (!sorting)
                  {
                     std::cout << "Sorting..." << std::endl;
                     sorting = true;
                  }
                  break;
               default :
                  break;
            }
         }
      }

      //Update objects
      if (sorting)
      {
         sorting = !fieldContext.sort();
         if (sorting == false)
         {
            std::cout << "Sorted !" << std::endl;
         }
      }

      //Clearing screen
      App.Clear();

      //Dessin du test
      fieldContext.show_points(App);

      //Displaying result
      App.Display();
   }

   return EXIT_SUCCESS;
}

11
System / Problem with handling events.
« on: October 05, 2010, 12:50:00 pm »
Quote from: "darekg11"
If keypressed == TRUE quit, it's just for safe because keypressed at the beginning will always be FALSE right?

It's just to avoid multiple keypress ;)

12
General / Re: Incrementing a variable when pushing a button
« on: October 05, 2010, 12:45:50 pm »
Code: [Select]

Bullet bullet[10]; //0 to 9, make 10 bullets
int numberofbullets = 0; // Index to count array of bullets

//Here, you are positionning a bullet
//And incrementing the counter : why not
if(App.GetInput().IsKeyDown(sf::Key::Space))
{
bullet[numberofbullets].SetPosition(ship1);
numberofbullets++;
}

//Here you are drawing from 0 to "numberofbullets" which is one over and very problematic when reaching 10 or more !!!
for(i=0; i <= numberofbullets; i++)
{
bullet[numberofbullets].draw(App);
}
//And here, you are correcting the numberofbullets too late
if (numberofbullets == 10)
{
numberofbullets = 0;
}

Try to draw on paper what you are doing. Verify and block your increment before trying to draw it. Be carful with arrays.

Quick and dirty corrections :
Code: [Select]
//Initialization
std::vector<Bullet> bullets;

//Adding a bullet
if(App.GetInput().IsKeyDown(sf::Key::Space))
{
   bullets.push_back(new Bullet(ship1.GetPosition());
}

/Drawing bullets
for (i=0;i<bullets.size();i++)
{
   App.Draw(bullets[i]);
}

Isn't it more clear like that for example ?

13
Graphics / sort program
« on: October 04, 2010, 12:38:00 pm »
Ok, let's make a little tutorial about how SFML is working...

App.Draw() is displaying the drawable in a buffer screen.
App.Display() invert the screen with the buffer screen, this is the Double-Buffer method. This method permits to draw somewhere without showing it on the screen and flipping buffers in order to draw to the screen very quickly.

What you app does is :
- fill
drawing a shape on the buffer, then display it, then drawing an other shape on the second buffer (being the buffer where everything is drawed now) and flipping the buffers again (only the second is drawed). The buffer is clear and you draw the third shape and display it (only the third now), etc...
- sort
simply flip the buffers
- main
simply flip the buffers again

Example of algo :
Code: [Select]

fill ()
{
  for ()
  {
     App.Draw(); //Drawing each shape on the same buffer
  }

  App.Display(); //Just once a the end of filling
}

sort ()
{
  //Sorting
  //Drawing shapes
  for ()
  {
    App.Draw();
  }
  //Displaying
  App.Display();
}


What you should do : do the graphics things out of the flow of the app. The main loop must draw each frame the shapesand wait for a key in order to sort them...

14
Graphics / Sprite hit area, how to?
« on: October 04, 2010, 12:28:58 pm »
If I were you, I will use a simple "Is my point is in my polygon ?" algorithm. The country beeing the polygon :
Code: [Select]
////////////////////////////////////////////////////////////
/// Check if a point is inside the polygon's area
////////////////////////////////////////////////////////////
template <typename T>
bool sfPoly<T>::Contains(T X, T Y) const
{
    for (unsigned int i=0;i<Coords.size()-2;i+=2)
    {
        if (((Y-Coords[i+1])*(Coords[i+2]-Coords[i]) - (X-Coords[i])*(Coords[i+3]-Coords[i+1]))<0)
        {
            return (false);
        }
    }
    //The last test is special
    unsigned int j = Coords.size();
    if (((Y-Coords[j-1])*(Coords[0]-Coords[j-2]) - (X-Coords[j-2])*(Coords[1]-Coords[j-1]))<0)
    {
        return (false);
    }
    return (true);
}

My function is using a simple Template object (int or float, like Rect of the SFML) and two coordinats of a point to see if this point is inside the polygon.

15
General discussions / Thx for make it!!
« on: October 01, 2010, 03:00:06 pm »
Only one developper, but a lot of users/helpers/wikiers/etc... who are all developpers no ? ;)

Pages: [1] 2 3 ... 16