Пример #1
0
void  cDraw::Draw_Border(int x, int y, int w, int h, int s, D3DCOLOR Color, IDirect3DDevice9* mDevice)
{
	Draw_Box(x, y, s, h, Color, mDevice);
	Draw_Box(x, y + h, w, s, Color, mDevice);
	Draw_Box(x, y, w, s, Color, mDevice);
	Draw_Box(x + w, y, s, h + s, Color, mDevice);
}
Пример #2
0
void Alph_In(int *num, int max_len, int x, int y, alph *font) {
int column, index, c;
int *columns;
char temp;
unsigned char far **source;

  *num=0;
  columns=new int [max_len];
  max_len--;
  index=0;
  columns[index]=x;
  while ((temp=getch())!=13) {  // 13=enter
    if (temp==27) { // 27=esc. Clear line.
      Draw_Box(x,y,columns[index]-x,font->height,255);
      index=0;
      columns[index]=x;
    } else if (temp==8) { // 8=backspace
      index--;
      if (index<0) index=0;
      Draw_Box(columns[index],y,columns[index+1]-columns[index],font->height,255);
    } else if (index<=max_len) {
      if ((temp>='0')&&(temp<='9'))
        if ((*num*10)<(MAXINT-10)) {
          source=font->numbers[temp-'0'];
          for (c=0;c<font->height;c++)
            _fmemcpy(&screen[columns[index]+((y+c)<<8)+((y+c)<<6)],&source[c][1],source[c][0]);
          columns[index+1]=columns[index]+source[0][0]+1;
          *num=*num*10+temp-'0';
          index++;
        }
    }
  }
  delete columns;
}
Пример #3
0
void cDraw::Engine_Scroll(int x, int y, int  &studio, char **typ, int max, LPSTR text, IDirect3DDevice9* pDevice)
{
	if (IsInBox(x + 128, y, 266, 20))
		Draw_Border(x + 130, y, 265, 20, 1, ForestGreen, pDevice);

	Draw_Border(x + 303, y + 2, 18, 15, 2, ForestGreen, pDevice);
	Draw_Box(x + 306, y + 5, 14, 11, ForestGreen, pDevice);
	Draw_Text(x + 314, y + 3, AliceBlue, "<", C_Text);

	Draw_Border(x + 374, y + 2, 18, 15, 2, ForestGreen, pDevice);
	Draw_Box(x + 377, y + 5, 14, 11, ForestGreen, pDevice);
	Draw_Text(x + 385, y + 3, AliceBlue, ">", C_Text);

	if (IsInBox(x + 374, y + 2, 18, 15) && (State_Key(VK_LBUTTON, 1000)))
	{
		if (studio >= 0 && studio<max)
		{
			studio++;
		}
	}

	if (IsInBox(x + 306, y + 2, 18, 15) && (State_Key(VK_LBUTTON, 1000)))
	{
		if (studio != 0)
		{
			studio--;
		}
	}
	Draw_Text(x + 350, y + 3, AliceBlue, typ[studio], C_Text);
	Draw_Text(x + 135, y + 2, AliceBlue, text, L_Text);
}
Пример #4
0
//---------------------------------------------------------
void CDLG_Colors_Control::On_Paint(wxPaintEvent &event)
{
	wxPaintDC	dc(this);

	Draw_Edge(dc, EDGE_STYLE_STATIC, wxRect(wxPoint(0, 0), GetClientSize()));

	Draw_Box(dc, 0);
	Draw_Box(dc, 1);
	Draw_Box(dc, 2);
	Draw_Box(dc, 3);
	Draw_Box(dc, 4);
}
Пример #5
0
int
main(void)
 {
     char * str ="Hello Cursor\n";
     Display_Message(10,10,str);
     //Display_Cursor();
     //Hide_Cursor();
     //Clear_All_Display();
     //Clear_Screen();
     //Display_Message(24,20,str);
     //Move_Cursor(40,20);
     Draw_Box(20,40,10,20);
     return EXIT_SUCCESS;
 }
