Ignore:
Timestamp:
Apr 21, 2012, 10:18:11 AM (9 years ago)
Author:
sam
Message:

core: add a simple Array template class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/tutorial/01_triangle.cpp

    r1242 r1243  
    3737    Triangle()
    3838    {
    39         m_vertices[0] = vec2( 0.0,  0.8);
    40         m_vertices[1] = vec2(-0.8, -0.8);
    41         m_vertices[2] = vec2( 0.8, -0.8);
     39        m_vertices += vec2( 0.0,  0.8);
     40        m_vertices += vec2(-0.8, -0.8);
     41        m_vertices += vec2( 0.8, -0.8);
    4242        m_ready = false;
    4343    }
     
    7676            m_vdecl = new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position));
    7777
    78             m_vbo = new VertexBuffer(sizeof(m_vertices));
     78            m_vbo = new VertexBuffer(m_vertices.Bytes());
    7979            void *vertices = m_vbo->Lock(0, 0);
    80             memcpy(vertices, m_vertices, sizeof(m_vertices));
     80            memcpy(vertices, &m_vertices[0], m_vertices.Bytes());
    8181            m_vbo->Unlock();
    8282
     
    9494
    9595private:
    96     vec2 m_vertices[3];
     96    Array<vec2> m_vertices;
    9797    Shader *m_shader;
    9898    ShaderAttrib m_coord;
Note: See TracChangeset for help on using the changeset viewer.