enable render

This commit is contained in:
shenjack 2023-07-21 20:09:24 +08:00
parent 5406e7f5c7
commit ef73925b0a
Signed by: shenjack
GPG Key ID: 7B1134A979775551
4 changed files with 15 additions and 6 deletions

View File

@ -7,8 +7,8 @@ fonts_folder = "assets/fonts"
[window]
style = "None"
width = 1301
height = 970
width = 1112
height = 793
visible = true
gui_scale = 1
caption = "Difficult Rocket v{DR_version}"

View File

@ -100,6 +100,8 @@ if TYPE_CHECKING:
@property
def angle(self) -> float: ...
@property
def angle_r(self) -> float: ...
@property
def angle_v(self) -> float: ...
@property
def explode(self) -> bool: ...

View File

@ -129,7 +129,7 @@ class SR1ShipRender(BaseScreen):
# List/Dict data
self.part_data: Dict[int, SR1PartData] = {}
self.parts_sprite: Dict[int, Sprite] = {}
self.parts_sprite: Dict[int, List[Sprite]] = {}
self.part_box_dict: Dict[int, Rectangle] = {}
self.part_line_box: Dict[int, List[Line]] = {}
self.part_line_list: List[Line] = []
@ -181,15 +181,18 @@ class SR1ShipRender(BaseScreen):
for p_id, parts in self.rust_ship.as_dict().items():
p_id: int
parts: List[Tuple[SR1PartType_rs, SR1PartData_rs]]
part_group = Group(20, parent=self.part_group)
part_group = Group(2, parent=self.part_group)
batch = []
for p_type, p_data in parts:
part_sprite = Sprite(img=self.textures.get_texture(map_ptype_textures(p_data.part_type_id)),
x=p_data.x * 60, y=p_data.y * 60, z=random.random(),
batch=self.main_batch, group=part_group)
part_sprite.rotation = p_data.angle_r
part_sprite.scale_x = -1 if p_data.flip_x else 1
part_sprite.scale_y = -1 if p_data.flip_y else 1
batch.append(part_sprite)
self.parts_sprite[p_id] = batch
count += 1
if count >= each_count:
count = 0

View File

@ -50,7 +50,11 @@ class SR1Textures(Options):
if name in self.cached_options:
return self.cached_options.get(name)
else:
return None
img = load(f'assets/textures/parts/{name}.png')
img.anchor_x = img.width // 2
img.anchor_y = img.height // 2
setattr(self, name, img)
return img
Battery: AbstractImage = None
Beam: AbstractImage = None