Changeset 267 for trunk/tests


Ignore:
Timestamp:
06/19/14 19:03:25 (11 years ago)
Author:
epyon
Message:
  • gui::element class now pure data
  • gui::element related code in environment
  • gui shaders use general library mechanism
Location:
trunk/tests/gui_test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/gui_test/gui.frag

    r161 r267  
    22varying vec4 v_color;
    33varying vec2 v_texcoord;
    4 uniform sampler2D tex;
     4uniform sampler2D nv_t_diffuse;
    55 
    66void main(void) {
    7         vec4 texture = texture2D(tex,v_texcoord);
     7        vec4 texture = texture2D(nv_t_diffuse,v_texcoord);
    88        gl_FragColor = v_color * texture;
    99}
  • trunk/tests/gui_test/gui.vert

    r161 r267  
    33attribute vec2 nv_texcoord;
    44attribute vec4 nv_color;
    5 uniform mat4 nv_projection;
     5uniform mat4 nv_m_projection;
    66varying vec4 v_color;
    77varying vec2 v_texcoord;
     
    1010        v_color     = nv_color;
    1111        v_texcoord  = nv_texcoord;
    12         gl_Position = nv_projection * vec4( nv_position.x, nv_position.y, 0.0, 1.0 );
     12        gl_Position = nv_m_projection * vec4( nv_position.x, nv_position.y, 0.0, 1.0 );
    1313}
  • trunk/tests/gui_test/nv_gui_test.cc

    r239 r267  
    1616        void spawn_window();
    1717        void recolor_window();
     18//      void bring_to_front( int i );
    1819        ~application();
    1920protected:
     
    6465                                        switch (event.key.code)
    6566                                        {
     67//                                      case nv::KEY_1      : bring_to_front(0); break;
     68//                                      case nv::KEY_2      : bring_to_front(1); break;
     69//                                      case nv::KEY_3      : bring_to_front(2); break;
     70//                                      case nv::KEY_4      : bring_to_front(3); break;
     71//                                      case nv::KEY_5      : bring_to_front(4); break;
    6672                                        case nv::KEY_N      : spawn_window(); break;
    6773                                        case nv::KEY_K      : kill_window(); break;
     
    8086        glm::ivec2 a( std::rand() % 600, std::rand() % 400 );
    8187        glm::ivec2 b( std::rand() % 200 + 40, std::rand() % 200 + 40 );
    82         nv::gui::element* e = new nv::gui::element( m_guienv, nv::rectangle(a).dim(b) );
     88        nv::gui::element* e = m_guienv->create_element( nullptr, nv::rectangle(a).dim(b) );
    8389        e->set_class( "window" );
    8490        e->set_text("Window "+nv::to_string(m_windows.size()+1) );
    85         m_guienv->add_child( e );
    8691        NV_LOG( nv::LOG_INFO, "Spawn (" << a.x << "," << a.y << "x" << b.x << "," << b.y << ")" );
    8792        m_windows.push_back( e );
     
    9297        if ( m_windows.size() == 0 ) return;
    9398        size_t index = rand() % m_windows.size();
    94         delete m_windows[ index ];
     99        m_guienv->destroy_element( m_windows[index] );
    95100        m_windows.erase( m_windows.begin() + index );
    96101}
     
    102107        delete m_device;
    103108}
     109
     110// void application::bring_to_front( int i )
     111// {
     112//      if ( i >= 0 && i < m_windows.size() )
     113//      {
     114//              m_guienv->bring_to_front( m_windows[i] );
     115//      }
     116// }
    104117
    105118int main(int, char* [])
Note: See TracChangeset for help on using the changeset viewer.