void CCursorController::render() { updateMousePos(); if(isVisible() && used) { _IRR_DEBUG_BREAK_IF(!m_pMouseCursor); // There isn't any cursor texture loaded if(m_pMouseCursor) { videoDriver->draw2DImage(m_pMouseCursor, topleft ? position2di(m_MousePos.X,m_MousePos.Y) : position2di(m_MousePos.X - m_pMouseCursor->getSize().Width/2+1, m_MousePos.Y - m_pMouseCursor->getSize().Height/2+2), rect<s32>(position2di(0,0),m_pMouseCursor->getSize()), 0, SColor(140,255,255,255), true); } } if(isOSCursorVisible()) { irrCursorControl->setVisible(true); // irrCursorControl->setPosition(irrCursorControl->getPosition()); } else { irrCursorControl->setVisible(false); // irrCursorControl->setPosition(irrCursorControl->getPosition()); } }
CCursorController::CCursorController(ICursorControl* irrCursor, IVideoDriver* irrVideoDriver) : m_pMouseCursor(0), used(0), irrCursorControl(irrCursor), videoDriver(irrVideoDriver) { updateMousePos(); setVisible(true); setOSCursorVisible(false); }
Window::Window(QWidget *parent) : QMainWindow(parent) { setWindowTitle("Bresenham's Circle Algo in Qt"); QWidget* centralWidget = new QWidget(this); drawButton = new QPushButton("Draw", centralWidget); // drawStepByStepButton = new QPushButton("Step In", centralWidget); connect(drawButton, SIGNAL(clicked()), this, SLOT(draw())); redraw = new QCheckBox("Redraw Display", centralWidget); redraw->setTristate(false); redraw->setCheckState(Qt::Checked); connect(redraw, SIGNAL(stateChanged(int)), this, SLOT(redrawToggle(int))); progressBar = new QProgressBar(this); progressBar->setValue(0); statusBar = new QStatusBar(centralWidget); setStatusBar(statusBar); infoLabel = new QLabel("Circle Drawing Algorithm, in C++ using Qt. \nAuthor: \nRohit Yadav & Abhishek Kumar \nCSE PartIII, \n2009-2010.", centralWidget); infoLabel->setWordWrap(true); display = new DisplayWidget(centralWidget); connect(display, SIGNAL(updateProgressBar(float)), this, SLOT(updateProgressBar(float))); connect(display, SIGNAL(mousePos(QPoint)), this, SLOT(updateMousePos(QPoint))); scrollArea = new QScrollArea(this); scrollArea->setBackgroundRole(QPalette::Dark); scrollArea->setWidget(display); QVBoxLayout *vbox = new QVBoxLayout(); vbox->addWidget(scrollArea, 10); vbox->addWidget(progressBar, 1); QVBoxLayout *vbox1 = new QVBoxLayout(); vbox1->addWidget(redraw,1); vbox1->addWidget(drawButton, 1); vbox1->addWidget(infoLabel, 1); QHBoxLayout *hbox = new QHBoxLayout(centralWidget); hbox->addLayout(vbox, 10); hbox->addLayout(vbox1, 1); setCentralWidget(centralWidget); }
void GLPlayer::step(void) { double firstTime = glfwGetTime(); if (glfwGetMouseButton(OpenGLWrapper::window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS) { updateMousePos(); } camera->calculateMatrix(&config, xpos, ypos, deltaTime); xpos = config.width / 2.0f; ypos = config.height / 2.0f; glm::mat4 ModelMatrix = glm::mat4(1.0); glm::mat4 MVP = camera->projectionMatrix * camera->viewMatrix * ModelMatrix; GLint model = glGetUniformLocation(OpenGLWrapper::programObject, "mvp"); glUniformMatrix4fv(model, 1, GL_FALSE, glm::value_ptr(MVP)); GLint loc = glGetUniformLocation(OpenGLWrapper::programObject, "baseColor"); glUniform4f(loc, 0.75f, 0.64f, 0.04f, 1.0f); GLint pos = glGetUniformLocation(OpenGLWrapper::programObject, "vDir"); glUniform3f(pos, camera->direction.x, camera->direction.y, camera->direction.z); pos = glGetUniformLocation(OpenGLWrapper::programObject, "angle"); glUniform1f(pos, angle); angle += 0.1f; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, config.width, config.height); glClear(GL_COLOR_BUFFER_BIT); glUseProgram(OpenGLWrapper::programObject); meshHandler->render(); double lastTime = glfwGetTime(); deltaTime = float(lastTime - firstTime); deltaTime = (deltaTime == 0) ? 0.0015 : deltaTime; sprintf(title, "%s - fps[%.2f]", config.title, (float)(1 / deltaTime)); glfwSetWindowTitle(OpenGLWrapper::window, title); }
Window::Window(QWidget *parent) : QMainWindow(parent) { setWindowTitle("Fibonacci Single Vs. PThread Vs. Java Threads"); QWidget* centralWidget = new QWidget(this); display = new Graph(centralWidget); scrollArea = new QScrollArea(this); scrollArea->setBackgroundRole(QPalette::Dark); scrollArea->setWidget(display); statusBar = new QStatusBar(centralWidget); setStatusBar(statusBar); button = new QPushButton("Run Fibonacci Programs", centralWidget); QVBoxLayout *vbox = new QVBoxLayout(); vbox->addWidget(scrollArea, 10); vbox->addWidget(button,1, Qt::AlignCenter); vbox->setMargin(0); QHBoxLayout *hbox = new QHBoxLayout(centralWidget); hbox->addLayout(vbox, 10); hbox->setMargin(0); setCentralWidget(centralWidget); connect(display, SIGNAL(mousePos(QPoint)), this, SLOT(updateMousePos(QPoint))); connect(button, SIGNAL(clicked()), this, SLOT(runProgram(void)) ); matrixSize = 5; x = 75; }
position2di& CCursorController::getMousePos() { return updateMousePos(); }