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

Pages: [1]
1
Graphics / Re: Fill Array with Shapes without using vectors
« on: May 20, 2017, 09:48:10 pm »
Seems like there is no way to install CSFML on Visual Studio or CodeBlock

Visual Studio always return me "cannot open file 'csfml-graphics.lib'"

Is it normal that there is no csfml-xxx-d  dll file ?


EDIT: I finaly succeed to install on CodeBlock, but sfRenderWindow_clear(window, sfBlack); won't work, like if sfBlack wasn't recognize

EDIT2 : I also installed it on visual studio, now working correctly, I'm converting my old c++ code, in c one

2
Graphics / Re: Fill Array with Shapes without using vectors
« on: May 20, 2017, 07:30:43 pm »
Thx for answers

I'll try to use CSFML but unfortunately it's not documented much, on YT or SFML website..

First I'll try to install it

3
Graphics / Fill Array with Shapes without using vectors
« on: May 20, 2017, 05:26:06 pm »
Hello

My question is simple :

I would like to create a matrix of Shapes without using vector or any c++ stuff:

This code crashes :
sf::CircleShape** fillHexMap(int size) {
        sf::CircleShape **hex = NULL;
        hex = (sf::CircleShape **) malloc(size * sizeof(sf::CircleShape*));
        int i, j;

        for (i = 0; i < size; i++)
                hex[i] = (sf::CircleShape *) malloc(size * sizeof(sf::CircleShape));

        for (i = 0; i < size; i++) {
                for (j = 0; j < size; j++) {
                        hex[i][j] = sf::CircleShape::CircleShape(ROWSIZE, 6);
                }
        }

        return hex;
}

//Initialisation would be like but it crashes :

sf::CircleShape** matrix = fillHexMap(SIZE);
 


I just want to create this matrix like I can do for a matrix of int :

int** fillTabMap(int size) {
        int **tab = NULL;
        tab = (int **) malloc(size * sizeof(int*));
        int i, j;

        for (i = 0; i < size; i++)
                tab[i] = (int*)malloc(size * sizeof(int));

        for (i = 0; i < size; i++) {
                for (j = 0; j < size; j++) {
                        tab[i][j] = 0;
                }
        }

        return tab;

}

//Initialisation is and it works :

int** matrix = fillTabMap(SIZE);
 

Thx for help !

Pages: [1]