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_update(self, tick: float, window: "ClientWindow"):
|
||||||
"""
|
"""
|
||||||
画面更新
|
画面更新
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def draw_batch(self, window: "ClientWindow"):
|
||||||
|
"""
|
||||||
|
画面绘制
|
||||||
|
"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Pyglet 定义的事件
|
Pyglet 定义的事件
|
||||||
"""
|
"""
|
||||||
|
@ -168,7 +168,6 @@ class ClientWindow(Window):
|
|||||||
self.net_mode = net_mode
|
self.net_mode = net_mode
|
||||||
self.run_input = False
|
self.run_input = False
|
||||||
# configs
|
# configs
|
||||||
self.set_icon(pyglet.image.load('./textures/icon.png'))
|
|
||||||
self.main_config = tools.load_file('./configs/main.toml')
|
self.main_config = tools.load_file('./configs/main.toml')
|
||||||
self.game_config = tools.load_file('./configs/game.config')
|
self.game_config = tools.load_file('./configs/game.config')
|
||||||
# FPS
|
# FPS
|
||||||
@ -205,6 +204,7 @@ class ClientWindow(Window):
|
|||||||
self.count = 0
|
self.count = 0
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
|
self.set_icon(pyglet.image.load('./textures/icon.png'))
|
||||||
self.load_fonts()
|
self.load_fonts()
|
||||||
# TODO 读取配置文件,加载不同的屏幕,解耦
|
# TODO 读取配置文件,加载不同的屏幕,解耦
|
||||||
self.screen_list.append(DRDEBUGScreen(self))
|
self.screen_list.append(DRDEBUGScreen(self))
|
||||||
@ -218,6 +218,7 @@ class ClientWindow(Window):
|
|||||||
pyglet_load_fonts_folder(fonts_folder_path)
|
pyglet_load_fonts_folder(fonts_folder_path)
|
||||||
|
|
||||||
def start_game(self) -> None:
|
def start_game(self) -> None:
|
||||||
|
self.set_icon(pyglet.image.load('./textures/icon.png'))
|
||||||
self.run_input = True
|
self.run_input = True
|
||||||
self.read_input()
|
self.read_input()
|
||||||
pyglet.app.event_loop.run(1 / self.main_config['runtime']['fps'])
|
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)
|
# self.command_tree.parse(command.plain_command)
|
||||||
|
|
||||||
@_call_screen_after
|
@_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))
|
self.logger.info(tr().window.message.text().format(message))
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
import random
|
||||||
import logging
|
import logging
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
from xml.etree.ElementTree import Element
|
from xml.etree.ElementTree import Element
|
||||||
@ -19,6 +20,7 @@ from pyglet.text import Label
|
|||||||
from pyglet.shapes import Line
|
from pyglet.shapes import Line
|
||||||
from pyglet.sprite import Sprite
|
from pyglet.sprite import Sprite
|
||||||
from pyglet.graphics import Batch, Group
|
from pyglet.graphics import Batch, Group
|
||||||
|
from pyglet.image import load as load_image
|
||||||
|
|
||||||
# Difficult Rocket
|
# Difficult Rocket
|
||||||
from Difficult_Rocket import DR_option
|
from Difficult_Rocket import DR_option
|
||||||
@ -163,7 +165,7 @@ class SR1ShipRender(BaseScreen):
|
|||||||
render_y = part.y * 60
|
render_y = part.y * 60
|
||||||
# 你就这里改吧
|
# 你就这里改吧
|
||||||
cache_sprite = Sprite(img=self.textures.get_texture(part.textures),
|
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)
|
batch=self.part_batch, group=self.part_group)
|
||||||
# 你得帮我换算一下 XML 里的 x y 和这里的屏幕像素的关系(OK
|
# 你得帮我换算一下 XML 里的 x y 和这里的屏幕像素的关系(OK
|
||||||
# 旋转啥的不是大问题, 我找你要那个渲染代码就是要 x y 的换算逻辑
|
# 旋转啥的不是大问题, 我找你要那个渲染代码就是要 x y 的换算逻辑
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
mod logger;
|
mod logger;
|
||||||
|
mod plugin;
|
||||||
mod python;
|
mod python;
|
||||||
mod render;
|
mod render;
|
||||||
mod simulator;
|
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 pyo3::prelude::*;
|
||||||
use rapier2d_f64::prelude::*;
|
use rapier2d_f64::prelude::*;
|
||||||
|
|
||||||
|
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
#[pyo3(name = "simluation")]
|
#[pyo3(name = "simluation")]
|
||||||
pub fn simluation() -> PyResult<()> {
|
pub fn simluation() -> PyResult<()> {
|
||||||
@ -59,7 +60,8 @@ pub fn simluation() -> PyResult<()> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let ball_body = &rigid_body_set[ball_body_handle];
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user