#
I've just one-shotted an iterator with a lifetime in #rust. Is this what it feels like when the language finally clicks?
Personal Blog about anything - mostly programming, cooking and random thoughts
I've just one-shotted an iterator with a lifetime in #rust. Is this what it feels like when the language finally clicks?
#gamedev progress on hotel game:
Not sure if I should be proud or embarrassed about this #rust code :D
// mark building tile
if let Some(mut r) = match game.mouse_action {
MouseAction::BuildGrill => Some(Room::new_grill()),
MouseAction::BuildStairs => Some(Room::new_stairs()),
MouseAction::BuildBedroom => Some(Room::new_bed_room()),
MouseAction::BuildCorridor => Some(Room::new_corridor()),
MouseAction::BuildRestaurant => Some(Room::new_restaurant()),
MouseAction::BuildWineCellar => Some(Room::new_wine_cellar()),
_ => None,
} {
// rendering code
}
Insights from the weekend:
--release.#gamedev progress on unnamed hotel game:
I'm missing the vocabulary for googling this.
Is there a better way to write this? I want to filter a vector of enums to elements that match one specific pattern.
.filter(|r| match r.kind {
RoomKind::BedRoom(_) => true,
_ => false
})
Guide on how to build a simple ECS in #rust.
#gamedev progress:
Slow progress in the last couple of sessions. I've started to implement employees. Employees work at rooms/stations whenever a guest wants to interact with them (e.g. booking a room). I'm not yet 100% happy with the implementation (blaming my #rust skills).
Additionally implemented a hunger+restaurant prototype.
#gamedev progress:
I'm in the mood for game development again. This is the progress after the second evening on a yet unnamed game.
Not much yet just:
https://programming.dev/post/21199936
I've tried this quickly and you can use pango markup to change the text color in the label.
Here is a snippet with a label and a button that changes the text color from blue to red.
let label = Label::builder().label("<span foreground=\"blue\">Blue text</span>").build();
label.set_use_markup(true);
tool_box.append(&label.clone());
let button = Button::builder().label("Change").build();
button.connect_clicked(move |button| {
println!("Moved");
label.set_label("<span foreground=\"red\">Red text</span>");
});
tool_box.append(&button.clone());