diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..8aa4897
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a42b483..b6e070c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,8 +5,10 @@
-
-
+
+
+
+
@@ -31,18 +33,18 @@
- {
- "keyToString": {
- "ModuleVcsDetector.initialDetectionPerformed": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
- "RunOnceActivity.git.unshallow": "true",
- "git-widget-placeholder": "restructuring",
- "last_opened_file_path": "/home/linus/Desktop/HomeLabProjects/StarSkyPresenter/src/starsky_presenter/main.py",
- "settings.editor.selected.configurable": "preferences.pluginManager",
- "uv run.StarSky Presenter.executor": "Run"
+
+}]]>
diff --git a/src/starsky_presenter/entry.py b/src/starsky_presenter/entry.py
index 1015e82..7bd23ca 100644
--- a/src/starsky_presenter/entry.py
+++ b/src/starsky_presenter/entry.py
@@ -17,6 +17,10 @@ import pygame
from starsky_presenter.controller.window import ControlWindow
from starsky_presenter.projection.screen import Screen, Star
+def dict_update(d1: dict, d2: dict) -> dict:
+ out = deepcopy(d1)
+ out.update(d2)
+ return out
def cli_main():
seed(43)
@@ -25,18 +29,17 @@ def cli_main():
scenes = yaml.safe_load(reader.open_resource('resources/scenes.yml'))
objects = yaml.safe_load(reader.open_resource('resources/objects.yml'))
- print(json.dumps(objects, indent=4))
- print(objects['stars'][0]['sid'])
-
- scene_data = [
- { obj['sid']: deepcopy(obj).update(scene[obj['sid']]) if scene and obj['sid'] in scene else deepcopy(obj) for obj in objects["stars"] }
- for scene in scenes
+ scene_data = [{ obj['sid']: deepcopy(obj) for obj in objects["stars"] }] + [
+ { obj['sid']: dict_update(obj, scenes[i][obj['sid']]) if scenes[i] and obj['sid'] in scenes[i] else deepcopy(obj) for obj in objects["stars"] }
+ if i < len(scenes) else { obj['sid']: deepcopy(obj) for obj in objects["stars"] }
+ for i in range(0,8)
]
star_references = {}
print(json.dumps(scenes, indent=4))
print(json.dumps(objects, indent=4))
+ print(json.dumps(scene_data, indent=4))
def setup_star_instance(data: dict) -> Star:
image_path = f"resources/{data['image']}"
diff --git a/src/starsky_presenter/projection/screen.py b/src/starsky_presenter/projection/screen.py
index 3f00fd9..4d5b7ea 100644
--- a/src/starsky_presenter/projection/screen.py
+++ b/src/starsky_presenter/projection/screen.py
@@ -1,3 +1,5 @@
+import json
+
import pygame
from pygame import transform, gfxdraw, Vector2
from math import sin, cos, pi
@@ -40,10 +42,14 @@ class Screen:
weight = sin(min(self.scene_time, pi/2)) ** 2
def update_star_scene(star, old, new, weight):
- star.x = weight*new['x'] + (1-weight)*old['x']
+ star.x = weight*new[star.sid]['x'] + (1-weight)*old[star.sid]['x']
+ star.y = weight*new[star.sid]['y'] + (1-weight)*old[star.sid]['y']
+ star.rot = weight*new[star.sid]['rot'] + (1-weight)*old[star.sid]['rot']
+ star.scale = weight*new[star.sid]['scale'] + (1-weight)*old[star.sid]['scale']
for star in self.stars:
+ update_star_scene(star, scene_data[self.last_scene], scene_data[self.active_scene], weight)
star.alpha += star.rot * delta
scaled = transform.rotozoom(star.image, star.alpha, star.scale)
(w, h) = scaled.get_size()
diff --git a/src/starsky_presenter/resources/main_window.qml b/src/starsky_presenter/resources/main_window.qml
index 48e159a..07efffc 100644
--- a/src/starsky_presenter/resources/main_window.qml
+++ b/src/starsky_presenter/resources/main_window.qml
@@ -37,7 +37,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 1"
- onClicked: controller_backend.select_scene(1)
+ onClicked: controller_backend.select_scene(0)
}
Button {
@@ -46,7 +46,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 2"
- onClicked: controller_backend.select_scene(2)
+ onClicked: controller_backend.select_scene(1)
}
Button {
@@ -55,7 +55,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 3"
- onClicked: controller_backend.select_scene(3)
+ onClicked: controller_backend.select_scene(2)
}
Button {
@@ -64,7 +64,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 4"
- onClicked: controller_backend.select_scene(4)
+ onClicked: controller_backend.select_scene(3)
}
Button {
@@ -73,7 +73,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 5"
- onClicked: controller_backend.select_scene(5)
+ onClicked: controller_backend.select_scene(4)
}
Button {
@@ -82,7 +82,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 6"
- onClicked: controller_backend.select_scene(6)
+ onClicked: controller_backend.select_scene(5)
}
Button {
@@ -91,7 +91,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 7"
- onClicked: controller_backend.select_scene(7)
+ onClicked: controller_backend.select_scene(6)
}
Button {
@@ -100,7 +100,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 8"
- onClicked: controller_backend.select_scene(8)
+ onClicked: controller_backend.select_scene(7)
}
Button {
@@ -109,7 +109,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 9"
- onClicked: controller_backend.select_scene(9)
+ onClicked: controller_backend.select_scene(8)
}
}
\ No newline at end of file
diff --git a/src/starsky_presenter/resources/scenes.yml b/src/starsky_presenter/resources/scenes.yml
index a5e78fd..951a47b 100644
--- a/src/starsky_presenter/resources/scenes.yml
+++ b/src/starsky_presenter/resources/scenes.yml
@@ -1,4 +1,3 @@
--
- star-bg-01:
x: 0.6
star-bg-02: