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

Pages: [1]
1
General / Detecting collision direction uncorrect
« on: October 05, 2017, 11:23:17 am »
I have a four FloatRects, that anwser for sprite animation frames collision directions, i initialize it for each frame in Animation.h
ColPointDivide its a integer that equals 10, i use it that the edges do not intersect (up-right,up-left,etc...)
i.e i want to create a FloatRect (Collision box) that little offseting from top to bottom Y points, trying deny edges intersecting
Quote
      *leftRect = FloatRect(
         0,
         R.height / ColPointDivide,
         R.width / 2,
         R.height - R.height / ColPointDivide
      );
      *upRect = FloatRect(R.width / ColPointDivide,
         0,
         R.width - R.width / ColPointDivide,
         R.height / 2);
      *rightRect = FloatRect(R.width / 2, R.height / ColPointDivide, R.width / 2, R.height - R.height / ColPointDivide);
      *downRect = FloatRect(R.width / ColPointDivide, R.height / 2, R.width - R.width / ColPointDivide, R.height / 2);
In code when i want to check collision, i trying this:
(mtv its a SAT mtv, that contains collision depth, like 0,1)
(curColRect its an array vector of FloatRects with size 4, i calling i needed direction, and current animation frame)
Quote
for each (Block bl in m_engine->MapBlocks)
      {
         FloatRect blrect = bl.sprite.getLocalBounds();
         //auto B = bl.sprite.getLocalBounds();
         
         //RectangleShape colupshape(Vector2f(curAnim.Col_up.width,curAnim.Col_up.height));
         //colupshape.setPosition(curAnim.Col_up.left, curAnim.Col_up.top);
      //   m_engine->AddSprite(&colupshape, 0);
         Vector2f mtv;
         if (m_engine->m_math.sat_test(bl.sprite, kidspr, &mtv))
         {
            FloatRect mtvrect(mtv.x, mtv.y, blrect.width-mtv.x, blrect.height-mtv.y);
      //      coutMTV(mtv);
            if (!passed[ColPoint::up])
            {

               if (mtvrect.intersects(curColRect[ColPoint::up].at(curf)))
               {
                  setPos(
                     Vector2f(
                        kidentity->GetX(), bl.sprite.getPosition().y - kidentity->anim.getSprite()->getOrigin().y
                     ));
                  colUP = true;
                  passed[ColPoint::up] = true;
                  
               }
            }

// and that for each direction...
I also setting false all booleans to false above, and its method calling with gameloop some often like drawing, under i setting booleans that wasnt colliding to false
(under code)
(click to show/hide)
(above code)
(click to show/hide)
So, when my sprite with animation collides to a block by up, ALL booleans that anwser for collision (colDOWN,colLEFT,colRIGHT,colUP) are true, but collision was by up point...
I also trying use CurColRect[point][curf].contains(mtv), but this work veery strange, when collision by up, all collision booleans are false, only colLEFT are true, idk why
Please help me, idk what is wrong
I also dont want to use Box2d for its objectives
I use SFML 2.4.2
sat_test method:
(click to show/hide)

2
General / Re: 0xC0000005 when drawing drawable
« on: September 19, 2017, 03:45:28 pm »
Oh, after many tests, i solved it.
Programm was crashing because tmx::MapLoader must be drawn in thread when it created, i created support boolean gamestarted and now creating a map in Engine class, that contains method to rendering.
Or its was because my map was local,
most likely the second

3
General / Re: 0xC0000005 when drawing drawable
« on: September 17, 2017, 05:37:24 pm »
If i understood right, layer 0 size is 1 when crashing (ie it contains map Drawable in it,so that valid i think)
(my layer, not TMX)

4
General / Re: 0xC0000005 when drawing drawable
« on: September 17, 2017, 04:53:16 pm »
This stack trace? (Russia language)
(click to show/hide)
also now it crashes with error 0x00007FFEFD0334BE (ucrtbase.dll) and showing this lines in MapLoaderPrivate.cpp
(idk what)
Quote
for(auto& layer : m_layers)
      rt.draw(layer);
sorry if it wrong call stack, i dont know completly what is it

5
General / 0xC0000005 when drawing drawable
« on: September 17, 2017, 01:41:18 pm »
I have a function AddSprite(Drawable*, unsigned short), that adding Drawable to 2d vector with given layer number(as two parametr)
Its works perfectly, but when i added MapLoader ( its a fallahn`s sfml-tmxloader  MapLoader that extends Drawable) to 0 layer and rendered it, i got 0xC0000005 error, i checked my layers numbers, all fine, map being loaded, i dont think what is wrong, my code below
Quote
tmx::MapLoader map("resources/");
         map.addSearchPath("resources/blocks/");
         
            if (map.load("map.tmx"))
            {
               if (debug) {
                  cout << "map loaded!" << endl;
               }
            }
            else
            {
               if (debug) {
                  cout << "MAP NOT LOADED!" << endl;
               }
            }
            engine->AddSprite(&map, 0);
         //
my rendering code:
Quote
inline void Engine::render()
   {
      while (window.isOpen())
      {
         window.clear();
         for (unsigned int i = 0; i < Engine::layerr.size(); i++)
         {
            for (unsigned int i1 = 0; i1 < Engine::layerr.at(i).size(); i1++)
            {
                  window.draw(*(Engine::layerr.at(i).at(i1)));
            }
         }
         window.display();
      }
   }
(i using multithread rendering, so rendering occurs in another detached thread)
my vector looks like this:
Quote
vector<vector<Drawable*>> layerr
its haves size 1, but i drawing to layer 0(first) and layers being initialized by:
Quote
void Engine::AddLayer(unsigned short layernum)
   {
      vector<Drawable*> tempvector;
      Engine::layerr.push_back(tempvector);
   }
sfml-tmxloader https://github.com/fallahn/sfml-tmxloader is last version
SFML is 2.4.2
Tiled version is 2017.05.26
с++ version is 17 (2017) and visual studio same 2017
i using static SFML,static zlib,x64 architecture and static TMX (TMX_STATIC flag)
sorry for my bad english
Please anybody help me, i dont known what is wrong :(
my map with tsx and textures in archive attached below

6
Network / Re: Sfml network dont work
« on: September 29, 2016, 06:49:48 pm »
yes i tried 31831 , 2000 , 27015 , 19132 all were opened , and not used for other programs

7
Network / Sfml network dont work
« on: September 29, 2016, 02:57:24 pm »
I am trying to use many examples of sfml network, but he dont work, i test .exe in another pc but same problem.Problem is "Failed to bind listener socket to port (port)".Ports are opening for tcp and i trying to code it with tcp.I tryed to use TCP.CPP from sfml examples but it dont work too.Why? Includes are included , visual studio 2015 setting are well...
Sry for english
sfml 2.4
firewall is ok

Pages: [1]
anything