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

Pages: [1]
1
Graphics / Re: 2 sf::RectangleShape memory error
« on: July 18, 2014, 09:35:15 pm »
this is problem only with my knowledge of C++, thats all. i fix it.

3
Graphics / Re: 2 sf::RectangleShape memory error
« on: July 18, 2014, 08:04:38 pm »
program down before i init something, because
#include "board.h"

#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/RectangleShape.hpp>

board::board(sf::RenderWindow *window)
{
    mWindow = window;

//    mBoardBox = new sf::RectangleShape;
    mBoardBox.setSize(sf::Vector2f(((numOfCellsW+1) * margin) + (cellWidth * numOfCellsW),
                                   ((numOfCellsH+1) * margin) + (cellHeight * numOfCellsH)));
    mBoardBox.setPosition(19, 160);
    mBoardBox.setFillColor(sf::Color(187, 173, 160, 255));

//    mCellsBg = new sf::RectangleShape;
//    mCellsBg.setSize(sf::Vector2f(cellWidth, cellHeight));
//    mCellsBg.setFillColor(sf::Color(205, 192, 180, 255));
}

board::~board()
{
}




void board::drawCellsBackground()
{

}

void board::drawBoard()
{
    mWindow->draw(mBoardBox);
//    mWindow->draw(mCellsBg);
}
 

4
Graphics / Re: 2 sf::RectangleShape memory error
« on: July 18, 2014, 07:59:31 pm »
#ifndef BOARD_H
#define BOARD_H

#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics.hpp>

#define numOfCellsH 4
#define numOfCellsW 4
#define cellHeight 128
#define cellWidth 128
#define margin 10

class board
{
public:
    board(sf::RenderWindow* window);
    ~board();
    void drawCellsBackground();
    void drawBoard();


private:
    sf::RenderWindow* mWindow;

    sf::RectangleShape mBoardBox;
    sf::RectangleShape mCellsBg;
};

gdb output :
Code: [Select]

Error in `/home/kachan/work/build-2048-Debug/2048': malloc(): smallbin double linked list corrupted: 0x00000000007b7180 ***

then i try
#ifndef BOARD_H
#define BOARD_H

#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics.hpp>

#define numOfCellsH 4
#define numOfCellsW 4
#define cellHeight 128
#define cellWidth 128
#define margin 10

class board
{
public:
    board(sf::RenderWindow* window);
    ~board();
    void drawCellsBackground();
    void drawBoard();


private:
    sf::RenderWindow* mWindow;

    sf::RectangleShape mBoardBox;
   // sf::RectangleShape mCellsBg;
};
and it works

5
Graphics / 2 sf::RectangleShape memory error
« on: July 18, 2014, 07:43:11 pm »
whe i create 2 sf::RectangleShape in class header, i have memmory error. When i create sf::RectangleShape* i can`t to draw it. How to create 2 independent rectangles?

Pages: [1]