mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-09-20 19:44:00 +00:00
Compare commits
No commits in common. "b087c645d628548ad32cd0c251c39fb8d128697c" and "8b8c5435263df0d82a6c52d9c83597baabb3d5f2" have entirely different histories.
b087c645d6
...
8b8c543526
|
@ -99,6 +99,14 @@ impl TouchControls {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw(&self, canvas_size: (f32, f32), constants: &EngineConstants, texture_set: &mut TextureSet, ctx: &mut Context) -> GameResult {
|
pub fn draw(&self, canvas_size: (f32, f32), constants: &EngineConstants, texture_set: &mut TextureSet, ctx: &mut Context) -> GameResult {
|
||||||
|
let batch = texture_set.get_or_load_batch(ctx, constants, "Caret")?;
|
||||||
|
let rect = Rect::new_size(104, 120, 24, 24);
|
||||||
|
for point in self.points.iter() {
|
||||||
|
batch.add_rect(point.position.0 as f32 - 12.0, point.position.1 as f32 - 12.0, &rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
batch.draw(ctx)?;
|
||||||
|
|
||||||
if self.control_type == TouchControlType::Controls {
|
if self.control_type == TouchControlType::Controls {
|
||||||
let batch = texture_set.get_or_load_batch(ctx, constants, "builtin/touch")?;
|
let batch = texture_set.get_or_load_batch(ctx, constants, "builtin/touch")?;
|
||||||
let color = (255, 255, 255, 160);
|
let color = (255, 255, 255, 160);
|
||||||
|
|
|
@ -249,10 +249,6 @@ pub fn android_main() {
|
||||||
request_perms().expect("Failed to attach to the JVM and request storage permissions.");
|
request_perms().expect("Failed to attach to the JVM and request storage permissions.");
|
||||||
|
|
||||||
env::set_var("CAVESTORY_DATA_DIR", "/storage/emulated/0/doukutsu");
|
env::set_var("CAVESTORY_DATA_DIR", "/storage/emulated/0/doukutsu");
|
||||||
|
|
||||||
let _ = std::fs::create_dir("/storage/emulated/0/doukutsu/");
|
|
||||||
let _ = std::fs::write("/storage/emulated/0/doukutsu/.nomedia", b"");
|
|
||||||
|
|
||||||
init().unwrap();
|
init().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use ggez::GameResult;
|
use ggez::GameResult;
|
||||||
use num_traits::{abs, clamp};
|
use num_traits::{abs, clamp};
|
||||||
|
|
||||||
use crate::caret::CaretType;
|
use crate::common::Direction;
|
||||||
use crate::common::{CDEG_RAD, Direction};
|
|
||||||
use crate::npc::list::NPCList;
|
use crate::npc::list::NPCList;
|
||||||
use crate::npc::NPC;
|
use crate::npc::NPC;
|
||||||
use crate::player::Player;
|
use crate::player::Player;
|
||||||
|
@ -287,273 +286,8 @@ impl NPC {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn tick_n049_skullhead(&mut self, state: &mut SharedGameState, players: [&mut Player; 2], npc_list: &NPCList) -> GameResult {
|
pub(crate) fn tick_n049_skullhead(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult {
|
||||||
let mut parent = self.get_parent_ref_mut(npc_list);
|
let parent = self.get_parent_ref_mut(npc_list);
|
||||||
|
|
||||||
if self.action_num > 9 && parent.as_ref().map(|n| n.npc_type == 3).unwrap_or(false) {
|
|
||||||
self.action_num = 3;
|
|
||||||
self.vel_x = 0;
|
|
||||||
self.vel_y = 0;
|
|
||||||
self.action_counter2 = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.flags.hit_left_wall() {
|
|
||||||
self.direction = Direction::Right;
|
|
||||||
self.vel_x = 0x100;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.flags.hit_right_wall() {
|
|
||||||
self.direction = Direction::Left;
|
|
||||||
self.vel_x = -0x100;
|
|
||||||
}
|
|
||||||
|
|
||||||
match self.action_num {
|
|
||||||
0 | 1 => {
|
|
||||||
if self.action_num == 0 {
|
|
||||||
self.action_num = if parent.is_some() { 10 } else { 1 };
|
|
||||||
}
|
|
||||||
|
|
||||||
self.action_counter += 1;
|
|
||||||
if self.action_counter > 3 {
|
|
||||||
self.vel_y = -0x400;
|
|
||||||
self.action_num = 3;
|
|
||||||
self.anim_num = 2;
|
|
||||||
|
|
||||||
if self.action_counter2 > 0 {
|
|
||||||
self.vel_x = if self.direction == Direction::Left { -0x200 } else { 0x200 };
|
|
||||||
} else if self.direction != Direction::Left {
|
|
||||||
self.vel_x = 0x100;
|
|
||||||
} else {
|
|
||||||
self.vel_x = -0x100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.anim_num = 1;
|
|
||||||
}
|
|
||||||
3 => {
|
|
||||||
if self.flags.hit_bottom_wall() {
|
|
||||||
self.action_num = 1;
|
|
||||||
self.action_counter = 0;
|
|
||||||
self.vel_x = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.anim_num = if self.flags.hit_bottom_wall() || self.vel_y > 0 { 1 } else { 2 };
|
|
||||||
}
|
|
||||||
10 => {
|
|
||||||
if self.vel_y2 >= 50 {
|
|
||||||
let player = self.get_closest_player_mut(players);
|
|
||||||
|
|
||||||
if abs(self.x - player.x) < 0x10000
|
|
||||||
&& abs(self.y - player.y) < 0xc000 {
|
|
||||||
self.action_num = 11;
|
|
||||||
self.action_counter = 0;
|
|
||||||
self.anim_num = 2;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self.vel_y2 += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
11 => {
|
|
||||||
self.action_counter += 1;
|
|
||||||
if self.action_counter == 30 || self.action_counter == 35 {
|
|
||||||
let player = self.get_closest_player_mut(players);
|
|
||||||
|
|
||||||
let angle = f64::atan2((self.y + 0x800 - player.y) as f64, (self.x - player.x) as f64);
|
|
||||||
|
|
||||||
let mut npc = NPC::create(50, &state.npc_table);
|
|
||||||
npc.cond.set_alive(true);
|
|
||||||
npc.x = self.x;
|
|
||||||
npc.y = self.y;
|
|
||||||
npc.vel_x = (angle.cos() * -1024.0) as i32;
|
|
||||||
npc.vel_y = (angle.sin() * -1024.0) as i32;
|
|
||||||
|
|
||||||
let _ = npc_list.spawn(0x100, npc);
|
|
||||||
state.sound_manager.play_sfx(39);
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.action_counter > 50 {
|
|
||||||
self.action_num = 10;
|
|
||||||
self.vel_y2 = 0;
|
|
||||||
self.anim_num = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.action_num > 9 {
|
|
||||||
if let Some(parent) = parent {
|
|
||||||
self.x = parent.x;
|
|
||||||
self.y = parent.y + 0x2000;
|
|
||||||
self.direction = parent.direction;
|
|
||||||
parent.vel_y2 -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.vel_y += 0x40;
|
|
||||||
if self.vel_y > 0x5ff {
|
|
||||||
self.vel_y = 0x5ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.x += self.vel_x;
|
|
||||||
self.y += self.vel_y;
|
|
||||||
|
|
||||||
|
|
||||||
let dir_offset = if self.direction == Direction::Left { 0 } else { 3 };
|
|
||||||
|
|
||||||
self.anim_rect = state.constants.npc.n049_skullhead[self.anim_num as usize + dir_offset];
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn tick_n050_skeleton_projectile(&mut self, state: &mut SharedGameState) -> GameResult {
|
|
||||||
match self.action_num {
|
|
||||||
0 | 1 => {
|
|
||||||
if self.action_num == 0 {
|
|
||||||
if self.direction == Direction::Right {
|
|
||||||
self.action_num = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.x += self.vel_x;
|
|
||||||
self.y += self.vel_y;
|
|
||||||
|
|
||||||
if self.flags.hit_left_wall() {
|
|
||||||
self.action_num = 2;
|
|
||||||
self.vel_x = 0x200;
|
|
||||||
self.action_counter2 += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.flags.hit_right_wall() {
|
|
||||||
self.action_num = 2;
|
|
||||||
self.vel_x = -0x200;
|
|
||||||
self.action_counter2 += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.flags.hit_top_wall() {
|
|
||||||
self.action_num = 2;
|
|
||||||
self.vel_y = 0x200;
|
|
||||||
self.action_counter2 += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.flags.hit_bottom_wall() {
|
|
||||||
self.action_num = 2;
|
|
||||||
self.vel_y = -0x200;
|
|
||||||
self.action_counter2 += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2 => {
|
|
||||||
self.vel_y += 0x40;
|
|
||||||
self.x += self.vel_x;
|
|
||||||
self.y += self.vel_y;
|
|
||||||
|
|
||||||
if self.flags.hit_bottom_wall() {
|
|
||||||
self.action_counter2 += 1;
|
|
||||||
if self.action_counter2 > 1 {
|
|
||||||
state.create_caret(self.x, self.y, CaretType::ProjectileDissipation, Direction::Left);
|
|
||||||
self.cond.set_alive(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.vel_y = clamp(self.vel_y, -0x5ff, 0x5ff);
|
|
||||||
|
|
||||||
self.anim_counter += 1;
|
|
||||||
if self.anim_counter > 1 {
|
|
||||||
self.anim_counter = 0;
|
|
||||||
|
|
||||||
self.anim_num = if self.direction == Direction::Left {
|
|
||||||
(self.anim_num + 1) % 4
|
|
||||||
} else {
|
|
||||||
self.anim_num.wrapping_sub(1) % 4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.anim_rect = state.constants.npc.n050_skeleton_projectile[self.anim_num as usize];
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn tick_n051_crow_and_skullhead(&mut self, state: &mut SharedGameState, players: [&mut Player; 2], npc_list: &NPCList) -> GameResult {
|
|
||||||
let player = self.get_closest_player_mut(players);
|
|
||||||
|
|
||||||
match self.action_num {
|
|
||||||
0 | 1 => {
|
|
||||||
if self.action_num == 0 {
|
|
||||||
self.action_num = 1;
|
|
||||||
self.target_x = self.x;
|
|
||||||
self.target_y = self.y;
|
|
||||||
self.vel_y = 0x400;
|
|
||||||
|
|
||||||
let mut npc = NPC::create(49, &state.npc_table);
|
|
||||||
npc.cond.set_alive(true);
|
|
||||||
npc.parent_id = self.id;
|
|
||||||
let _ = npc_list.spawn(0, npc);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.direction = if player.x >= self.x { Direction::Right } else { Direction::Left };
|
|
||||||
self.vel_y += (self.target_y - self.y).signum() * 0x0a;
|
|
||||||
self.vel_y = clamp(self.vel_y, -0x200, 0x200);
|
|
||||||
|
|
||||||
if self.vel_y2 >= 10 {
|
|
||||||
self.action_num = 2;
|
|
||||||
} else {
|
|
||||||
self.vel_y2 += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2 => {
|
|
||||||
self.direction = if player.x >= self.x { Direction::Right } else { Direction::Left };
|
|
||||||
|
|
||||||
self.vel_x += if self.y <= player.y + 0x4000 {
|
|
||||||
(player.x - self.x).signum() * 0x10
|
|
||||||
} else {
|
|
||||||
(self.x - player.x).signum() * 0x10
|
|
||||||
};
|
|
||||||
|
|
||||||
self.vel_y += (player.y - self.y).signum() * 0x10;
|
|
||||||
|
|
||||||
if self.shock > 0 {
|
|
||||||
self.vel_x = 0;
|
|
||||||
self.vel_y += 0x20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.vel_x < 0 && self.flags.hit_left_wall() {
|
|
||||||
self.vel_x = 0x100;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.vel_x > 0 && self.flags.hit_right_wall() {
|
|
||||||
self.vel_x = -0x100;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.vel_y < 0 && self.flags.hit_top_wall() {
|
|
||||||
self.vel_y = 0x100;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.vel_y > 0 && self.flags.hit_bottom_wall() {
|
|
||||||
self.vel_y = -0x100;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.vel_x = clamp(self.vel_x, -0x400, 0x400);
|
|
||||||
self.vel_y = clamp(self.vel_y, -0x200, 0x200);
|
|
||||||
|
|
||||||
self.x += self.vel_x;
|
|
||||||
self.y += self.vel_y;
|
|
||||||
|
|
||||||
if self.shock > 0 {
|
|
||||||
self.anim_num = 4;
|
|
||||||
} else if self.action_num == 2 && self.y < player.y - 0x4000 {
|
|
||||||
self.anim_num = 0;
|
|
||||||
} else if self.action_num != 0 {
|
|
||||||
self.animate(1, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
let dir_offset = if self.direction == Direction::Left { 0 } else { 5 };
|
|
||||||
|
|
||||||
self.anim_rect = state.constants.npc.n051_crow_and_skullhead[self.anim_num as usize + dir_offset];
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,9 +198,7 @@ impl GameEntity<([&mut Player; 2], &NPCList, &mut Stage, &BulletManager)> for NP
|
||||||
46 => self.tick_n046_hv_trigger(players),
|
46 => self.tick_n046_hv_trigger(players),
|
||||||
47 => self.tick_n047_sandcroc(state, players),
|
47 => self.tick_n047_sandcroc(state, players),
|
||||||
48 => self.tick_n048_omega_projectiles(state),
|
48 => self.tick_n048_omega_projectiles(state),
|
||||||
49 => self.tick_n049_skullhead(state, players, npc_list),
|
49 => self.tick_n049_skullhead(state, npc_list),
|
||||||
50 => self.tick_n050_skeleton_projectile(state),
|
|
||||||
51 => self.tick_n051_crow_and_skullhead(state, players, npc_list),
|
|
||||||
52 => self.tick_n052_sitting_blue_robot(state),
|
52 => self.tick_n052_sitting_blue_robot(state),
|
||||||
55 => self.tick_n055_kazuma(state),
|
55 => self.tick_n055_kazuma(state),
|
||||||
58 => self.tick_n058_basu(state, players, npc_list),
|
58 => self.tick_n058_basu(state, players, npc_list),
|
||||||
|
|
|
@ -5,7 +5,7 @@ pub trait RNG {
|
||||||
fn next(&self) -> i32;
|
fn next(&self) -> i32;
|
||||||
|
|
||||||
fn range(&self, range: Range<i32>) -> i32 {
|
fn range(&self, range: Range<i32>) -> i32 {
|
||||||
range.start.saturating_add((self.next() >> 2) % range.len() as i32)
|
range.start.wrapping_add((self.next() >> 2) % (range.end.wrapping_sub(range.start).wrapping_add(1)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
use ggez::{Context, filesystem, GameResult};
|
use ggez::{Context, filesystem, GameResult};
|
||||||
|
|
||||||
use crate::npc::NPCTable;
|
use crate::npc::NPCTable;
|
||||||
use crate::scene::no_data_scene::NoDataScene;
|
|
||||||
use crate::scene::Scene;
|
use crate::scene::Scene;
|
||||||
use crate::shared_game_state::SharedGameState;
|
use crate::shared_game_state::SharedGameState;
|
||||||
use crate::stage::StageData;
|
use crate::stage::StageData;
|
||||||
|
@ -17,8 +15,12 @@ impl LoadingScene {
|
||||||
tick: 0,
|
tick: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn load_stuff(&mut self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult {
|
impl Scene for LoadingScene {
|
||||||
|
fn tick(&mut self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult {
|
||||||
|
// deferred to let the loading image draw
|
||||||
|
if self.tick == 1 {
|
||||||
let stages = StageData::load_stage_table(ctx, &state.base_path)?;
|
let stages = StageData::load_stage_table(ctx, &state.base_path)?;
|
||||||
state.stages = stages;
|
state.stages = stages;
|
||||||
let npc_tbl = filesystem::open(ctx, [&state.base_path, "/npc.tbl"].join(""))?;
|
let npc_tbl = filesystem::open(ctx, [&state.base_path, "/npc.tbl"].join(""))?;
|
||||||
|
@ -37,20 +39,6 @@ impl LoadingScene {
|
||||||
state.textscript_vm.set_stage_select_script(stage_select_script);
|
state.textscript_vm.set_stage_select_script(stage_select_script);
|
||||||
|
|
||||||
state.start_intro(ctx)?;
|
state.start_intro(ctx)?;
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Scene for LoadingScene {
|
|
||||||
fn tick(&mut self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult {
|
|
||||||
// deferred to let the loading image draw
|
|
||||||
if self.tick == 1 {
|
|
||||||
if let Err(err) = self.load_stuff(state, ctx) {
|
|
||||||
log::error!("Failed to load game data: {}", err);
|
|
||||||
|
|
||||||
state.next_scene = Some(Box::new(NoDataScene::new(err)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.tick += 1;
|
self.tick += 1;
|
||||||
|
@ -58,17 +46,11 @@ impl Scene for LoadingScene {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw(&self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult {
|
fn draw(&self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult {
|
||||||
match state.texture_set.get_or_load_batch(ctx, &state.constants, "Loading") {
|
let batch = state.texture_set.get_or_load_batch(ctx, &state.constants, "Loading")?;
|
||||||
Ok(batch) => {
|
|
||||||
batch.add(((state.canvas_size.0 - batch.width() as f32) / 2.0).floor(),
|
batch.add(((state.canvas_size.0 - batch.width() as f32) / 2.0).floor(),
|
||||||
((state.canvas_size.1 - batch.height() as f32) / 2.0).floor());
|
((state.canvas_size.1 - batch.height() as f32) / 2.0).floor());
|
||||||
batch.draw(ctx)?;
|
batch.draw(ctx)?;
|
||||||
}
|
|
||||||
Err(err) => {
|
|
||||||
state.next_scene = Some(Box::new(NoDataScene::new(err)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ use crate::ui::Components;
|
||||||
|
|
||||||
pub mod game_scene;
|
pub mod game_scene;
|
||||||
pub mod loading_scene;
|
pub mod loading_scene;
|
||||||
pub mod no_data_scene;
|
|
||||||
pub mod title_scene;
|
pub mod title_scene;
|
||||||
|
|
||||||
/// Implement this trait on any object that represents an interactive game screen.
|
/// Implement this trait on any object that represents an interactive game screen.
|
||||||
|
|
|
@ -1,88 +0,0 @@
|
||||||
use ggez::{Context, GameError, GameResult};
|
|
||||||
|
|
||||||
use crate::common::Rect;
|
|
||||||
use crate::scene::Scene;
|
|
||||||
use crate::shared_game_state::SharedGameState;
|
|
||||||
|
|
||||||
pub struct NoDataScene {
|
|
||||||
flag: bool,
|
|
||||||
err: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl NoDataScene {
|
|
||||||
pub fn new(err: GameError) -> Self {
|
|
||||||
Self {
|
|
||||||
flag: false,
|
|
||||||
err: err.to_string(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static REL_URL: &str = "https://github.com/doukutsu-rs/game-data/releases";
|
|
||||||
|
|
||||||
impl Scene for NoDataScene {
|
|
||||||
fn tick(&mut self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult {
|
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
|
||||||
{
|
|
||||||
if !self.flag {
|
|
||||||
self.flag = true;
|
|
||||||
let _ = std::fs::create_dir("/sdcard/doukutsu/");
|
|
||||||
let _ = std::fs::write("/sdcard/doukutsu/extract game data here.txt", REL_URL);
|
|
||||||
let _ = std::fs::write("/sdcard/doukutsu/.nomedia", b"");
|
|
||||||
}
|
|
||||||
|
|
||||||
let screen = Rect::new(0, 0, state.canvas_size.0 as isize, state.canvas_size.1 as isize);
|
|
||||||
if state.touch_controls.consume_click_in(screen) {
|
|
||||||
if let Err(err) = webbrowser::open(REL_URL) {
|
|
||||||
self.err = err.to_string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn draw(&self, state: &mut SharedGameState, ctx: &mut Context) -> GameResult {
|
|
||||||
{
|
|
||||||
let die = "doukutsu-rs internal error";
|
|
||||||
let die_width = state.font.text_width(die.chars().clone(), &state.constants);
|
|
||||||
state.font.draw_colored_text(die.chars(), (state.canvas_size.0 - die_width) / 2.0, 10.0,
|
|
||||||
(255, 100, 100, 255), &state.constants, &mut state.texture_set, ctx)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
let ftl = "Failed to load game data.";
|
|
||||||
let ftl_width = state.font.text_width(ftl.chars().clone(), &state.constants);
|
|
||||||
state.font.draw_colored_text(ftl.chars(), (state.canvas_size.0 - ftl_width) / 2.0, 30.0,
|
|
||||||
(255, 100, 100, 255), &state.constants, &mut state.texture_set, ctx)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
|
||||||
{
|
|
||||||
let ftl = "It's likely that you haven't extracted the game data properly.";
|
|
||||||
let ftl2 = "Click here to open the guide.";
|
|
||||||
let ftl_width = state.font.text_width(ftl.chars().clone(), &state.constants);
|
|
||||||
let ftl2_width = state.font.text_width(ftl2.chars().clone(), &state.constants);
|
|
||||||
let ftl3_width = state.font.text_width(REL_URL.chars().clone(), &state.constants);
|
|
||||||
|
|
||||||
state.font.draw_colored_text(ftl.chars(), (state.canvas_size.0 - ftl_width) / 2.0, 60.0,
|
|
||||||
(255, 255, 0, 255), &state.constants, &mut state.texture_set, ctx)?;
|
|
||||||
|
|
||||||
|
|
||||||
state.font.draw_colored_text(ftl2.chars(), (state.canvas_size.0 - ftl2_width) / 2.0, 80.0,
|
|
||||||
(255, 255, 0, 255), &state.constants, &mut state.texture_set, ctx)?;
|
|
||||||
|
|
||||||
state.font.draw_colored_text(REL_URL.chars(), (state.canvas_size.0 - ftl3_width) / 2.0, 100.0,
|
|
||||||
(255, 255, 0, 255), &state.constants, &mut state.texture_set, ctx)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
let err_width = state.font.text_width(self.err.chars().clone(), &state.constants);
|
|
||||||
state.font.draw_text(self.err.chars(), (state.canvas_size.0 - err_width) / 2.0, 140.0,
|
|
||||||
&state.constants, &mut state.texture_set, ctx)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue