コード例 #1
0
void BindablePlatform::init_bindable_platform (int posx, int posy, std::string file_name)
{
    m_pos.x = posx;
    m_pos.y = posy;

    file_name = PIC_STATICS_R + file_name;
    m_image = new Surface (file_name + ".png");
    m_pos.h = m_image->h();
    m_pos.w = m_image->w();
    Analyser analyser;
    analyser.open (file_name + ".col");
    m_collisions_matrix_w = analyser.read_int();
    m_collisions_matrix_h = analyser.read_int();
    m_collisions_matrix = new unsigned int*[m_collisions_matrix_w];
    for (int i = 0; i < m_collisions_matrix_w; i++)
    {
        m_collisions_matrix[i] = new unsigned int[m_collisions_matrix_h];
    }
    for (int j = 0; j < m_collisions_matrix_h; j++)
    {
        for (int i = 0; i < m_collisions_matrix_w; i++)
        {
            m_collisions_matrix[i][j] = analyser.read_int();
        }
    }
    analyser.close();
}
コード例 #2
0
ファイル: ZoneItem.cpp プロジェクト: joetde/SuperBadbar
ZoneItem::ZoneItem (QGraphicsScene *scene, TriggerItem *parent, Analyser &analyser) :
    MyItem (NULL, ""),
    m_parent (parent)
{
    Q_UNUSED (scene);
    int x, y;
    x = analyser.read_int();
    y = analyser.read_int();
    m_width = analyser.read_int() - x;
    m_height = analyser.read_int() - y;
    setItem (addRect (0, 0, m_width, m_height) );
    setPos (x, y);
}