For the past couple of days, I have been playing around in the Ursina Engine in Python, used for creating both 3D and 2D games. But the recurring problem I have been facing with this engine when making 3D games, is that I can't close the window properly. This is happening because mouse is being used inside of the game, to control the player, so if I try to go to the close button, the mouse will always stay in the game. The workaround for this is to move to a different window, position the mouse so it's outside of the window, and then finally hit the close button. But this is a lot of work for the user to do, to simply close the window.
Here is some simple code to demonstrate:
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
import random
game = Ursina()
class Block(Button):
def __init__(self, position = (0,0,0)):
super().__init__(parent = scene, position = position, model = 'cube', color = color.white)
for z in range(20):
for x in range(20):
block = Block(position = (x, 0, z))
player = FirstPersonController()
game.run()
I believe this import statement is causing this:
from ursina.prefabs.first_person_controller import FirstPersonController
How can I close the window properly in Ursina?