void display(void) { // Clear the color buffer, restore the background glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Load the identity matrix, clear all the previous transformations glLoadIdentity(); // Set up the camera mot_MoveCamera(); // Collisions with blocks doMagic(); mot_SetCamera(); // Set light position vect_Vector eyePos = mot_GetEyePos(), targetPos = mot_GetTargetPos(), pos; pos = vect_Substract(targetPos, eyePos); vect_Normalize(&pos); pos = vect_Multiply(pos, -1); pos = vect_Add(pos, eyePos); lightPos[0] = pos.x; lightPos[1] = pos.y; lightPos[2] = pos.z; glLightfv(GL_LIGHT0, GL_POSITION, lightPos); drawMap(Map); drawGuides(); // Swap buffers in GPU glutSwapBuffers(); }
void GuideManager::tabWidget_currentChanged(QWidget *) { drawGuides(); if (tabWidget->currentIndex() == 1) { horizontalAutoGapSpin->setEnabled(horizontalAutoGapCheck->isChecked()); verticalAutoGapSpin->setEnabled(verticalAutoGapCheck->isChecked()); } }
void GuideManager::verticalAutoGapCheck_stateChanged( int ) { verticalAutoGapSpin->setEnabled(verticalAutoGapCheck->isChecked()); if (verticalAutoGapCheck->isChecked()) currentPage->guides.setVerticalAutoGap(value2pts(verticalAutoGapSpin->value(), docUnitIndex)); else currentPage->guides.setVerticalAutoGap(0.0); drawGuides(); m_Doc->changed(); }
static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *dp) { #if 0 uiDrawTextFontDescriptor desc; uiDrawTextFont *font; char *s; char *family; // make compiler happy uiDrawTextLayout *layout; uiDrawTextFontMetrics metrics; double ypos; double width; double height; memset(&desc, 0, sizeof (uiDrawTextFontDescriptor)); family = uiEntryText(textFont); desc.Family = family; desc.Size = entryDouble(textSize); desc.Weight = uiComboboxSelected(textWeight); desc.Italic = uiComboboxSelected(textItalic); desc.SmallCaps = uiCheckboxChecked(textSmallCaps); desc.Stretch = uiComboboxSelected(textStretch); desc.Gravity = uiComboboxSelected(textGravity); font = uiDrawLoadClosestFont(&desc); uiFreeText(family); uiDrawTextFontGetMetrics(font, &metrics); width = entryDouble(textWidth); drawGuides(dp->Context, &metrics); s = uiEntryText(textString); layout = uiDrawNewTextLayout(s, font, width); uiFreeText(s); ypos = 10; uiDrawText(dp->Context, 10, ypos, layout); // TODO make these optional? uiDrawTextLayoutExtents(layout, &width, &height); uiDrawFreeTextLayout(layout); layout = uiDrawNewTextLayout("This is a second line", font, -1); if (/*TODO reuse width*/entryDouble(textWidth) < 0) { double ad; ad = metrics.Ascent + metrics.Descent; printf("ad:%g extent:%g\n", ad, height); } ypos += height; if (uiCheckboxChecked(addLeading)) ypos += metrics.Leading; uiDrawText(dp->Context, 10, ypos, layout); uiDrawFreeTextLayout(layout); uiDrawFreeTextFont(font); #endif }
void GuideManager::verticalAutoCountSpin_valueChanged(int val) { bool enable = (val == 0) ? false : true; verticalAutoGapCheck->setEnabled(enable); if (enable && verticalAutoGapCheck->isChecked()) verticalAutoGapSpin->setEnabled(true); else verticalAutoGapSpin->setEnabled(false); currentPage->guides.setVerticalAutoCount(val); drawGuides(); m_Doc->changed(); }
void GuideManager::copyGuidesToAllPages(GuideManagerCore::GuideType t) { QListIterator<Page*> it(*m_Doc->Pages); Page *tmpPage; while (it.hasNext()) { tmpPage=it.next(); if (tmpPage->pageNr() == currentPage->pageNr()) continue; tmpPage->guides.clearHorizontals(t); tmpPage->guides.clearVerticals(t); currentPage->guides.copy(&tmpPage->guides, t); if (t == GuideManagerCore::Auto) storePageValues(tmpPage); } drawGuides(); m_Doc->changed(); }
void GuideManager::delVerButton_clicked() { QModelIndexList indexes = verticalView->selectionModel()->selectedRows(0); QModelIndex ix; Guides v; foreach(ix, indexes) // here *must* go EditRole due truncations in DisplayRole // see GuidesModel::data() v.append(verticalModel->data(ix, Qt::EditRole).toDouble()); verticalModel->removeValues(v); currentPage->guides.clearVerticals(GuideManagerCore::Standard); currentPage->guides.addVerticals(verticalModel->values(), GuideManagerCore::Standard); drawGuides(); m_Doc->changed(); }
void GuideManager::verticalAutoGapSpin_valueChanged(double) { currentPage->guides.setVerticalAutoGap(value2pts(verticalAutoGapSpin->value(), docUnitIndex)); drawGuides(); m_Doc->changed(); }