use store view and update some dr game
This commit is contained in:
parent
9107621fb8
commit
9b72f437a5
@ -37,9 +37,7 @@ class Camera:
|
||||
self.zoom = zoom
|
||||
self.min_zoom = min_zoom
|
||||
self.max_zoom = max_zoom
|
||||
|
||||
def get_view(self):
|
||||
return self.window.view
|
||||
self._stored_view = window.view
|
||||
|
||||
@property
|
||||
def position(self) -> Tuple[float, float]:
|
||||
@ -59,6 +57,7 @@ class Camera:
|
||||
|
||||
def begin(self) -> None:
|
||||
view = self.window.view
|
||||
self._stored_view = view
|
||||
x = self.window.width / self.zoom + (self.dx / self.zoom)
|
||||
y = self.window.height / self.zoom + (self.dy / self.zoom)
|
||||
|
||||
@ -68,14 +67,7 @@ class Camera:
|
||||
self.window.view = view_matrix
|
||||
|
||||
def end(self) -> None:
|
||||
view = self.window.view
|
||||
x = self.window.width / self.zoom + (self.dx / self.zoom)
|
||||
y = self.window.height / self.zoom + (self.dy / self.zoom)
|
||||
|
||||
view_matrix = view.scale((1.0 / self.zoom, 1.0 / self.zoom, 1))
|
||||
view_matrix = view_matrix.translate((-x * self.zoom, -y * self.zoom, 0))
|
||||
|
||||
self.window.view = view_matrix
|
||||
self.window.view = self._stored_view
|
||||
|
||||
def __enter__(self):
|
||||
self.begin()
|
||||
@ -87,7 +79,7 @@ class Camera:
|
||||
|
||||
class CenterCamera(Camera):
|
||||
"""
|
||||
A camera that centers the view on the center of the window
|
||||
A camera that centers the view in the center of the window
|
||||
|
||||
>>> from pyglet.window import Window
|
||||
>>> window = Window()
|
||||
@ -103,6 +95,7 @@ class CenterCamera(Camera):
|
||||
"""
|
||||
def begin(self) -> None:
|
||||
view = self.window.view
|
||||
self._stored_view = view
|
||||
x = self.window.width / 2.0 / self.zoom + (self.dx / self.zoom)
|
||||
y = self.window.height / 2.0 / self.zoom + (self.dy / self.zoom)
|
||||
|
||||
@ -112,12 +105,5 @@ class CenterCamera(Camera):
|
||||
self.window.view = view_matrix
|
||||
|
||||
def end(self) -> None:
|
||||
view = self.window.view
|
||||
x = self.window.width / 2.0 / self.zoom + (self.dx / self.zoom)
|
||||
y = self.window.height / 2.0 / self.zoom + (self.dy / self.zoom)
|
||||
|
||||
view_matrix = view.scale((1.0 / self.zoom, 1.0 / self.zoom, 1))
|
||||
view_matrix = view_matrix.translate((-x * self.zoom, -y * self.zoom, 0))
|
||||
|
||||
self.window.view = view_matrix
|
||||
self.window.view = self._stored_view
|
||||
|
@ -7,8 +7,8 @@ fonts_folder = "libs/fonts"
|
||||
|
||||
[window]
|
||||
style = "None"
|
||||
width = 1268
|
||||
height = 1031
|
||||
width = 1047
|
||||
height = 684
|
||||
visible = true
|
||||
gui_scale = 1
|
||||
caption = "Difficult Rocket v{DR_version}"
|
||||
|
@ -54,7 +54,7 @@ DR_mod_runtime = _DR_mod_runtime()
|
||||
class DR_mod(ModInfo):
|
||||
mod_id = "difficult_rocket_mod"
|
||||
name = "Difficult Rocket mod"
|
||||
version = Version("0.3.1.1")
|
||||
version = Version("0.3.1.2")
|
||||
|
||||
writer = "shenjackyuanjie"
|
||||
link = "shenjack.top"
|
||||
|
@ -199,9 +199,9 @@ class SR1ShipRender(BaseScreen):
|
||||
count += 1
|
||||
if count >= each_count:
|
||||
count = 0
|
||||
yield each_count
|
||||
yield count
|
||||
if DR_mod_runtime.use_DR_rust:
|
||||
connect_line_group = Group(5, parent=self.part_group)
|
||||
connect_line_group = Group(7, parent=self.part_group)
|
||||
for connect in self.rust_ship.connection:
|
||||
# 连接线
|
||||
parent_part_data = self.part_data[connect[2]]
|
||||
@ -212,9 +212,9 @@ class SR1ShipRender(BaseScreen):
|
||||
batch=self.main_batch, group=connect_line_group,
|
||||
width=1, color=color))
|
||||
count += 1
|
||||
if count >= each_count:
|
||||
if count >= each_count * 3:
|
||||
count = 0
|
||||
yield each_count
|
||||
yield count
|
||||
self.drawing = False
|
||||
raise GeneratorExit
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user