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

Pages: [1]
1
General / Re: What about memory leaks?
« on: June 03, 2015, 09:27:45 pm »
Yep, I didn't noticed it. So, there is only one thing left - you are not in DEBUG mode.




oh wait i delete that underlined, and after that it show mem leak.


It helps. TY all for replies. Close topic. I dont have any Mem leak in my project :) now im sure.

2
General / Re: What about memory leaks?
« on: June 03, 2015, 07:22:19 pm »
And it won't list leaks because your code hasn't them.

I dont delete objects from vector, so it should be leak there...

And change
#if defined(_DEBUG) && defined(WINDOWS)
to
#ifdef _DEBUG
I'm sure that you have no WINDOWS definition.

It dont work.

Can you type the finally version?

3
Graphics / Re: How Can i draw a simple Concave Shape?
« on: June 03, 2015, 05:55:54 pm »
Yes, I can do it, but i dont have much time to make algoritm for this. Its too late, for my project. Im wonder which algorithm can do that ( i read a lot about triangulation) but its too hard for me, because i can create whatever concave and convex shape(Look in images on first post). So, TY for all replies.

4
General / Re: What about memory leaks?
« on: June 03, 2015, 05:50:16 pm »
Hmm i use this method to detect leaks :

https://msdn.microsoft.com/pl-pl/library/x98tx3cf.aspx

I tried your method, but it didnt list leaks:



#if defined(_DEBUG) && defined(WINDOWS)
int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
tmpFlag |= _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF;  // Check heap alloc and dump mem leaks at exit
_CrtSetDbgFlag(tmpFlag);
assert(!errno);
_crtBreakAlloc = 101; // or //_crtBreakAlloc
#endif
#include <stdlib.h>
#include <crtdbg.h>
#include <vector>
#include <SFML/Graphics.hpp>
using namespace sf;
using namespace std;
class A
{
private:
        int a;
public:
        A(int _a)
        {
                a = _a;
        }
};

int main()
{
        vector <A*> vec;
        A *ob;

        ob = new A(4);
        vec.push_back(ob);
        sf::RenderWindow App(sf::VideoMode(640, 480), "Leak");
        sf::Event zdarzenie;
        while (App.isOpen())
        {

                while (App.pollEvent(zdarzenie))
                {
                        if (zdarzenie.type == Event::Closed || (zdarzenie.type == Event::KeyPressed && zdarzenie.key.code == Keyboard::Escape))
                        {
                                App.close();
                        }
                        App.clear();
                        App.display();
                }
        }

        return 0;
}
 


What do i wrong?

5
Graphics / Re: How Can i draw a simple Concave Shape?
« on: June 03, 2015, 03:40:41 pm »
Yes i know it, but when i tested that GetGlobalBounds, i have my 1st case. I had written collision function, but what i presenting here is unexpected problem ( 2nd case).

So thats why im posting, becasue in practise i received that shown situation.

Its not quite allright for me as user, to receive Collision from normal Shape like Rectangle, when i use ConcaveShape...

So, in the end its not possible to give me that what i expected (on the image)?

6
Graphics / Re: How Can i draw a simple Concave Shape?
« on: June 03, 2015, 02:35:26 pm »
I tested it, and when i try to detect when one object intersect my ConcaveShape, it detect it on the Rectangle Area of My shape... i didnt ttry to rotate shapes.

Its something like this:



7
General / What about memory leaks?
« on: June 03, 2015, 12:40:36 pm »
Hi!

I have problem, with memory leaks.

I created medium project, when I notice that i had many memory leaks...
Iam deallocating all memory, but mem leaks are still.

I try to google it, and I tried with easy example with Creating window.

This code also have memory leaks.

#define CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <SFML/Graphics.hpp>

using namespace sf;
int main()
{
        sf::RenderWindow App(sf::VideoMode(640, 480), "Leak");
        sf::Event zdarzenie;
        while (App.isOpen())
        {

                while (App.pollEvent(zdarzenie))
                {
                        if (zdarzenie.type == Event::Closed || (zdarzenie.type == Event::KeyPressed && zdarzenie.key.code == Keyboard::Escape))
                        {
                                App.close();
                        }
                        App.clear();
                        App.display();
                }
        }
        _CrtDumpMemoryLeaks();
        return 0;
}

 

Mem leaks:

