add some
This commit is contained in:
parent
46c8160955
commit
07dfc2b5e9
@ -33,11 +33,21 @@ class BaseScreen(EventDispatcher):
|
||||
命令输入事件
|
||||
"""
|
||||
|
||||
def on_message(self, message: CommandText, window: "ClientWindow"):
|
||||
"""
|
||||
消息输入事件
|
||||
"""
|
||||
|
||||
def draw_update(self, tick: float, window: "ClientWindow"):
|
||||
"""
|
||||
画面更新
|
||||
"""
|
||||
|
||||
def draw_batch(self, window: "ClientWindow"):
|
||||
"""
|
||||
画面绘制
|
||||
"""
|
||||
|
||||
"""
|
||||
Pyglet 定义的事件
|
||||
"""
|
||||
|
@ -168,7 +168,6 @@ class ClientWindow(Window):
|
||||
self.net_mode = net_mode
|
||||
self.run_input = False
|
||||
# configs
|
||||
self.set_icon(pyglet.image.load('./textures/icon.png'))
|
||||
self.main_config = tools.load_file('./configs/main.toml')
|
||||
self.game_config = tools.load_file('./configs/game.config')
|
||||
# FPS
|
||||
@ -205,6 +204,7 @@ class ClientWindow(Window):
|
||||
self.count = 0
|
||||
|
||||
def setup(self):
|
||||
self.set_icon(pyglet.image.load('./textures/icon.png'))
|
||||
self.load_fonts()
|
||||
# TODO 读取配置文件,加载不同的屏幕,解耦
|
||||
self.screen_list.append(DRDEBUGScreen(self))
|
||||
@ -218,6 +218,7 @@ class ClientWindow(Window):
|
||||
pyglet_load_fonts_folder(fonts_folder_path)
|
||||
|
||||
def start_game(self) -> None:
|
||||
self.set_icon(pyglet.image.load('./textures/icon.png'))
|
||||
self.run_input = True
|
||||
self.read_input()
|
||||
pyglet.app.event_loop.run(1 / self.main_config['runtime']['fps'])
|
||||
@ -329,7 +330,7 @@ class ClientWindow(Window):
|
||||
# self.command_tree.parse(command.plain_command)
|
||||
|
||||
@_call_screen_after
|
||||
def on_message(self, message: line.CommandLine.text):
|
||||
def on_message(self, message: line.CommandText):
|
||||
self.logger.info(tr().window.message.text().format(message))
|
||||
|
||||
"""
|
||||
|
@ -5,6 +5,7 @@
|
||||
# -------------------------------
|
||||
|
||||
import time
|
||||
import random
|
||||
import logging
|
||||
from xml.etree import ElementTree
|
||||
from xml.etree.ElementTree import Element
|
||||
@ -19,6 +20,7 @@ from pyglet.text import Label
|
||||
from pyglet.shapes import Line
|
||||
from pyglet.sprite import Sprite
|
||||
from pyglet.graphics import Batch, Group
|
||||
from pyglet.image import load as load_image
|
||||
|
||||
# Difficult Rocket
|
||||
from Difficult_Rocket import DR_option
|
||||
@ -163,7 +165,7 @@ class SR1ShipRender(BaseScreen):
|
||||
render_y = part.y * 60
|
||||
# 你就这里改吧
|
||||
cache_sprite = Sprite(img=self.textures.get_texture(part.textures),
|
||||
x=render_x, y=render_y,
|
||||
x=render_x, y=render_y, z=random.random(),
|
||||
batch=self.part_batch, group=self.part_group)
|
||||
# 你得帮我换算一下 XML 里的 x y 和这里的屏幕像素的关系(OK
|
||||
# 旋转啥的不是大问题, 我找你要那个渲染代码就是要 x y 的换算逻辑
|
||||
|
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
mod logger;
|
||||
mod plugin;
|
||||
mod python;
|
||||
mod render;
|
||||
mod simulator;
|
||||
|
7
libs/Difficult_Rocket_rs/src/src/plugin.rs
Normal file
7
libs/Difficult_Rocket_rs/src/src/plugin.rs
Normal file
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* -------------------------------
|
||||
* Difficult Rocket
|
||||
* Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
||||
* All rights reserved
|
||||
* -------------------------------
|
||||
*/
|
@ -9,6 +9,7 @@
|
||||
use pyo3::prelude::*;
|
||||
use rapier2d_f64::prelude::*;
|
||||
|
||||
|
||||
#[pyfunction]
|
||||
#[pyo3(name = "simluation")]
|
||||
pub fn simluation() -> PyResult<()> {
|
||||
@ -59,7 +60,8 @@ pub fn simluation() -> PyResult<()> {
|
||||
);
|
||||
|
||||
let ball_body = &rigid_body_set[ball_body_handle];
|
||||
println!("Ball altitude: {}", ball_body.translation());
|
||||
println!("Ball altitude: {} {}", ball_body.translation().x, ball_body.translation().y);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user