Git Product home page Git Product logo

softbuffer-quickstart's Introduction

Softbuffer Quickstart

A wrapper that makes using Softbuffer as easy as using minifb.

Running the Softbuffer example in softbuffer-quickstart:

use softbuffer_quickstart::{SoftbufferWindow, WindowProperties};

fn main() {
    let mut window = SoftbufferWindow::new(
        // This is the "loop closure" -- called on every update loop
        |window, buffer| {
            let (width, height) = {
                let size = window.inner_size();
                (size.width, size.height)
            };
            for index in 0..(width * height) {
                let y = index / width;
                let x = index % width;
                let red = x % 255;
                let green = y % 255;
                let blue = (x * y) % 255;

                buffer[index as usize] = blue | (green << 8) | (red << 16);
            }
        },
        // This is how we can set properties for the window when it's initially created.
        WindowProperties::default()
    );
    window.run().expect("window can't run :(");
}

Contributing

PRs are welcome! As with any of my other projects it might take a while for me to respond to issues/pull requests. I recommend not squashing your commits before you submit a PR as doing so makes it a bit harder to review your code.
I'm looking for any ways to boost performance as much as possible while making the library simpler and more intuitive.

Ideas:

  • Handling Winit events (like resizing)
  • Improving performance with the buffer (for loops in general are slow! there has to be a faster way to iterate over everything in the buffer)
  • Adding icons to WindowProperties (probably good for new contributors)

softbuffer-quickstart's People

Contributors

pastthepixels avatar 3k2ng avatar

Watchers

 avatar

Forkers

3k2ng

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.