Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Using Mouseevent together with Keypressedevents with OPENGL&QT

Using Mouseevent together with Keypressedevents with OPENGL&QT

Scheduled Pinned Locked Moved Game Development
2 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    uauaua
    wrote on last edited by
    #1

    Hello,

    has anybody an idea how can use the "Mousemove event" together with an "Keypress event" for example "Z"-key to change the viewport settings.

    I am using the following example (glwidget.cpp Example File):
    @
    void GLWidget::resizeGL(int width, int height) {
    int side = qMin(width, height);
    glViewport((width - side) / 2, (height - side) / 2, side, side);

     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     glFrustum(-1.0, +1.0, -1.0, 1.0, near, far);
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
     glTranslated(0.0, 0.0, -40.0);
    

    }@

    The aim of this (for me frustating) game is to change the to variable "far" and or "near" in an similar mode like in CAD-Systems. a mouse move together with a pressed key.

    Thank you for your help

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      welcome to devnet

      Please use "code wrapping":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 for your code sections nect time. I have introduced them for you.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved