mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-03-25 19:40:27 +00:00
Lua api fixes[ci skip]
This commit is contained in:
parent
ed2c5f510a
commit
596c7b8aff
|
@ -307,8 +307,8 @@ pub fn init(options: LaunchOptions) -> GameResult {
|
|||
|
||||
let mut game = Box::pin(Game::new(&mut context)?);
|
||||
#[cfg(feature = "scripting-lua")]
|
||||
{
|
||||
game.state.get().lua.update_refs(unsafe { &mut *game.state.get() }, &mut context as *mut Context);
|
||||
unsafe {
|
||||
(*game.state.get()).lua.update_refs(&mut *game.state.get(), &mut *context);
|
||||
}
|
||||
|
||||
game.state.get_mut().fs_container = Some(fs_container);
|
||||
|
|
|
@ -160,7 +160,7 @@ impl Doukutsu {
|
|||
// font scale
|
||||
if let Some(font_scale) = state.to_float(3) {
|
||||
if font_scale > 0.0 {
|
||||
game_state.constants.font_scale = font_scale;
|
||||
game_state.font.scale(font_scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,15 +120,15 @@ impl LuaScriptingState {
|
|||
let res = state.do_string(BOOT_SCRIPT);
|
||||
check_status(res, &mut state)?;
|
||||
|
||||
if filesystem::exists(ctx, "/drs-scripts/") {
|
||||
if filesystem::user_exists(ctx, "/drs-scripts/") {
|
||||
let mut script_count = 0;
|
||||
let files = filesystem::read_dir(ctx, "/drs-scripts/")?
|
||||
let files = filesystem::user_read_dir(ctx, "/drs-scripts/")?
|
||||
.filter(|f| f.to_string_lossy().to_lowercase().ends_with(".lua"));
|
||||
|
||||
for file in files {
|
||||
let path = file.clone();
|
||||
|
||||
match filesystem::open(ctx, file) {
|
||||
match filesystem::user_open(ctx, file) {
|
||||
Ok(script) => {
|
||||
if LuaScriptingState::load_script(&mut state, &path.to_string_lossy(), script) {
|
||||
script_count += 1;
|
||||
|
|
|
@ -374,4 +374,12 @@ impl BMFont {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn scale(&mut self, scale: f32) {
|
||||
self.font_scale = scale;
|
||||
}
|
||||
|
||||
pub fn get_scale(&self) -> f32 {
|
||||
self.font_scale
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue