Changeset 1623


Ignore:
Timestamp:
Jul 11, 2012, 1:40:41 AM (8 years ago)
Author:
rez
Message:

updated window frame, borders and cacanvas size

Location:
trunk/tools/neercs/video
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/neercs/video/render.cpp

    r1622 r1623  
    8282float beat_speed = 2.0f;   // speed
    8383/* window variable */
    84 int window_m;              // margin
     84ivec2 border;            // margin
    8585int window_vtx[8];         // vertex array
    86 ivec2 ratio_2d(2,4);       // 2d ratio
     86/* text variable */
     87ivec2 ratio_2d(2,2);       // 2d ratio
    8788ivec2 map_size(256,256);   // texture map size
    8889ivec2 font_size(8,8);      // font size
    89 ivec2 text_size(80,25);    // text size
     90ivec2 text_size(0,0);      // text size
    9091ivec2 blit_top(0,0);       // text blit top position
    9192ivec2 blit_bottom(0,0);    // text blit bottom position
    92 int shell_vtx[8];          // vertex array
    93 float shell_tex[] = {1.0f, 0.96875f, 1.0f, 1.0f, 0.78125f, 1.0f, 0.78125f, 0.96875f};
    9493/* common variable */
    9594float value, angle, radius, scale, speed;
     
    233232}
    234233
    235 int Render::CreateGLWindow()
     234int Render::CreateGLWindow(caca_canvas_t *caca)
    236235{
    237236    screen_size = Video::GetSize();
    238237
    239     window_m = 12 * ratio_2d.x;
     238    border = 12 * ratio_2d;
    240239    window_vtx[0] = font_size.x * ratio_2d.x / 2.0f;
    241240    window_vtx[1] = font_size.y * ratio_2d.y / 2.0f;
     
    246245    window_vtx[6] = -font_size.x * ratio_2d.x / 2.0f;
    247246    window_vtx[7] = font_size.y * ratio_2d.y / 2.0f;
    248     shell_vtx[0] = window_m + 58 * ratio_2d.x;
    249     shell_vtx[1] = window_m + (font_size.y + 1) * ratio_2d.y;
    250     shell_vtx[2] = window_m + 58 * ratio_2d.x;
    251     shell_vtx[3] = window_m + ratio_2d.y;
    252     shell_vtx[4] = window_m + 2 * ratio_2d.x;
    253     shell_vtx[5] = window_m + ratio_2d.y;
    254     shell_vtx[6] = window_m + 2 * ratio_2d.x;
    255     shell_vtx[7] = window_m + (font_size.y + 1) * ratio_2d.y;
    256 
    257     blit_top = ivec2(window_m, window_m + font_size.y * ratio_2d.y) + ratio_2d * 2;
    258     blit_bottom = screen_size - ivec2(window_m * 2, window_m * 2 + font_size.y * ratio_2d.y) + ratio_2d * 2;
    259 
    260     //caca_set_canvas_size(m_caca,20,10);
     247
     248    ivec2 current_size = (screen_size - border * 2);
     249    text_size = current_size / (font_size * ratio_2d);
     250
     251    //border
     252
     253    blit_top = border;
     254    blit_bottom = screen_size - border * 2;
     255
     256    caca_set_canvas_size(caca,text_size.x,text_size.y);
    261257
    262258    InitDraw();
     
    269265    m_pause(false),
    270266    m_polygon(true),
    271     m_shader(true),
     267    m_shader(false),
    272268    m_shader_blur(true),
    273269    m_shader_glow(true),
     
    315311    if (!m_ready)
    316312    {
    317         CreateGLWindow();
     313        CreateGLWindow(m_caca);
    318314        text_render->Init();
    319315        m_ready = true;
     
    400396    glDisable(GL_BLEND);
    401397    glColor3f(1.0f,1.0f,1.0f);
    402     rectangle(window_m,window_m,screen_size.x-53*ratio_2d.x-window_m*2,(font_size.y+2)*ratio_2d.y);
    403     rectangle(screen_size.x-51*ratio_2d.x-window_m,window_m,22*ratio_2d.x,(font_size.y+2)*ratio_2d.y);
    404     rectangle(screen_size.x-27*ratio_2d.x-window_m,window_m,22*ratio_2d.x,(font_size.y+2)*ratio_2d.y);
    405     rectangle(screen_size.x-3*ratio_2d.x-window_m,window_m,3*ratio_2d.x,(font_size.y+2)*ratio_2d.y);
    406     rectangle(window_m,window_m+(font_size.y+2)*ratio_2d.y,2*ratio_2d.x,screen_size.y-(font_size.y+2)*ratio_2d.y-window_m*2);
    407     rectangle(screen_size.x-2*ratio_2d.x-window_m,window_m+(font_size.y+2)*ratio_2d.y,2*ratio_2d.x,screen_size.y-(font_size.y+2)*ratio_2d.y-window_m*2);
    408     rectangle(window_m+2*ratio_2d.x,screen_size.y-ratio_2d.y-window_m,screen_size.x-4*ratio_2d.x-window_m*2,ratio_2d.y);
    409     glColor3f(screen_color.x,screen_color.y,screen_color.z);
    410     rectangle(window_m+2*ratio_2d.x,window_m+ratio_2d.y,56*ratio_2d.x,font_size.y*ratio_2d.y);
    411     rectangle(window_m+60*ratio_2d.x,window_m+2*ratio_2d.y,screen_size.x-115*ratio_2d.x-window_m*2,2*ratio_2d.y);
    412     rectangle(window_m+60*ratio_2d.x,window_m+6*ratio_2d.y,screen_size.x-115*ratio_2d.x-window_m*2,2*ratio_2d.y);
    413     rectangle(screen_size.x-49*ratio_2d.x-window_m,window_m+ratio_2d.y,14*ratio_2d.x,6*ratio_2d.y);
    414     glColor3f(1.0f,1.0f,1.0f);
    415     rectangle(screen_size.x-47*ratio_2d.x-window_m,window_m+2*ratio_2d.y,10*ratio_2d.x,4*ratio_2d.y);
    416     glColor3f(0,0,0);
    417     rectangle(screen_size.x-45*ratio_2d.x-window_m,window_m+3*ratio_2d.y,14*ratio_2d.x,6*ratio_2d.y);
    418     rectangle(screen_size.x-25*ratio_2d.x-window_m,window_m+1*ratio_2d.y,14*ratio_2d.x,6*ratio_2d.y);
    419     glColor3f(screen_color.x,screen_color.y,screen_color.z);
    420     rectangle(screen_size.x-21*ratio_2d.x-window_m,window_m+2*ratio_2d.y,14*ratio_2d.x,7*ratio_2d.y);
    421     glColor3f(1.0f,1.0f,1.0f);
    422     rectangle(screen_size.x-19*ratio_2d.x-window_m,window_m+3*ratio_2d.y,10*ratio_2d.x,5*ratio_2d.y);
    423     rectangle(screen_size.x-16*ratio_2d.x-window_m,screen_size.y-9*ratio_2d.y-window_m,14*ratio_2d.x,8*ratio_2d.y);
    424     glColor3f(screen_color.x,screen_color.y,screen_color.z);
    425     rectangle(screen_size.x-14*ratio_2d.x-window_m,screen_size.y-8*ratio_2d.y-window_m,12*ratio_2d.x,7*ratio_2d.y);
    426     glColor3f(1.0f,1.0f,1.0f);
    427     rectangle(screen_size.x-8*ratio_2d.x-window_m,screen_size.y-8*ratio_2d.y-window_m,8*ratio_2d.x,2*ratio_2d.y);
    428     rectangle(screen_size.x-14*ratio_2d.x-window_m,screen_size.y-5*ratio_2d.y-window_m,4*ratio_2d.x,5*ratio_2d.y);
    429     rectangle(screen_size.x-12*ratio_2d.x-window_m,screen_size.y-7*ratio_2d.y-window_m,2*ratio_2d.x,1*ratio_2d.y);
    430     rectangle(screen_size.x-8*ratio_2d.x-window_m,screen_size.y-5*ratio_2d.y-window_m,4*ratio_2d.x,3*ratio_2d.y);
    431     glEnable(GL_BLEND);
    432     if(m_polygon) glEnable(GL_TEXTURE_2D);
    433     glBlendFunc(GL_ONE, GL_ONE);
    434     glVertexPointer(2, GL_INT, 0, shell_vtx);
    435     glTexCoordPointer(2, GL_FLOAT, 0, shell_tex);
    436     glDrawArrays(GL_QUADS, 0, 4);
     398    rectangle(border.x+ratio_2d.x,border.y,screen_size.x-2*ratio_2d.x-border.x*2,ratio_2d.y);//(font_size.y+2)*ratio_2d.y);
     399    rectangle(border.x,border.y+ratio_2d.y,ratio_2d.x,screen_size.y-ratio_2d.y*2-border.y*2);
     400    rectangle(screen_size.x-ratio_2d.x-border.x,border.y+ratio_2d.y,ratio_2d.x,screen_size.y-2*ratio_2d.y-border.y*2);
     401    rectangle(border.x+ratio_2d.x,screen_size.y-ratio_2d.y-border.y,screen_size.x-2*ratio_2d.x-border.x*2,ratio_2d.y);
    437402    glEnable(GL_BLEND);
    438403}
  • trunk/tools/neercs/video/render.h

    r1588 r1623  
    2121
    2222private:
    23     int CreateGLWindow();
     23    int CreateGLWindow(caca_canvas_t *m_caca);
    2424    int InitDraw();
    2525    void Pause();
Note: See TracChangeset for help on using the changeset viewer.