#touch #devices #screen #x11 #framebuffer #input #image

conifer

A library for interacting with a touch screen device without X11

2 unstable releases

0.1.0 Sep 1, 2020
0.0.0 Aug 24, 2020

#952 in Unix APIs

MIT/Apache

37KB
719 lines

🌲 Conifer

docs.rs docs

A simple framebuffer game engine for PinePhone, Raspberry Pi, and other devices with touch screens.

  • make games without X11!
  • auto detect virtual terminal framebuffer
  • auto detect touch screen input
  • works on pinephone, raspbery pi, desktop
  • image support
  • layers
  • text drawing
  • sprites
  • sound
  • web assembly support
[dependencies]
conifer = "0.1"

Before You Start

Make sure your user is a part of video and input group

sudo addusr video richard 
sudo addusr input richard
# Logout and login

To bring up a virtual terminal that isn't being used for X11, you can usually get to it by typing:

ctrl + alt + f2 # or f3,f4...

Sometimes this can only be done from a login screen.

Hello World

use conifer::prelude::*;

fn main() {
    let white = color_from_rgb(255, 255, 255);
    run(move |canvas, event| {
        // if the user swiped, exit
        if let Event::Swipe(s) = event {
            // if the users finger released, exit
            if s.finished {
                return Ok(RunResponse::Exit);
            }
            // draw something where finger is
            for p in s.points {
                canvas.set_pixel(p.x as usize, p.y as usize, white);
            }
        }
        // let conifer know we want to push framebuffer pixels to screen
        Ok(RunResponse::Draw)
    })
    .expect("something went wrong")
}

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in conifer by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~7.5MB
~111K SLoC