Giter Club home page Giter Club logo

Comments (2)

paddywwoof avatar paddywwoof commented on July 23, 2024

Good point. I see there's a TODO in DisplayOpenGL on that subject. It's probably rather difficult to do in your code as it needs an additional event mask setting up in DisplayOpenGL and the event checking in Display needs to catch resizes. i.e. DisplayOpenGL

      xlib.XSelectInput(self.d, self.window, KeyPressMask | KeyReleaseMask | ResizeRedirectMask)

and Display

      n = xlib.XEventsQueued(self.opengl.d, xlib.QueuedAfterFlush)
      for _ in range(n):
          xlib.XNextEvent(self.opengl.d, self.ev)
          if self.ev.type == KeyPress or self.ev.type == KeyRelease:
              self.event_list.append(self.ev)
          elif self.ev.type == ClientMessage:
            if (self.ev.xclient.data.l[0] == self.opengl.WM_DELETE_WINDOW.value):
              self.destroy()
          elif self.ev.type == ResizeRequest:
            (self.width, self.height) = (self.ev.xresizerequest.width,
                                         self.ev.xresizerequest.height)
            opengles.glViewport(0, 0, self.width, self.height)
            self.was_resized = True

then in programs

    if DISPLAY.was_resized:
        # move shapes and fix camera

However the the normal Camera.reset() with different lens settings doesn't work properly and creating new Cameras and setting Shape._camera = new_cam also has issues. I will let you know when I've figured out what to do, and will post the revisions to pi3d develop branch. Hopefully something quick to do.

Paddy

PS to answer the first part of your question. You can get the Display size using its width and height properties. So if your button is bwxbh it will be in the bottom right corner:

...
button.positionX((display.width - bw) * 0.5)
button.positionY((diplay.height - bh) * 0.5)

from pi3d.

pootle avatar pootle commented on July 23, 2024

Many thanks, that'll keep me going

from pi3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.