Detected memory leaks!
Dumping objects ->
{211} normal block at 0x042EB718, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{210} normal block at 0x042EB6D0, 8 bytes long.
 Data: <  FR    > DC 91 46 52 00 00 00 00
{209} normal block at 0x042EB650, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{208} normal block at 0x042EB608, 8 bytes long.
 Data: <h FR    > 68 91 46 52 00 00 00 00
{207} normal block at 0x042EB588, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{206} normal block at 0x042EB540, 8 bytes long.
 Data: <h FR    > 68 8E 46 52 00 00 00 00
{205} normal block at 0x042EB4C0, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{204} normal block at 0x042EB478, 8 bytes long.
 Data: <  FR    > F4 8D 46 52 00 00 00 00
{203} normal block at 0x042EB3F8, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{202} normal block at 0x042EB3B0, 8 bytes long.
 Data: <  FR    > F4 8A 46 52 00 00 00 00
{201} normal block at 0x042EB330, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{200} normal block at 0x042EB2E8, 8 bytes long.
 Data: <  FR    > 80 8A 46 52 00 00 00 00
{199} normal block at 0x042EB268, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{198} normal block at 0x042EB220, 8 bytes long.
 Data: <  FR    > 80 87 46 52 00 00 00 00
{197} normal block at 0x042EB1A0, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{196} normal block at 0x042EB158, 8 bytes long.
 Data: <  FR    > 0C 87 46 52 00 00 00 00
{195} normal block at 0x042EB0D8, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{194} normal block at 0x042EB090, 8 bytes long.
 Data: <  FR    > 0C 84 46 52 00 00 00 00
{193} normal block at 0x042EB010, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{192} normal block at 0x042EAFC8, 8 bytes long.
 Data: <  FR    > 98 83 46 52 00 00 00 00
{191} normal block at 0x042EAF48, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{190} normal block at 0x042EAF00, 8 bytes long.
 Data: <  FR    > 98 80 46 52 00 00 00 00
{189} normal block at 0x042EAE80, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{188} normal block at 0x042EAE38, 8 bytes long.
 Data: <$ FR    > 24 80 46 52 00 00 00 00
{187} normal block at 0x042EADB8, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{186} normal block at 0x042EAD70, 8 bytes long.
 Data: <$}FR    > 24 7D 46 52 00 00 00 00
{185} normal block at 0x042EACF0, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{184} normal block at 0x042EACA8, 8 bytes long.
 Data: < |FR    > B0 7C 46 52 00 00 00 00
{183} normal block at 0x042EAC28, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{182} normal block at 0x042EABE0, 8 bytes long.
 Data: < yFR    > B0 79 46 52 00 00 00 00
{181} normal block at 0x042EAB60, 64 bytes long.
 Data: <N   o       J   > 4E 00 00 00 6F 00 00 00 20 00 00 00 4A 00 00 00
{180} normal block at 0x042EAB18, 8 bytes long.
 Data: <<yFR    > 3C 79 46 52 00 00 00 00
{177} normal block at 0x042EA798, 20 bytes long.
 Data: <8r_ 8r_ 8r_     > 38 72 5F 00 38 72 5F 00 38 72 5F 00 01 00 CD CD
{176} normal block at 0x04208D08, 24 bytes long.
 Data: <X               > 58 F6 10 04 FF FF FF FF 00 00 00 00 00 00 00 00
{175} normal block at 0x03E7F7E8, 40 bytes long.
 Data: <  FR            > 20 12 46 52 10 00 00 00 00 00 00 00 00 00 00 00
{173} normal block at 0x005F2D08, 40 bytes long.
 Data: <  FR            > 20 12 46 52 10 00 00 00 00 00 00 00 00 00 00 00
{152} normal block at 0x005F7540, 24 bytes long.
 Data: <xu_             > 78 75 5F 00 FF FF FF FF 00 00 00 00 00 00 00 00
{151} normal block at 0x005F74B0, 24 bytes long.
 Data: < t_             > E8 74 5F 00 FF FF FF FF 00 00 00 00 00 00 00 00
{149} normal block at 0x005F7360, 24 bytes long.
 Data: < s_             > 98 73 5F 00 FF FF FF FF 00 00 00 00 00 00 00 00
{148} normal block at 0x005F72D0, 24 bytes long.
 Data: < s_             > 08 73 5F 00 FF FF FF FF 00 00 00 00 00 00 00 00
{147} normal block at 0x005F7288, 8 bytes long.
 Data: < vFR    > 14 76 46 52 00 00 00 00
{146} normal block at 0x005F7238, 20 bytes long.
 Data: <  .   .   .     > 98 A7 2E 04 98 A7 2E 04 98 A7 2E 04 01 01 CD CD
{145} normal block at 0x005F71F8, 4 bytes long.
 Data: <    > 0D 00 00 00
{144} normal block at 0x005F71B8, 4 bytes long.
 Data: <    > 0C 00 00 00
Object dump complete.
 
I updated my graphic drivers to the latest version, but it didnt help.

My graphic card is RADEON HD 7770.

8
Graphics / Re: How Can i draw a simple Concave Shape?
« on: May 02, 2015, 02:44:17 pm »
wow, thank for fast reply!

I don't quite understand what mean to 'compute bounding rect'? This means to compute the top, right, left and bottom of shape? Can you please explain this ? or give me some example of it?

9
Graphics / How Can i draw a simple Concave Shape?
« on: May 02, 2015, 02:08:05 pm »
Hi!

Firstly, Sorry for my bad english. I have a big problem. I am creating game which look and is like Mamba. My character moves in 4 directions. To create shape, i have X,Y coordinates, and number of points. I need to create shapes which consist only from rectangles. So, some of them will be concave.

        shape.setPointCount(6);
        shape.setPoint(0, sf::Vector2f(60, 60));
        shape.setPoint(1, sf::Vector2f(120, 60));
        shape.setPoint(2, sf::Vector2f(120, 120));
        shape.setPoint(3, sf::Vector2f(200, 120));
        shape.setPoint(4, sf::Vector2f(200, 150));
        shape.setPoint(5, sf::Vector2f(60, 150));
        shape.setPosition(50, 50);
        shape.setOutlineThickness(1);
        shape.setFillColor(Color::Red);
        shape.setOutlineColor(Color::Black);
 

and the result:




SFML not support Concave Shapes, only COnvex, but i read documentation of SFML that TrianglesFan can do it, but not exactly. Not all shapes, can be make from triangles. For Example


or

So, i found, that Thor supports Concave Shapes. Yes, but i have another problem. It not supports GetingGlobalBounds function , which i must use to detect Collision.

Any ideas?  Or algorithm making from these shapes multiple triangles, when we only have coordinates in specific order(0 to 6)?

Pages: [1]