Skip to content

Commit

Permalink
made hotreloader have special window settings that puts the window in…
Browse files Browse the repository at this point in the history
… the upper right corner. these gets applied when enabling hotreload. settings can be changed by modifying the hotreload_window_settings dict.
  • Loading branch information
pokepetter committed Sep 7, 2024
1 parent ab17d0f commit c0f14b1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ursina/prefabs/hot_reloader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# this will clear the scene and try to execute the main.py code without
# restarting the program

from ursina import Entity, camera, texture_importer, mesh_importer, scene, application, print_on_screen
from ursina import Entity, camera, texture_importer, mesh_importer, scene, application, print_on_screen, window
from pathlib import Path
import time
import ast
Expand Down Expand Up @@ -68,6 +68,8 @@ def __init__(self, path=__file__, **kwargs):
'f8' : self.reload_shaders,
'f9' : self.toggle_hotreloading,
}

self.hotreload_window_settings = dict(size=(window.size[0]/2,window.size[1]/2), always_on_top=True, position=(window.fullscreen_size[0]-window.size[0]/22, 0))


def input(self, key):
Expand Down Expand Up @@ -101,6 +103,9 @@ def get_source_code(self):
def toggle_hotreloading(self):
self.hotreload = not self.hotreload
print_on_screen(f'<azure>hotreloading: {self.hotreload}')
if self.hotreload_window_settings:
for key, value in self.hotreload_window_settings.items():
setattr(window, key, value)



Expand Down Expand Up @@ -351,7 +356,7 @@ def reload_shaders(self):
from ursina import *
app = Ursina()
# hot_reloader = HotReloader()
application.hot_reloader.path = application.asset_folder.parent.parent / 'samples' / 'platformer.py'
# application.hot_reloader.path = application.asset_folder.parent.parent / 'samples' / 'platformer.py'
# Sky()

'''
Expand Down Expand Up @@ -382,6 +387,8 @@ def reload_shaders(self):


Sky(color=color.light_gray)

print(Sky.instances)
EditorCamera()

def update():
Expand Down

0 comments on commit c0f14b1

Please sign in to comment.