Code Monkey home page Code Monkey logo

quicksilver's Introduction

quicksilver

Quicksilver Logo

Crates.io Docs Status dependency status

A simple 2D game framework written in pure Rust, for both the Web and Desktop

Maintenance Status

I've posted an update on my website about Quicksilver. To keep a long story short: Quicksilver is no longer actively developed. For now I will continue to triage bugs and pull requests and (maybe) fix small bugs.

Alpha Notice

This version of Quicksilver is currently working its way through alpha! There is still work to do on the API and on bugfixes, as well as waiting on an upstream library for audio support. Please feel free to use this version and provide feedback! If you run into bugs or want to give feedback on API decisions, please open an issue.

A quick example

Create a rust project and add this line to your Cargo.toml file under [dependencies]:

quicksilver = "0.4"

Then replace src/main.rs with the following (the contents of quicksilver's examples/01_square.rs):

// Example 1: The Square
// Open a window, and draw a colored square in it
use quicksilver::{
    geom::{Rectangle, Vector},
    graphics::Color,
    run, Graphics, Input, Result, Settings, Window,
};

fn main() {
    run(
        Settings {
            title: "Square Example",
            ..Settings::default()
        },
        app,
    );
}

async fn app(window: Window, mut gfx: Graphics, mut input: Input) -> Result<()> {
    // Clear the screen to a blank, white color
    gfx.clear(Color::WHITE);
    // Paint a blue square with a red outline in the center of our screen
    // It should have a top-left of (350, 100) and a size of (150, 100)
    let rect = Rectangle::new(Vector::new(350.0, 100.0), Vector::new(100.0, 100.0));
    gfx.fill_rect(&rect, Color::BLUE);
    gfx.stroke_rect(&rect, Color::RED);
    // Send the data to be drawn
    gfx.present(&window)?;
    loop {
        while let Some(_) = input.next_event().await {}
    }
}

Learning Quicksilver

A good way to get started with Quicksilver is to read and run the examples which also serve as tutorials. If you have any questions, feel free to open an issue or ask for help in the Rust Community Discord from other Quicksilver users and developers.

Made with Quicksilver

Version 0.4

Version 0.3

Want to add your project? Feel free to open an issue or PR!

Building and Deploying a Quicksilver application

Quicksilver should always compile and run on the latest stable version of Rust, for both web and desktop.

Make sure to put all your assets in a top-level folder of your crate called static/. All Quicksilver file loading-APIs will expect paths that originate in the static folder, so static/image.png should be referenced as image.png.

Linux dependencies

On Windows and Mac, all you'll need to build Quicksilver is a recent stable version of rustc and cargo. A few of Quicksilver's dependencies require Linux packages to build, namely libudev, zlib, and alsa. To install these on Ubuntu or Debian, run the command sudo apt install libudev-dev zlib1g-dev alsa libasound2-dev.

Deploying for desktop

If you're deploying for desktop platforms, build in release mode (cargo build --release) and copy the executable file produced (found at "target/release/") and any assets you used (image files, etc.) and create an archive (on Windows a zip file, on Unix a tar file). You should be able to distribute this archive with no problems; if there are any, please open an issue.

Deploying for the web

If you're deploying for the web, first make sure you've installed the cargo web tool. Then use cargo web deploy to build your application for distribution (located at target/deploy).

If you want to test your application locally, use cargo web start --features quicksilver/stdweb and open your favorite browser to the port it provides.

wasm-bindgen support

Quicksilver has recently gained experimental support for wasm-bindgen, under the web-sys feature. The workflow is not currently documented here, but it should be the same as using any other library with wasm-bindgen.

Optional Features

Quicksilver by default tries to provide all features a 2D application may need, but not all applications need these features.

The optional features available are:

Each are enabled by default, but you can specify which features you actually want to use.

Supported Platforms

The engine is supported on Windows, macOS, Linux, and the web via WebAssembly.

Mobile support would be a future possibility, but likely only through external contributions.

quicksilver's People

Contributors

alec-deason avatar cedric-h avatar cryze avatar francesco-cattoglio avatar frozolotl avatar johnpmayer avatar kurble avatar lenscas avatar martinlindhe avatar maulingmonkey avatar mdonoughe avatar memoryruins avatar minusgix avatar nico-abram avatar nodef0 avatar orhanbalci avatar paulirotta avatar philipdaniels avatar ponaskovas avatar ratysz avatar rsribeiro avatar ryanisaacg avatar sssilver avatar tannerrogalsky avatar tomassedovic avatar vorner avatar wushuworks avatar xoronic avatar zacharied avatar zesterer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quicksilver's Issues

Tutorial-style / "soft" documentation

The project is configured to force all public members to be documented, but currently there are no walkthroughs / tutorials that take new users through an introduction to the library.

Document the limitations of WASM

If users plan to target WASM, they should be aware of limitations like lack of threading and lack of ability to roll their own main.

Set window icon

There should be some way to set the icon for native and the favicon for web, but this may require platform-specific code (Glutin / winit currently provide no way to do this.)

Remove WindowBuilder entirely

Because there are no features WindowBuilder can enable that Window cannot, it seems best to just allow the user to edit the Window defaults rather than the ceremony of the builder pattern.

Font support

Currently there is no text rendering mechanism in quicksilver which is an important feature.

Screen / state management

Because the game_loop macro require all control flow through a single struct and its associated functions, there should be some convenient mechanism to embed multiple screens / states within the struct.

Mouse wheel handling

There should be some way to handle mouse wheel inputs, which will require new JS hooks

Texture atlas support

Batched drawing means that switching textures is slower than not, and a texture atlas would greatly reduce the number of times the texture must be switched.

Local game saving

There should be a way to save items to a configuration file, in different locations on native and in page cookies in web.

Gamepad support

It doesn't appear that Glutin supports gamepads, so this might not be possible without code for each native platform, but it's still something to consider.

Create fullscreen options

On desktop, if only one of native fullscreen and borderless window is possible, borderless window is probably to be preferred. In JS, the browser window will have to be fullscreened and so will the content. Additionally, this requires setting the JS viewport to letterbox.

Sound support

The best options for sound are probably Ears, Rodio, and Portaudio. Currently Rodio is broken on macOS so it's probably best to try for Portaudio.

Universal input API

Such an API would be able to allow the application to poll for (future) gamepad, mouse, and keyboard events with a single function call.

Render-to-texture

It shouldn't be too difficult to draw items to a texture instead of a GL window.

Minimize Rust <-> JS calls

There are a number of functions that would probably be improved if the JS bridge wrote directly to Rust memory, such as the input pumping events writing to a buffer instead of using JS arrays.

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.