void EffectDrawer::Draw() { if(_drawType == GDP_SMOOTH) { if(_alpha > 0) { Render::BeginAlphaMul(_alpha); DrawBase(); Render::EndAlphaMul(); } }else if(_drawType == GDP_UP) { DrawBase(); } }
void EffectDrawer::DrawUnderChips() { if(_drawType == GDP_SMOOTH) { if(_alpha < 1) { Render::BeginAlphaMul(1.f - _alpha); DrawBase(); Render::EndAlphaMul(); } }else if(_drawType == GDP_DOWN) { DrawBase(); } }
VOID COGLAppBase::Run() { MSG msg; ZeroMemory( &msg, sizeof(msg) ); LARGE_INTEGER timeStart; LARGE_INTEGER timeEnd; LARGE_INTEGER timerFrequency; QueryPerformanceFrequency(&timerFrequency); double fi = 1000.0/(double)timerFrequency.QuadPart; while( msg.message!=WM_QUIT ) { if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { QueryPerformanceCounter(&timeStart); UpdateScene(); DrawBase(); HandleInput(); QueryPerformanceCounter(&timeEnd); // the time elapsed since the last frame is stored in m_timeElapsed m_timeElapsed = (float)((timeEnd.QuadPart - timeStart.QuadPart)*fi); } } Cleanup(); }
void UIButton::Draw() { if (!visible_) { return; } DrawBase(); DrawChildren(); }
void CCLUDrawBase::Display() { // Need to overwrite this function BeginDraw(); DrawBase(); EndDraw(); }
void DrawRobotArm(int NumSegs) { glMatrixMode(GL_MODELVIEW); glPushMatrix(); /** Base of Arm **/ glTranslatef(0,0,0); glRotatef(BaseSpin,0.0,1.0,0.0); DrawBase(NumSegs); /** Arm Segment #1 **/ glTranslatef(0,0.4f,0); glRotatef(ShoulderAng,0.0,0.0,1.0); DrawArmSegment(NumSegs); /** Arm Segment #2 **/ glTranslatef(0,0.5f,0); glRotatef(ElbowAng,0.0,0.0,1.0); DrawArmSegment(NumSegs); /** Wrist **/ glTranslatef(0,0.5f,0); glRotatef(WristAng,0.0,0.0,1.0); DrawWrist(NumSegs); glTranslatef(0,0.2f,0); glRotatef(FingerAng1,0.0,0.0,1.0); DrawFingerBase(NumSegs); glTranslatef(0, 0.3f, 0); glRotatef(-90, 0, 0, 1); DrawFingerTip(NumSegs); glRotatef(90, 0, 0, 1); glTranslatef(0, -0.3f, 0); glRotatef(FingerAng2*2,0.0,0.0,1.0); DrawFingerBase(NumSegs); glTranslatef(0, 0.3f, 0); glRotatef(90, 0, 0, 1); DrawFingerTip(NumSegs); glPopMatrix(); // Pop Base of Arm }
void DrawCannon() { //Base DrawBase(); //Wheels DrawWheels(); //WheelDents DrawWheelDents(); //HolderBase DrawHolderBase(); //Holders DrawHolders(); //DrawBody DrawBody(); }
void DiagramWindow::Draw1(RNAStructure** structures, const int resolution) { float centerX = 0.0f; float centerY = 0.0f; float angleBase = 0.0f; float angleDelta = 0.0f; float radius = 0.0f; unsigned int numBases = structures[0]->GetLength(); ComputeDiagramParams(numBases, resolution, centerX, centerY, angleBase, angleDelta, radius); for (unsigned int ui = 0; ui < numBases; ++ui) { const RNAStructure::BaseData* baseData1 = structures[0]->GetBaseAt(ui); DrawBase(ui, baseData1->m_base, centerX, centerY, angleBase, angleDelta, radius + 7.5f); if (baseData1->m_pair != RNAStructure::UNPAIRED && baseData1->m_pair > ui) { fl_color(FL_WHITE); DrawArc(ui, baseData1->m_pair, centerX, centerY, angleBase, angleDelta, radius); } } }
void display() { if (!LoadGLTextures()) // Jump To Texture Loading Routine ( NEW ) { printf("Not loaded texture!\n"); // return FALSE; // If Texture Didn't Load Return FALSE } glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear screen and depth buffers glLoadIdentity(); /* lighting */ glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLightA); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLightA); glLightfv(GL_LIGHT0, GL_SPECULAR, specularLightA); glLightfv(GL_LIGHT0, GL_POSITION, lightPositionA); glLightfv(GL_LIGHT1, GL_AMBIENT, ambientLightB); glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuseLightB); glLightfv(GL_LIGHT1, GL_SPECULAR, specularLightB); glLightfv(GL_LIGHT1, GL_POSITION, lightPositionB); glViewport(0, 0, WIDTH/2+200, HEIGHT); observe_from_viewer(viewer); display_tetris_board(tetris_board,board_status,created_status,view_status,placed_status); glEnable(GL_TEXTURE_2D); glPushMatrix(); // glTranslatef(0.0,0.0,-2.0); glBindTexture(GL_TEXTURE_2D, texture[0]); GLUquadricObj *quadric = gluNewQuadric(); gluQuadricDrawStyle(quadric, GLU_FILL ); gluQuadricNormals(quadric, GLU_SMOOTH); gluQuadricTexture(quadric, GL_TRUE); // glEnable(GL_TEXTURE_2D); gluSphere( quadric ,20, 16 , 9 ); glBindTexture(GL_TEXTURE_2D, texture[1]); DrawBase(); // glDisable(GL_TEXTURE_2D); glPopMatrix(); glDisable(GL_TEXTURE_2D); glViewport(WIDTH/2+300, 0, 300, HEIGHT); glPushMatrix(); char buf[4]={'\0'}; char out[6]; glDisable(GL_LIGHTING); sprintf(buf, "%d", 50-speed); drawText("Speed: ",strlen("Score: "),0,180); drawText(buf,strlen(buf), 200, 180); // if(next_block_type==0) // { // // block_temp=block[0]; // } // else if(next_block_type==1) // { // block_temp=block[1]; // // temp=type2; // } // else if(next_block_type==2) // { // block_temp=block[2]; // // temp=type3; // } // else if( next_block_type==3) // { // block_temp=block[3]; // // temp=type4; // } sprintf(buf, "%d", tetris_board->score); drawText("Score: ",strlen("Score: "),0,200); drawText(buf,strlen(buf), 200, 200); sprintf(buf, "%d", next_block_type); drawText("Next Block Type: ",strlen("Next Block Type: "),0,220); drawText(buf,strlen(buf), 500, 220); // sprintf(buf, "", next_block_type); // drawText("Next Block Name: ",strlen("Next Block Name: "),0,240); // drawText(buf,strlen(buf), 500, 240); // sprintf(buf, "%d", next_block_type); drawText("Camera : Keyboard(ASWD)",strlen("Camera : Keyboard(ASWD)"),0,40); // drawText(buf,strlen(buf), 500, 220); // sprintf(buf, "%d", next_block_type); drawText("Camera:Mouse(Lft & Rht Click",strlen("Camera:Mouse(Lft & Rht)"),0,60); // drawText(buf,strlen(buf), 500, 260); drawText("Screenshot : Z",strlen("Screenshot : Z"),0,80); drawText("Rotation(R,T,Y)",strlen("Rotation(R,T,Y)"),0,100); drawText("Exit : X",strlen("Exit : X"),0,160); drawText("Move Down : Spacebar",strlen("Move Down : Spacebar"),0,140); drawText("Music : M",strlen("Music : M"),0,120); glEnable(GL_LIGHTING); glPopMatrix(); // Block *block_temp; // // BlockType temp; // // // if(temp) // // block=create_block(squareshape,color_block); // // glScalef(2,2,2); glViewport(WIDTH/2+200, HEIGHT/2, 300, HEIGHT/2); glPushMatrix(); // draw block // glTranslated(block_temp->pos[0], block_temp->pos[1], block_temp->pos[2]); // glScalef(block_temp->width, block_temp->height, block_temp->width); // if (block_temp->model) { // glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, block_temp->color); // glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, block_temp->color); // glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, block_temp->color); // glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 1.5f); // glmDraw(block_temp->model, GLM_SMOOTH); // } glPopMatrix(); // glPushMatrix (); // glTranslatef (-1, -1, 0); // glLoadIdentity(); // glColor4f(0.2,0.2,0.2,0.6); // GLUquadricObj *quadric1; // quadric = gluNewQuadric(); // gluQuadricDrawStyle(quadric1, GLU_FILL ); // // glBindTexture (GL_TEXTURE_2D, textures[3]); // glTranslatef(-0.45,0,0); // gluSphere( quadric1 , .3 , 36 , 18 ); // glTranslatef(0.45,0,0); // gluSphere( quadric1 , .3 , 36 , 18 ); // glutSolidTeapot(0.5); // glPopMatrix (); glFlush(); glutSwapBuffers(); }
void DiagramWindow::Draw3(RNAStructure** structures, const int resolution) { float centerX = 0.0f; float centerY = 0.0f; float angleBase = 0.0f; float angleDelta = 0.0f; float radius = 0.0f; unsigned int numBases = structures[0]->GetLength(); ComputeDiagramParams(numBases, resolution, centerX, centerY, angleBase, angleDelta, radius); for (unsigned int ui = 0; ui < numBases; ++ui) { const RNAStructure::BaseData* baseData1 = structures[0]->GetBaseAt(ui); DrawBase(ui, baseData1->m_base, centerX, centerY, angleBase, angleDelta, radius + 7.5f); const RNAStructure::BaseData* baseData2 = structures[1]->GetBaseAt(ui); const RNAStructure::BaseData* baseData3 = structures[2]->GetBaseAt(ui); if (baseData1->m_pair != RNAStructure::UNPAIRED && baseData1->m_pair > ui) { if (baseData1->m_pair == baseData2->m_pair) { if (baseData1->m_pair == baseData3->m_pair) { fl_color(FL_WHITE); DrawArc(ui, baseData1->m_pair, centerX, centerY, angleBase, angleDelta, radius); } else { fl_color(FL_YELLOW); DrawArc(ui, baseData1->m_pair, centerX, centerY, angleBase, angleDelta, radius); } } else if (baseData1->m_pair == baseData3->m_pair) { fl_color(FL_MAGENTA); DrawArc(ui, baseData1->m_pair, centerX, centerY, angleBase, angleDelta, radius); } else { fl_color(FL_RED); DrawArc(ui, baseData1->m_pair, centerX, centerY, angleBase, angleDelta, radius); } } else if (baseData2->m_pair != RNAStructure::UNPAIRED && baseData2->m_pair > ui) { if (baseData2->m_pair == baseData3->m_pair) { fl_color(FL_CYAN); DrawArc(ui, baseData2->m_pair, centerX, centerY, angleBase, angleDelta, radius); } else { fl_color(FL_GREEN); DrawArc(ui, baseData2->m_pair, centerX, centerY, angleBase, angleDelta, radius); } } else if (baseData3->m_pair != RNAStructure::UNPAIRED && baseData3->m_pair > ui) { fl_color(FL_BLUE); DrawArc(ui, baseData3->m_pair, centerX, centerY, angleBase, angleDelta, radius); } } }
/* * Run a command, and display its output in a window. * If truncate==1, the output will not be wrapped. * This function is a horrible mess and I hope to do away with it one day. */ void RunShow (char *title, char *command, int truncate) { FILE *pcommand; char *realstr=NULL,*str=NULL; int i=0,j,k; /* Display wait text. */ DrawBase(_("Please wait...")); SLsmg_refresh(); /* allocate memory for the window */ menus->next=malloc(sizeof(Menu_Type)); menus->next->last=menus; menus->next->next=NULL; menus=menus->next; /* load up the menu with the appropriate values */ menus->title=malloc(strlen(title)+1); strcpy(menus->title,title); menus->helptext=malloc(128); strcpy(menus->helptext,_("Press Esc to close window.")); menus->name=malloc(1); strcpy(menus->name,""); menus->selected=0; menus->num_avail=MENU_INC; menus->items=malloc(sizeof(Menu_Item_Type *) * MENU_INC); /* Get the command output and create the menu items */ pcommand=popen(command,"r"); while ((str && strlen(str) > 0) || (str=realstr=pdgetline(pcommand,0))) { /* * If we are not truncating, we have to handle wrapping lines that contain * tabs. This adds a lot of complexity and ugliness here. :-( */ if (!truncate) { k=0; for (j=0;j<strlen(str);j++) { if (k == SLtt_Screen_Cols - 4 - 1) { /* * We have reached the end of the line before we reached the end * of the string. Copy the processed part into the menu array, * saving leftover part of string for later processing. */ if (i >= menus->num_avail) { menus->num_avail+=MENU_INC; menus->items=realloc(menus->items, sizeof(Menu_Item_Type *) * menus->num_avail); } menus->items[i]=malloc(sizeof(Menu_Item_Type)); menus->items[i]->type=MENU_EXIT; menus->items[i]->text=malloc(j+1); strncpy(menus->items[i]->text,str,j); menus->items[i]->text[j]='\0'; menus->items[i]->command=malloc(1); strcpy(menus->items[i]->command,""); menus->items[i]->hotkey=-1; menus->items[i++]->next=NULL; /* keep whittling away at the current string */ str=str+j; /* Set j=0 to indicate we shouldn't add str to the list yet. */ j=0; break; } /* Calculate length of string as it will appear on screen with tabs */ if (str[j] == '\t') { /* Figure out how many characters this tab will take up. */ k+=((j/SLsmg_Tab_Width)+1)*SLsmg_Tab_Width-j-1; } else k++; } /* If j == 0, this is a signal not to add str to the list yet. */ if (j != 0) { if (i >= menus->num_avail) { menus->num_avail+=MENU_INC; menus->items=realloc(menus->items, sizeof(Menu_Item_Type *) * menus->num_avail); } menus->items[i]=malloc(sizeof(Menu_Item_Type)); menus->items[i]->type=MENU_EXIT; menus->items[i]->text=malloc(j+1); strcpy(menus->items[i]->text,str); menus->items[i]->command=malloc(1); strcpy(menus->items[i]->command,""); menus->items[i]->hotkey=-1; menus->items[i++]->next=NULL; free(realstr); str=NULL; } } else { if (i >= menus->num_avail) { menus->num_avail+=MENU_INC; menus->items=realloc(menus->items, sizeof(Menu_Item_Type *) * menus->num_avail); } menus->items[i]=malloc(sizeof(Menu_Item_Type)); menus->items[i]->type=MENU_EXIT; menus->items[i]->text=realstr; menus->items[i]->command=malloc(1); strcpy(menus->items[i]->command,""); menus->items[i]->hotkey=-1; menus->items[i++]->next=NULL; str=NULL; } } pclose(pcommand); menus->num=i; if (i==0) { DrawBase(_("Command returned no output")); SLsmg_refresh(); RemoveMenu(menus); } else { menus->recalc=1; /* display the menu until they hit q or exit */ AddWindow(menus); DrawAll(); DoMenu(menus,NullAction,Handle_Ctrl_C); ExitWindow(); RemoveMenu(menus); } }