DirectGui question

The code is here:

Why a button image looks so blured, how to improve quality ?

OnscreenText position does not match mouse position:


After the cursor crosses the border of the window the functioning became completly wrong (the window doesn’t lose the focus)


This question gets asked a lot; try searching the forums for pixel-perfect rendering for a full answer. But the short answer is add this to your Config.prc file:

textures-power-2 up

Reparent your text to render2d instead of aspect2d. Or use relative setPos to render2d.

If you are holding the mouse button when you move the mouse pointer out of the window, the window will continue to track the mouse movement. If you are not holding the mouse button, the window will stop tracking the mouse movement when it goes beyond the window. Is this the behavior you observe? What behavior would you expect instead?


1 Like

Reparenting to the render2d doesn’t help, OnscreenText not apear even in initial position. "“Relative setPos” how is it?

After the cursor goes out of the window and comes back mouseWatcherNode stop sending coordinates or Task-loop stops.


unindent your “return task.cont” line.

ynjh_jo, thanks, this is worked.

Please, give a short explanation of trick with NodePath(yourOnscreenText).setPos(render2d,x,y,z), why render2d instade aspect2d ? How is it OnscreenText in aspect2d, but his coordinates in render2d ?

Why render2d ?
Because mouseWatcher’s getMouse() returns values in render2d coordinate space.