Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production release #300

Merged
merged 18 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .backstage/build-tile-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

const fs = require("fs");
const path = require("path");
const { Jimp } = require("jimp");

async function processImage() {
const IMAGE_INPUT_PATH = path.join(
__dirname,
"../truncate_client/img/truncate_packed_pre.png",
);
const IMAGE_OUTPUT_PATH = path.join(
__dirname,
"../truncate_client/img/truncate_packed.png",
);

const image = await Jimp.read(IMAGE_INPUT_PATH);

image.scan((x, y, idx) => {
const red = image.bitmap.data[idx + 0];
const green = image.bitmap.data[idx + 1];
const blue = image.bitmap.data[idx + 2];

// Find pure magenta and make it transparent
if (red === 255 && green === 0 && blue === 255) {
image.bitmap.data[idx + 3] = 0;
}
});

await image.write(IMAGE_OUTPUT_PATH);
}

processImage().catch((err) => {
console.error("Error processing image:", err);
});

const INPUT_FILE = path.join(__dirname, "../truncate_client/img/tile_order");
const OUTPUT_RUST = path.join(
Expand Down
5 changes: 5 additions & 0 deletions .backstage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"devDependencies": {
"jimp": "^1.6.0"
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ kaikki*
node_modules
word_definitions/package-lock.json
truncate_client/img/package-lock.json
truncate_client/img/truncate_packed_pre.png
_site
# ungzipped word definition db
defs.db
Expand All @@ -18,3 +19,4 @@ dict_builder/support_data/generated_scowl_wordlists
dict_builder/support_data/en_word_freqs.txt
dict_builder/support_data/objectionable.json
dict_builder/support_data/wordnik_wordlist.txt
.backstage/package-lock.json
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ cd truncate_dueller && cargo run --release
- **Trim Cels**: unchecked
- **Extrude**: CHECKED!
- **Output**:
- **Output File**: `truncate_packed.png`
- **Output File**: `truncate_packed_pre.png`
- **JSON Data** unchecked

If you modified the tile order at all:
Then:
- Edit `truncate_client/img/tile_order` to match the new ordering of tiles
- If you added something 32x32, and thus taking up four tiles, suffix their tile names with `_NW`, `_NE`, `_SW`, and `_SE`
- From the root of the repo, run `.backstage/build-tile-data.js` to rerun the codegen for using tiles

- This also generates the final truncate_packed.png that slightly modified the export (e.g. removes magenta mask)
208 changes: 208 additions & 0 deletions truncate_client/img/tile_order
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,211 @@ TERRAIN_BUTTON_NW
TERRAIN_BUTTON_NE
TERRAIN_BUTTON_SW
TERRAIN_BUTTON_SE
LETTER_SOUTH_A_NW
LETTER_SOUTH_A_NE
LETTER_SOUTH_A_SW
LETTER_SOUTH_A_SE
LETTER_SOUTH_B_NW
LETTER_SOUTH_B_NE
LETTER_SOUTH_B_SW
LETTER_SOUTH_B_SE
LETTER_SOUTH_C_NW
LETTER_SOUTH_C_NE
LETTER_SOUTH_C_SW
LETTER_SOUTH_C_SE
LETTER_SOUTH_D_NW
LETTER_SOUTH_D_NE
LETTER_SOUTH_D_SW
LETTER_SOUTH_D_SE
LETTER_SOUTH_E_NW
LETTER_SOUTH_E_NE
LETTER_SOUTH_E_SW
LETTER_SOUTH_E_SE
LETTER_SOUTH_F_NW
LETTER_SOUTH_F_NE
LETTER_SOUTH_F_SW
LETTER_SOUTH_F_SE
LETTER_SOUTH_G_NW
LETTER_SOUTH_G_NE
LETTER_SOUTH_G_SW
LETTER_SOUTH_G_SE
LETTER_SOUTH_H_NW
LETTER_SOUTH_H_NE
LETTER_SOUTH_H_SW
LETTER_SOUTH_H_SE
LETTER_SOUTH_I_NW
LETTER_SOUTH_I_NE
LETTER_SOUTH_I_SW
LETTER_SOUTH_I_SE
LETTER_SOUTH_J_NW
LETTER_SOUTH_J_NE
LETTER_SOUTH_J_SW
LETTER_SOUTH_J_SE
LETTER_SOUTH_K_NW
LETTER_SOUTH_K_NE
LETTER_SOUTH_K_SW
LETTER_SOUTH_K_SE
LETTER_SOUTH_L_NW
LETTER_SOUTH_L_NE
LETTER_SOUTH_L_SW
LETTER_SOUTH_L_SE
LETTER_SOUTH_M_NW
LETTER_SOUTH_M_NE
LETTER_SOUTH_M_SW
LETTER_SOUTH_M_SE
LETTER_SOUTH_N_NW
LETTER_SOUTH_N_NE
LETTER_SOUTH_N_SW
LETTER_SOUTH_N_SE
LETTER_SOUTH_O_NW
LETTER_SOUTH_O_NE
LETTER_SOUTH_O_SW
LETTER_SOUTH_O_SE
LETTER_SOUTH_P_NW
LETTER_SOUTH_P_NE
LETTER_SOUTH_P_SW
LETTER_SOUTH_P_SE
LETTER_SOUTH_Q_NW
LETTER_SOUTH_Q_NE
LETTER_SOUTH_Q_SW
LETTER_SOUTH_Q_SE
LETTER_SOUTH_R_NW
LETTER_SOUTH_R_NE
LETTER_SOUTH_R_SW
LETTER_SOUTH_R_SE
LETTER_SOUTH_S_NW
LETTER_SOUTH_S_NE
LETTER_SOUTH_S_SW
LETTER_SOUTH_S_SE
LETTER_SOUTH_T_NW
LETTER_SOUTH_T_NE
LETTER_SOUTH_T_SW
LETTER_SOUTH_T_SE
LETTER_SOUTH_U_NW
LETTER_SOUTH_U_NE
LETTER_SOUTH_U_SW
LETTER_SOUTH_U_SE
LETTER_SOUTH_V_NW
LETTER_SOUTH_V_NE
LETTER_SOUTH_V_SW
LETTER_SOUTH_V_SE
LETTER_SOUTH_W_NW
LETTER_SOUTH_W_NE
LETTER_SOUTH_W_SW
LETTER_SOUTH_W_SE
LETTER_SOUTH_X_NW
LETTER_SOUTH_X_NE
LETTER_SOUTH_X_SW
LETTER_SOUTH_X_SE
LETTER_SOUTH_Y_NW
LETTER_SOUTH_Y_NE
LETTER_SOUTH_Y_SW
LETTER_SOUTH_Y_SE
LETTER_SOUTH_Z_NW
LETTER_SOUTH_Z_NE
LETTER_SOUTH_Z_SW
LETTER_SOUTH_Z_SE
LETTER_NORTH_A_NW
LETTER_NORTH_A_NE
LETTER_NORTH_A_SW
LETTER_NORTH_A_SE
LETTER_NORTH_B_NW
LETTER_NORTH_B_NE
LETTER_NORTH_B_SW
LETTER_NORTH_B_SE
LETTER_NORTH_C_NW
LETTER_NORTH_C_NE
LETTER_NORTH_C_SW
LETTER_NORTH_C_SE
LETTER_NORTH_D_NW
LETTER_NORTH_D_NE
LETTER_NORTH_D_SW
LETTER_NORTH_D_SE
LETTER_NORTH_E_NW
LETTER_NORTH_E_NE
LETTER_NORTH_E_SW
LETTER_NORTH_E_SE
LETTER_NORTH_F_NW
LETTER_NORTH_F_NE
LETTER_NORTH_F_SW
LETTER_NORTH_F_SE
LETTER_NORTH_G_NW
LETTER_NORTH_G_NE
LETTER_NORTH_G_SW
LETTER_NORTH_G_SE
LETTER_NORTH_H_NW
LETTER_NORTH_H_NE
LETTER_NORTH_H_SW
LETTER_NORTH_H_SE
LETTER_NORTH_I_NW
LETTER_NORTH_I_NE
LETTER_NORTH_I_SW
LETTER_NORTH_I_SE
LETTER_NORTH_J_NW
LETTER_NORTH_J_NE
LETTER_NORTH_J_SW
LETTER_NORTH_J_SE
LETTER_NORTH_K_NW
LETTER_NORTH_K_NE
LETTER_NORTH_K_SW
LETTER_NORTH_K_SE
LETTER_NORTH_L_NW
LETTER_NORTH_L_NE
LETTER_NORTH_L_SW
LETTER_NORTH_L_SE
LETTER_NORTH_M_NW
LETTER_NORTH_M_NE
LETTER_NORTH_M_SW
LETTER_NORTH_M_SE
LETTER_NORTH_N_NW
LETTER_NORTH_N_NE
LETTER_NORTH_N_SW
LETTER_NORTH_N_SE
LETTER_NORTH_O_NW
LETTER_NORTH_O_NE
LETTER_NORTH_O_SW
LETTER_NORTH_O_SE
LETTER_NORTH_P_NW
LETTER_NORTH_P_NE
LETTER_NORTH_P_SW
LETTER_NORTH_P_SE
LETTER_NORTH_Q_NW
LETTER_NORTH_Q_NE
LETTER_NORTH_Q_SW
LETTER_NORTH_Q_SE
LETTER_NORTH_R_NW
LETTER_NORTH_R_NE
LETTER_NORTH_R_SW
LETTER_NORTH_R_SE
LETTER_NORTH_S_NW
LETTER_NORTH_S_NE
LETTER_NORTH_S_SW
LETTER_NORTH_S_SE
LETTER_NORTH_T_NW
LETTER_NORTH_T_NE
LETTER_NORTH_T_SW
LETTER_NORTH_T_SE
LETTER_NORTH_U_NW
LETTER_NORTH_U_NE
LETTER_NORTH_U_SW
LETTER_NORTH_U_SE
LETTER_NORTH_V_NW
LETTER_NORTH_V_NE
LETTER_NORTH_V_SW
LETTER_NORTH_V_SE
LETTER_NORTH_W_NW
LETTER_NORTH_W_NE
LETTER_NORTH_W_SW
LETTER_NORTH_W_SE
LETTER_NORTH_X_NW
LETTER_NORTH_X_NE
LETTER_NORTH_X_SW
LETTER_NORTH_X_SE
LETTER_NORTH_Y_NW
LETTER_NORTH_Y_NE
LETTER_NORTH_Y_SW
LETTER_NORTH_Y_SE
LETTER_NORTH_Z_NW
LETTER_NORTH_Z_NE
LETTER_NORTH_Z_SW
LETTER_NORTH_Z_SE
Binary file modified truncate_client/img/truncate.aseprite
Binary file not shown.
Binary file modified truncate_client/img/truncate_packed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions truncate_client/src/app_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use crate::{
lobby::Lobby,
native_menu::render_native_menu_if_required,
replayer::ReplayerState,
rules::{RuleCardAction, RulesState},
single_player::SinglePlayerState,
tutorial::TutorialState,
},
Expand All @@ -33,6 +34,7 @@ pub enum GameStatus {
None(RoomCode, Option<TruncateToken>),
Generator(GeneratorState),
Tutorial(TutorialState),
Rules(RulesState),
PendingSinglePlayer(Lobby),
SinglePlayer(SinglePlayerState),
PendingDaily,
Expand Down Expand Up @@ -409,6 +411,15 @@ pub fn render(outer: &mut OuterApplication, ui: &mut egui::Ui, current_time: Dur
GameStatus::Replay(replay) => {
replay.render(ui, &outer.theme, current_time, &outer.backchannel);
}
GameStatus::Rules(rules) => match rules.render(ui, &outer.theme, current_time) {
Some(RuleCardAction::DailyPuzzle) => {
outer.launched_code = Some("DAILY_PUZZLE".to_string())
}
Some(RuleCardAction::Tutorial) => {
outer.launched_code = Some("TUTORIAL_RULES".to_string())
}
None => {}
},
GameStatus::HardError(msg) => {
let splash = SplashUI::new(msg.clone()).with_button(
"reload",
Expand Down
15 changes: 12 additions & 3 deletions truncate_client/src/handle_launch_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ use truncate_core::{
use crate::{
app_inner::GameStatus,
regions::{
active_game::HeaderType, lobby::Lobby, single_player::SinglePlayerState,
active_game::HeaderType, lobby::Lobby, rules::RulesState, single_player::SinglePlayerState,
tutorial::TutorialState,
},
utils::{self, daily::get_puzzle_day, macros::current_time},
utils::{self, daily::get_puzzle_day, includes::rule_card, macros::current_time},
};

use super::OuterApplication;
Expand All @@ -40,13 +40,22 @@ pub fn handle_launch_code(
"TUTORIAL_RULES" => {
return Some(GameStatus::Tutorial(TutorialState::new(
"rules".to_string(),
utils::includes::rules(outer.launched_at_day),
utils::includes::tutorial(outer.launched_at_day),
ui.ctx(),
outer.map_texture.clone(),
&outer.theme,
outer.event_dispatcher.clone(),
)));
}
"RULE_CARD" => {
return Some(GameStatus::Rules(RulesState::new(
ui.ctx(),
outer.map_texture.clone(),
outer.theme.clone(),
rule_card(),
outer.event_dispatcher.clone(),
)));
}
"SINGLE_PLAYER" => {
outer.event_dispatcher.event("single_player_lobby");
let mut board = Board::new(9, 9);
Expand Down
4 changes: 2 additions & 2 deletions truncate_client/src/lil_bits/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ impl<'a> BoardUI<'a> {
orientation: if *square_player
== gameplay.player_number as usize
{
Direction::North
} else {
Direction::South
} else {
Direction::North
},
}],
aesthetics,
Expand Down
2 changes: 1 addition & 1 deletion truncate_client/src/lil_bits/changes_splash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl ChangelogSplashUI {
return;
}
let block_time = (current_time - self.animate_from).as_secs_f32();
let animated_text = block.get_partial_slice(block_time, ui);
let animated_text = block.get_partial_word_slice(block_time, ui);

match animated_text {
Some(animated_block) => {
Expand Down
2 changes: 1 addition & 1 deletion truncate_client/src/lil_bits/hand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<'a> HandUI<'a> {
} else {
None
},
orientation: truncate_core::board::Direction::North,
orientation: truncate_core::board::Direction::South,
}
})
.collect(),
Expand Down
1 change: 1 addition & 0 deletions truncate_client/src/regions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ pub mod generator;
pub mod lobby;
pub mod native_menu;
pub mod replayer;
pub mod rules;
pub mod single_player;
pub mod tutorial;
2 changes: 1 addition & 1 deletion truncate_client/src/regions/native_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn render_native_menu_if_required(
if ui.button("Tutorial: Rules").clicked() {
return Some(GameStatus::Tutorial(TutorialState::new(
"rules".to_string(),
utils::includes::rules(outer.launched_at_day),
utils::includes::tutorial(outer.launched_at_day),
ui.ctx(),
outer.map_texture.clone(),
&outer.theme,
Expand Down
Loading
Loading