Пример #6
0
void Init_Time()
{
    char sMessage[250];
    char sDate[15];
    
    memset(sDate,0,sizeof(sDate));
    get_time(sDate);
    memset(sMessage,0,sizeof(sMessage));
    if( giSleep== 0 )
      sprintf(sMessage,"日期:%4.4s-%2.2s-%2.2s %2.2s:%2.2s:%2.2s          交易监控系统          P-上页 N-下页 R-刷新 Q-退出 ",
                sDate,sDate+4,sDate+6,sDate+8,sDate+10,sDate+12);
    else
         sprintf(sMessage,"日期:%4.4s-%2.2s-%2.2s %2.2s:%2.2s:%2.2s          交易监控系统          当前刷新频率:%d秒  退出:CTRL+C ",
                 sDate,sDate+4,sDate+6,sDate+8,sDate+10,sDate+12,giSleep);
    routine_text_out(0,7,sMessage, 0);
    Draw_Box(1,0,LINES-1,COLS-1);
    memset(sMessage,0,sizeof(sMessage));
    sprintf(sMessage,SHOW_FORMAT,SHOW_TITLE);
    routine_text_out(2,2,sMessage,nPosOffset);
}
Пример #7
0
void redraw (void)
{
  int v;

  glClear  (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glEnable (GL_DEPTH_TEST);

  glLoadIdentity ();

  glTranslatef (0, 0, -3);

  glDisable (GL_LIGHTING);


  glPushMatrix ();
  glTranslatef (d[0], d[1], d[2]);    // Move box down X axis.
  glScalef (0.2, 0.2, 0.2);
  Draw_Box ();
  glPopMatrix ();

  glutSwapBuffers();
}
Пример #8
0
  virtual void draw(){

    geometry_msgs::Vector3 v = rollPitchYaw(q);
    glPushMatrix ();
       //glRotatef(angle*180.0/M_PI,x,y,z);
       glRotatef(v.z,0,0,1);
       glRotatef(v.y,0,1,0);
       glRotatef(v.x,1,0,0);
       drawAxis(0.5);
       Draw_Box (0.2);
    glPopMatrix ();
    
    //geometry_msgs::Vector3 v = rollPitchYaw(q);
    char buff[256];
    sprintf(buff,"Roll: %3.2f Pitch: %3.2f Yaw: %3.2f ",v.x,v.y,v.z);
    //sprintf(buff,"Roll: %3.2f \nPitch: %3.2f \nYaw: %3.2f ",roll(q),pitch(q),yaw(q));
    std::string rpy = buff;
    
	glColor3f  ( 0.9,  0.9,  0.9); 
    drawText(10,60,rpy.c_str());

  }
Пример #9
0
static void DrawThing(DrawBuffer *b, const TTileItem *t, const Vec2i offset)
{
    const Vec2i picPos = Vec2iNew(
                             t->x - b->xTop + offset.x, t->y - b->yTop + offset.y);
#ifdef DEBUG_DRAW_BOUNDS
    Draw_Box(
        picPos.x - t->size.x / 2, picPos.y - t->size.y / 2,
        picPos.x + t->size.x / 2, picPos.y + t->size.y / 2,
        colorGray);
#endif

    if (!Vec2iIsZero(t->ShadowSize))
    {
        DrawShadow(&gGraphicsDevice, picPos, t->ShadowSize);
    }

    if (t->CPicFunc)
    {
        CPicDrawContext c = t->CPicFunc(t->id);
        CPicDraw(b->g, &t->CPic, picPos, &c);
    }
    else if (t->getPicFunc)
    {
        Vec2i picOffset;
        const Pic *pic = t->getPicFunc(t->id, &picOffset);
        Blit(&gGraphicsDevice, pic, Vec2iAdd(picPos, picOffset));
    }
    else if (t->getActorPicsFunc)
    {
        DrawActorPics(t, picPos);
    }
    else
    {
        (*(t->drawFunc))(picPos, &t->drawData);
    }
}
Пример #10
0
// ------------------------------------------------------
// Display a gadget with the given id
int Gadgets::Display(GADGETID id, int highlight)
{
    int x;
    int y;
    int j;
    int Color_Hi;
    int Color_Mid;
    int Color_Lo;
    int Color_Slider;
    COORDINATE String_Pos;
    char Value[256];
    int Remaining_Chars;
    LPGADGET Refresh_Highlight;
    LPGADGET Cur_Gadget;
    LPGADGETSTRING CurString;

    if(id < 0 || id > Nbr_Gadgets) return(FALSE);

    Cur_Gadget = __Get_From_Id(id);

    if(highlight == -1)
    {
        Refresh_Highlight = __Check_Mouse_Over(&Mouse);
        
        if(Refresh_Highlight)
        {
            highlight = Refresh_Highlight->id == id ? TRUE: FALSE;
        }
        else
        {
            highlight = FALSE;
        }
    }

    __Set_Mouse_Over_State(id, highlight);
    
    if(Cur_Gadget)
    {
        if(Cur_Gadget->enabled)
        {
            Color_Hi = highlight ? COL_INPUT_HI : COL_HI;
            Color_Mid = highlight ? COL_INPUT_MED : COL_MED;
            Color_Lo = highlight ? COL_INPUT_LO : COL_LO;
        }
        else
        {
            Color_Hi = COL_STATIC_HI;
            Color_Mid = COL_STATIC_MED;
            Color_Lo = COL_STATIC_LO;
        }
        Color_Slider = highlight ? COL_SLIDER_HI : COL_SCOPESSAMPLES;

        x = Cur_Gadget->x; 
        y = Cur_Gadget->y;
        if(x < 0) x = Screen_Width + x;
        if(y < 0) y = Screen_Height + y;

        switch(Cur_Gadget->type)
        {
            case TYPE_STATIC:
                __Get_Align(Cur_Gadget, Cur_Gadget->string, &String_Pos);
                if(Cur_Gadget->vint == GADGET_STATIC_BEVEL)
                {
                    Draw_Box(x, y, Cur_Gadget->width,
                             Cur_Gadget->height, Cur_Gadget->clicked,
                             COL_STATIC_HI, COL_STATIC_MED, COL_STATIC_LO, TRUE);
                    SetColor(COL_LO);
                    PrintString(x + String_Pos.x,
                                y + 1 + String_Pos.y,
                                USE_FONT,
                                Cur_Gadget->string);
                }
                else
                {
                    SetColor(COL_FONT_HI);
                    PrintString(x + String_Pos.x,
                                y + 1 + String_Pos.y,
                                USE_FONT,
                                Cur_Gadget->string);
                }
                if(Cur_Gadget->draw_event)
                {
                    Cur_Gadget->draw_event(Cur_Gadget->id, x, y,
                                           Cur_Gadget->width, Cur_Gadget->height,
                                           Cur_Gadget->vint);
                }
                break;

            case TYPE_BUTTON:
                Draw_Box(x, y, Cur_Gadget->width,
                         Cur_Gadget->height, Cur_Gadget->clicked,
                         Color_Hi, Color_Mid, Color_Lo, TRUE);
                __Get_Align(Cur_Gadget, Cur_Gadget->string, &String_Pos);
                SetColor(Color_Lo);
                PrintString(x + String_Pos.x,
                            y + 1 + String_Pos.y,
                            USE_FONT,
                            Cur_Gadget->string);
                break;

            case TYPE_TEXT:
                __Get_Align(Cur_Gadget, Cur_Gadget->string, &String_Pos);
                SetColor(COL_HI);
                PrintString(x + 2 + String_Pos.x,
                            y + 2,
                            USE_FONT,
                            Cur_Gadget->string);
                SetColor(COL_LO);
                PrintString(x + String_Pos.x,
                            y,
                            USE_FONT,
                            Cur_Gadget->string);
                break;

            case TYPE_NUMBER:
                memset(Value, 0, sizeof(Value));
                Draw_Box(x, y,
                         Cur_Gadget->width, Cur_Gadget->height,
                         Cur_Gadget->clicked,
                         COL_LO, COL_MED, COL_HI, TRUE);
                sprintf(Value, Cur_Gadget->string, Cur_Gadget->vint);
                __Get_Align(Cur_Gadget, Value, &String_Pos);
                SetColor(COL_FONT_HI);
                PrintString(x + String_Pos.x + 1,
                            y + String_Pos.y + 1,
                            USE_FONT,
                            Value);
                break;

            case TYPE_TIMER:
                memset(Value, 0, sizeof(Value));
                Draw_Box(x, y, Cur_Gadget->width, 
                         Cur_Gadget->height, Cur_Gadget->clicked,
                         COL_LO, COL_MED, COL_HI, TRUE);
                sprintf(Value, "%.2d:%.2d", Cur_Gadget->vint / 1000 / 60, (Cur_Gadget->vint / 1000) % 60);
                __Get_Align(Cur_Gadget, Value, &String_Pos);
                SetColor(COL_FONT_HI);
                PrintString(x + String_Pos.x + 1,
                            y + String_Pos.y + 1,
                            USE_FONT,
                            Value);
                break;

            case TYPE_NAKED_STRING:
                memset(Value, 0, sizeof(Value));

                CurString = Cur_Gadget->vstr;
                sprintf(Value, "%s", CurString->String);
                Remaining_Chars = (CurString->Max - strlen(CurString->String));
                if(Remaining_Chars > 0)
                {
                    for(j = 0; j < Remaining_Chars; j++)
                    {
                        strcat(Value, "_");
                    }
                }
                __Get_Align(Cur_Gadget, Value, &String_Pos);
                String_Pos.x = Get_Size_Text(Cur_Gadget->string) + 2;
                SetColor(COL_FONT_HI);
                PrintString(x + String_Pos.x + 1,
                            y + String_Pos.y + 1,
                            USE_FONT,
                            Value);
                break;

            case TYPE_STRING:
                memset(Value, 0, sizeof(Value));
                Draw_Box(x, y,
                         Cur_Gadget->width, Cur_Gadget->height,
                         Cur_Gadget->clicked,
                         Color_Hi, Color_Mid, Color_Lo, TRUE);
                __Get_String_Left(Cur_Gadget, Cur_Gadget->string, &String_Pos);
                SetColor(Color_Lo);
                PrintString(x + 2 + String_Pos.x,
                            y + 2 + String_Pos.y,
                            USE_FONT,
                            Cur_Gadget->string);
                SetColor(Color_Hi);
                PrintString(x + String_Pos.x,
                            y + String_Pos.y,
                            USE_FONT,
                            Cur_Gadget->string);
                
                CurString = Cur_Gadget->vstr;
                sprintf(Value, "%s", CurString->String);
                Remaining_Chars = (CurString->Max - strlen(CurString->String));
                if(Remaining_Chars > 0)
                {
                    for(j = 0; j < Remaining_Chars; j++)
                    {
                        strcat(Value, "_");
                    }
                }
                __Get_Align(Cur_Gadget, Value, &String_Pos);
                String_Pos.x = Get_Size_Text(Cur_Gadget->string) + 2;
                SetColor(COL_FONT_HI);
                PrintString(x + String_Pos.x + 1,
                            y + String_Pos.y + 1,
                            USE_FONT,
                            Value);
                break;

            case TYPE_HSCROLLBAR:
                Draw_Box(x, y,
                         Cur_Gadget->width, Cur_Gadget->height,
                         FALSE,
                         COL_LO, COL_MED, COL_HI, TRUE);
                Draw_Box(x + 4 + Cur_Gadget->scrollbar_pos, y + 4,
                         Cur_Gadget->scrollbar_innersize,
                         Cur_Gadget->height - 8, Cur_Gadget->clicked,
                         0, Color_Slider, 0, FALSE);
                break;

            case TYPE_VSCROLLBAR:
                Draw_Box(x, y, Cur_Gadget->width,
                         Cur_Gadget->height, TRUE,
                         COL_LO, COL_MED, COL_HI, TRUE);
                Draw_Box(x + 4, y + 4 + Cur_Gadget->scrollbar_pos,
                         Cur_Gadget->width - 8,
                         Cur_Gadget->scrollbar_innersize, Cur_Gadget->clicked,
                         0, Color_Slider, 0, FALSE);
                break;

            case TYPE_ARRAY:
                Draw_Box(x, y,
                         Cur_Gadget->width, Cur_Gadget->height,
                         TRUE,
                         COL_LO, COL_BACKGROUND, COL_HI, TRUE);
                if(Cur_Gadget->draw_event)
                {
                    Cur_Gadget->draw_event(Cur_Gadget->id,
                                           x + 2, y + 2,
                                           Cur_Gadget->width - 4, Cur_Gadget->height - 4,
                                           Cur_Gadget->vint);
                }
                break;
        }
        return(TRUE);
    }
    return(FALSE);
}
Пример #11
0
void Alph_In(char *text, int max_len, int x, int y, alph *font) {
int column, index, c;
char *temp;
int *columns;
unsigned char far **source;

  temp=new char [max_len];
  columns=new int [max_len];
  max_len--;
  index=0;
  columns[index]=x;
  while ((temp[index]=getch())!=13) {  // 13=enter
    if (temp[index]==27) { // 27=esc. Clear line.
      Draw_Box(x,y,columns[index]-x,font->height,255);
      index=0;
      columns[index]=x;
    } else if (temp[index]==8) { // 8=backspace
      index--;
      if (index<0) index=0;
      Draw_Box(columns[index],y,columns[index+1]-columns[index],font->height,255);
    } else if (index<=max_len) {
      if (temp[index]!=' ') {
        if ((temp[index]>='A')&(temp[index]<='Z'))
          source=font->upper[temp[index]-'A'];
        else if ((temp[index]>='a')&(temp[index]<='z'))
          source=font->lower[temp[index]-'a'];
        else if ((temp[index]>='0')&(temp[index]<='9'))
          source=font->numbers[temp[index]-'0'];
        else if (temp[index]=='.')
          source=font->other[1];
        else if (temp[index]=='!')
          source=font->other[2];
        else if (temp[index]=='?')
          source=font->other[3];
        else if (temp[index]==',')
          source=font->other[4];
        else if (temp[index]=='\'')
          source=font->other[5];
        else if (temp[index]=='\"')
          source=font->other[6];
        else if (temp[index]=='-')
          source=font->other[7];
        else if ((temp[index]=='/')||(temp[index]=='\\'))
          source=font->other[8];
        else if (*text==':')
          source=font->other[9];
        else
          source=font->other[0];                                        // '*'
        for (c=0;c<font->height;c++)
          _fmemcpy(&screen[columns[index]+((y+c)<<8)+((y+c)<<6)],&source[c][1],source[c][0]);
        columns[index+1]=columns[index]+source[0][0]+1;
        index++;
      } else {
        columns[index+1]=columns[index]+font->height;
        index++;
      }
    }
  }
  delete text;
  delete columns;
  temp[index]=NULL;
  text=new char [index+1];
  memcpy(text,temp,index);
  delete temp;
}
Пример #12
0
// Redraw the openGl window
void ObjectOpenGL::paintGL(  )
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    // Set the lights
    GLfloat LightAmbient[]={0.4f,0.4f,0.4f,1.0f};
    GLfloat LightDiffuse[]={0.8f,0.8f,0.8f,1.0f};
    glLightfv(GL_LIGHT0,GL_AMBIENT,LightAmbient);
    glLightfv(GL_LIGHT0,GL_DIFFUSE,LightDiffuse);
    int LightPos[4]={0,0,10,1};
    glLightiv(GL_LIGHT0,GL_POSITION,LightPos);

    // Move the display according to the current orientation
    glRotated(xRot / 16.0, 1.0, 0.0, 0.0);
    glRotated(yRot / 16.0, 0.0, 1.0, 0.0);
    glRotated(zRot / 16.0, 0.0, 0.0, 1.0);

    glDisable(GL_LIGHTING);

    // Invert the Y-axis for an orthonormal frame
    glScalef(1,-1,1);

    // Draw the frame
//    Draw_Frame();

    // Start display of the items
    glPushMatrix();                                             // The following properties are only for the object



    // Zoom according to the view's parameters
    glScalef(Zoom,Zoom,Zoom);                                        // ReZoom the object


    // Light independant (color is constant)

    glLineWidth(5.0);

#define RAW_ACC
#define RAW_GYRO
#define RAW_MAG

#ifdef RAW_ACC
    // Accelerometer
    glBegin(GL_LINES);
    qglColor(QColor::fromRgb(255 ,51 ,255));
    glVertex3d(0,0,0);
    glVertex3d(ax,ay,az);
    glEnd();
#endif

#ifdef RAW_GYRO
    // Gyroscopes
    glBegin(GL_LINES);
    qglColor(QColor::fromRgb(255,255 ,0));
    glVertex3d(0,0,0);
    glVertex3d(gx,gy,gz);
    glEnd();
#endif

#ifdef RAW_MAG
    // Magnetometer
    glBegin(GL_LINES);
    qglColor(QColor::fromRgb(32,32,32));
    glVertex3d(0,0,0);
    glVertex3d(mx,my,mz);
    glEnd();
#endif
    Draw_Box();

    glEnable(GL_LIGHTING);                  // Re enable the light


    // End of the object
    glPopMatrix();


    // Update the view
    glViewport(0, 0,WindowSize.width(), WindowSize.height());
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    GLfloat Ratio=(GLfloat)WindowSize.width()/(GLfloat)WindowSize.height();
    glOrtho((-0.5+dx)*Ratio,
            ( 0.5+dx)*Ratio ,
            +0.5+dy,
            -0.5+dy,
            -1500.0, 1500.0);
    glMatrixMode(GL_MODELVIEW);
}