Libove Blog

Personal Blog about anything - mostly programming, cooking and random thoughts

Dungeon Planner - First Release

I've release a first "pre-version" and the source code of DungeonPlanner on GitHub.

DungeonPlanner is a small and simple tool I use to create and plan dungeons for tabletop games. It is game system agnostic and should be applicable to most tabletop games.

Feedback is appreciated as always :)


vegan meat pizza

vegan meat pizza

Rust GTK4 - Mouse Events in DrawingArea

For the app I'm currently working on I need to react to mouse inputs in a drawing area. I need the position of the mouse and the possibility to react to mouse clicks.

Mouse Position

The mouse position can be obtained by using an EventControllerMotion. This is added to the DrawingArea.

let pos_controller = EventControllerMotion::new();
pos_controller.connect_motion(move |_con, x, y| {
    ...
});
drawing_area.add_controller(pos_controller);

Mouse Clicks

For each mouse button you want to "observe" a GestureClick is created and added to the DrawingArea.

let gesture_click = GestureClick::builder()
    .button(GDK_BUTTON_PRIMARY as u32)
    .build();

gesture_click.connect_pressed(move |_, _, _, _| {
    // create to mouse click
});
drawing_area.add_controller(gesture_click);

Rust GTK4 - Key Pressed

I'm currently building an application using gtk-rs using GTK4. To react to key presses the EventControllerKey can be used. This is added as a controller to the main window.

let control_key = gtk::EventControllerKey::new();

control_key.connect_key_pressed(move |_, key, _, _| {
    match key {
        gdk::Key::Right => { ... },
        gdk::Key::Left => { ... },
        gdk::Key::Up => { ... },
        gdk::Key::Down => { ... },
        _ => (),
    }
    glib::Propagation::Proceed
});
window.add_controller(control_key);

Lonely tree

Lonely tree

Tent under tree

Tent under tree

Veganer Parmesan

Prep Time:

Ingredients

  • 200g Cashews
  • 60g Hefeflocken
  • 1 TL Knoblauchpulver
  • 1 TL Salz

Instructions

Alle Zutaten in einen Standmixer geben und solange zerkleinern bisam ein feines Pulver hat. Sobald die richtige Konsistenz erreicht ist, "fließt" der Parmesan nicht mehr richtig beim mixen und leicht klumpig wird.


Pink Donut

Pink Donut

3D Printed Toy Screws

After seeing how I put a child barrier together my daughter is obsessed with screws. She will try to turn any screw she can find, using any item barely resembling a screwdriver. Naturally, she got her own set of tools :).

A Block with 2 screws. In front of it lie a toy screwdriver and wrench

As the set didn't include any screws I've decided to print some for her. The screws are compatible with the wrench and screwdriver of the "klein Bosch Work-Box". The holes of the block are loose enough to easily screw in the bolts.

I've used Blender to create these. For my first try I've created my own screw using the "Screw" modifier applied to a triangle. This worked okay, but the resulting screw was too loose and would just slip into the hole. For the next try I used the plugin "Bolt Factory" to create the screw part and only kept my previously designed head.

Things I've learned:

  • A 6-vertices circle with 18mm circumference is not the same as a 18mm screw head. The "18mm" refers to the distance between to edges, not two vertices.
  • 3D printed screw holes need a lot more "room". Simply scaling by the X and Y axis worked for my "triangle screw" but not the generated screw. Instead I had to thicken and thin the bands of the screw.

How to modify a screw to be used as a hole

All files can be used under the CC-BY 4.0 License.


Lamb

Lamb