Giter Club home page Giter Club logo

doryen-rs's Introduction

doryen-rs

Build Status Documentation crates.io License: MIT

Ascii roguelike library in rust with native and wasm support. Uses the uni-gl and uni-app crates from the unrust game engine.

features

+ [x] GLSL renderer
+ [x] RGBA, RGB and greyscale fonts
+ [x] mouse input
+ [x] keyboard input
+ [x] subcell resolution
+ [x] PNG image blitting
+ [x] unicode support
+ [x] screenshots

demos

Visual demo
Basic real-time walking @
Performance test
Fonts demo
Unicode demo
Console blitting demo
Image blitting demo
Subcell resolution demo
Transparent console demo
Text input demo

usage

  • add dependency to Cargo.toml :
[dependencies]
doryen-rs="*"

Check the examples and documentation for more information.

compilation

  • native compilation
cd www && cargo run --example basic
  • web compilation Install wasm32 target :
rustup target install wasm32-unknown-unknown

Install wasm-pack and npm

Change the path variable in examples/Cargo.toml to select an example.

Compile the demo with

wasm-pack build examples

This creates a wasm package in examples/pkg

Run the demo with

cd www
npm install
npm run start

Open your browser at http://localhost:8080/

license

This code is released under the MIT license.

contributions

You can contribute to this library through pull requests. If you do so, please update the CHANGELOG.md and CREDITS.md files. If you provide a new feature, consider adding an example as a tutorial/showcase.

doryen-rs's People

Contributors

bayou-brogrammer avatar drivasperez avatar ilyvion avatar jice-nospam 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

doryen-rs's Issues

resize on HiDpi screens

when using a HiDpi screen with resizable console, scale is wrong on start. HiDPi factor should not be taken into account when computing the console size

open_file attempts to load from www/, not working directory

According to the documentation here: https://docs.rs/doryen-rs/latest/doryen_rs/trait.DoryenApi.html#tymethod.set_font_path

During development, this references $PROJECT_ROOT/static/terminal.png. Once deployed, terminal.png should be in the same directory as your game’s executable or index.html.

However, open_file in src/file.rs is incorrectly setup to load from "./www/" instead of "./" or "./static/"
This looks to be configured this way to ensure the examples work, and reference the git www. But means that games created with the crate are also attempting to load files from "./www/" instead of "./"

This happens even when the target_arch is not "wasm32", at least in my testing. (Unless I am just being stupid somehow)

fn open_file(filename: &str) -> Result<uni_app::fs::File, std::io::Error> {
    let ffilename =
        if cfg!(not(target_arch = "wasm32")) && &filename[0..1] != "/" && &filename[1..2] != ":" {
            "www/".to_owned() + filename
        } else {
            filename.to_owned()
        };
    uni_app::fs::FileSystem::open(&ffilename)
}

This should probably be replaced with just

fn open_file(filename: &str) -> Result<uni_app::fs::File, std::io::Error> {
    let ffilename = filename.to_owned();
    uni_app::fs::FileSystem::open(&ffilename)
}

And the documentation/examples should be updated appropriately.

Resize issue about mouse position

I'm testing resizing example script. I have trouble about mouse position, to see the problem, apply following diff on examples/resize.rs:

diff --git a/examples/resize.rs b/examples/resize.rs
index 2fcc172..b008fb3 100644
--- a/examples/resize.rs
+++ b/examples/resize.rs
@@ -5,13 +5,18 @@ use doryen_rs::{App, AppOptions, DoryenApi, Engine, TextAlign};
 struct MyRoguelike {
     width: u32,
     height: u32,
+    mouse_pos: (f32, f32),
 }
 
 impl Engine for MyRoguelike {
     fn init(&mut self, _api: &mut dyn DoryenApi) {}
-    fn update(&mut self, _api: &mut dyn DoryenApi) {}
+    fn update(&mut self, api: &mut dyn DoryenApi) {
+        let input = api.input();
+        self.mouse_pos = input.mouse_pos();
+    }
     fn render(&mut self, api: &mut dyn DoryenApi) {
         let con = api.con();
+        con.clear(Some((0, 0, 0, 255)), Some((0, 0, 0, 255)), Some(' ' as u16));
         con.rectangle(
             0,
             0,
@@ -38,6 +43,7 @@ impl Engine for MyRoguelike {
             None,
             None,
         );
+        con.back(self.mouse_pos.0 as i32, self.mouse_pos.1 as i32, (255, 255, 255, 255))
     }
     fn resize(&mut self, api: &mut dyn DoryenApi) {
         self.width = api.get_screen_size().0 / 8;
@@ -51,6 +57,7 @@ impl MyRoguelike {
         Self {
             width: 80,
             height: 50,
+            mouse_pos: (0.0, 0.0)
         }
     }
 }

Then run it. After resize the window, mouse position don't match with console coordinate. Is that a problem what i have to manage in MyRoguelike.resize function ? It should not been automatically managed in con().resize function ?

Error: platform::platform::x11::util::input::PointerState uninitialized

Hello,

Thank you very much for this amazing project.
I'm trying to run a demo:

cargo run --example basic

With stable version of Rust (rustc 1.50.0 (cb75ad5db 2021-02-10) ) I have this error:

platform::platform::x11::util::input::PointerState uninitialized

If I downgrade to 1.47.0 it works.

It's seams to be linked to winit issue

I absolutely don't know how can I update winit here.

Throttle FPS

Hi, nice library!

So I'm currently porting an example project written with tcod-rs over to your lib, and I was wondering because I didn't see it in any of the examples: how do you throttle or control the max fps your code is running at ?

Because the perf example shows ~60 fps and uses as much CPU as my code which simply checks a boolean every time render is called. So I'm guessing we're simply running on the browser loop here which is limited to 60 fps.

But I don't want a roguelike (especially as simple as mine) gobbling up 20% of my CPU just doing nothing, so I'd like to down-throttle it to something like 20 fps, that'd be more appropriate.

Resizing the window

Hey there! Amazing work! I should say, that this might be the best terminal (game-related) renderer I have seen out there! However, even though you have an option to make window resizable, you don't allow hooking up "on resized" events to the window, allowing a user to adapt the rendering to a new window size.

I think it would be a great choice to provide a Window interface, that allows you to get_width() / get_height() as well as set_width() / set_height() for the Console interface. I know it might involve doing a bunch of work, updating the textures and cleaning the buffers, but it is worth it.

Can this be a feature, or do you need help?

transparency not working properly?

In the following test example, the printed rectangle should remain almost invisible with an alpha value of 1 out of 255. It however gets more opaque over time up to a certain point. Is this the intended behaviour or a rendering issue?

extern crate doryen_rs;

use doryen_rs::{App, AppOptions, DoryenApi, Engine, UpdateEvent};

struct MyRoguelike;

impl Engine for MyRoguelike {
    fn init(&mut self, _api: &mut dyn DoryenApi) {}
    fn update(&mut self, _api: &mut dyn DoryenApi) -> Option<UpdateEvent> {
        None
    }
    fn render(&mut self, api: &mut dyn DoryenApi) {
        let con = api.con();
        con.clear(None, None, None);
        con.rectangle(
            20,
            10,
            40,
            25,
            Some((255, 255, 255, 1)),
            Some((255, 255, 255, 1)),
            Some(' ' as u16),
        );
    }
    fn resize(&mut self, _api: &mut dyn DoryenApi) {}
}

fn main() {
    let mut app = App::new(AppOptions {
        window_title: "alpha test".to_owned(),
        ..Default::default()
    });
    app.set_engine(Box::new(MyRoguelike));
    app.run();
}

fullscreen padding and mouse coordinates

Fullscreen : when the screen resolution is not equal to the console size in pixels, the viewport is displayed on bottom left of the screen and the mouse coordinates doesn't take to top margin into account.
viewport should be centered and mouse coordinate correct

Quitting?

I may have missed something obvious, but... how do I signal to the App that I'm done? Like, from a "Quit" menu option in the game, or deliberately ending the game when the player has reached the end?

Also, in sort of the opposite vein, it'd be nice to informed when the player attempts to close the game (by e.g. clicking the X on the window), since it can be nice to be like "Whoa there, you sure you want to quit without saving first? You haven't saved in 53 minutes." (or for an even better UX, use that opportunity to run the auto-save routine)

Can't run basic example on MacOS

I'm on macOS Big Sur 11.1

I've just cloned Doryen git repo and run cargo run --example basic. I'm using stable Rust, not nightly

Here is an error:

error[E0282]: type annotations needed
   --> /Users/kifir/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.15.0/src/appkit.rs:526:9
    |
526 |         msg_send![self, releaseGlobally];
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ consider giving `result` a type
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
    --> /Users/kifir/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.15.0/src/appkit.rs:2849:9
     |
2849 |         msg_send![self, setBezelStyle:style];
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ consider giving `result` a type
     |
     = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
    --> /Users/kifir/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.15.0/src/appkit.rs:3454:9
     |
3454 |         msg_send![self, setEditable:editable];
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ consider giving `result` a type
     |
     = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
    --> /Users/kifir/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.15.0/src/appkit.rs:3457:9
     |
3457 |         msg_send![self, setStringValue:label];
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ consider giving `result` a type
     |
     = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0282`.
error: could not compile `cocoa`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

Also there is an error in browser console when I run cargo web start --example basic:

[Error] Encountered a panic!
	__cargo_web_snippet_dc2fd915bd92f9e9c6a3bd15174f1414eee3dbaf (basic.js:766)
	wasm-stub
	<?>.wasm-function[_ZN6stdweb7webcore14initialization10initialize28_$u7b$$u7b$closure$u7d$$u7d$7snippet17hd7a35bcdf1070f6eE]
	<?>.wasm-function[_ZN6stdweb7webcore14initialization10initialize28_$u7b$$u7b$closure$u7d$$u7d$17he22ad472c30d7db1E]
	<?>.wasm-function[_ZN3std9panicking20rust_panic_with_hook17h123718ba3bf480afE]
	<?>.wasm-function[_ZN3std9panicking19begin_panic_handler28_$u7b$$u7b$closure$u7d$$u7d$17hf393a82e58397bd2E]
	<?>.wasm-function[_ZN3std10sys_common9backtrace26__rust_end_short_backtrace17h2ff2cfc953878925E]
	<?>.wasm-function[rust_begin_unwind]
	<?>.wasm-function[_ZN4core9panicking9panic_fmt17h285dc015a87be5a4E]
	<?>.wasm-function[_ZN4core9panicking5panic17h0abe4e7a620ae568E]
	<?>.wasm-function[_ZN154_$LT$stdweb..webcore..serialization..SerializedValue$u20$as$u20$core..convert..From$LT$stdweb..webcore..serialization..SerializedUntaggedReference$GT$$GT$4from17h1b90a50ca1020b2dE]
	<?>.wasm-function[_ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17h8342543359c53330E]
	<?>.wasm-function[_ZN97_$LT$stdweb..webcore..value..Reference$u20$as$u20$stdweb..webcore..serialization..JsSerialize$GT$8_into_js17h290f2e87c5477b73E]
	<?>.wasm-function[_ZN98_$LT$stdweb..webapi..document..Document$u20$as$u20$stdweb..webcore..serialization..JsSerialize$GT$8_into_js17h454a0bdc37d02575E]
	<?>.wasm-function[_ZN69_$LT$$RF$T$u20$as$u20$stdweb..webcore..serialization..JsSerialize$GT$8_into_js17h8d859425e2552faeE]
	<?>.wasm-function[_ZN179_$LT$stdweb..webcore..newtype..Newtype$LT$$LP$stdweb..webcore..serialization..NonFunctionTag$C$$LP$$RP$$RP$$C$T$GT$$u20$as$u20$stdweb..webcore..serialization..JsSerializeOwned$GT$13into_js_owned17hd4b8747f02240bf4E]
	<?>.wasm-function[_ZN6stdweb6webapi8document8Document14create_element17h13f8a5a9624b1909E]
	<?>.wasm-function[_ZN7uni_app3sys3App3new17h22a6b588d1de7c12E]
	<?>.wasm-function[_ZN9doryen_rs3app3App3new17hdb18acbf87669759E]
	<?>.wasm-function[_ZN5basic4main17h97848a66c5173674E]
	<?>.wasm-function[_ZN4core3ops8function6FnOnce9call_once17h95aace93dba0b342E]
	<?>.wasm-function[_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h21ca42516ce6e722E]
	<?>.wasm-function[_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4f059f43d05dd092E]
	<?>.wasm-function[_ZN3std2rt19lang_start_internal17h1ad6338b95de9507E]
	<?>.wasm-function[_ZN3std2rt10lang_start17h07ffb5252c2c9c60E]
	<?>.wasm-function[main]
	wasm-stub
	main
	initialize (basic.js:839)
	(анонимная функция) (basic.js:41)
	promiseReactionJob
[Error] Panic location: – "/Users/kifir/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659"
	__cargo_web_snippet_72fc447820458c720c68d0d8e078ede631edd723 (basic.js:658)
	wasm-stub
	<?>.wasm-function[_ZN6stdweb7webcore14initialization10initialize28_$u7b$$u7b$closure$u7d$$u7d$7snippet17h74b254a3f62b22beE]
	<?>.wasm-function[_ZN6stdweb7webcore14initialization10initialize28_$u7b$$u7b$closure$u7d$$u7d$17he22ad472c30d7db1E]
	<?>.wasm-function[_ZN3std9panicking20rust_panic_with_hook17h123718ba3bf480afE]
	<?>.wasm-function[_ZN3std9panicking19begin_panic_handler28_$u7b$$u7b$closure$u7d$$u7d$17hf393a82e58397bd2E]
	<?>.wasm-function[_ZN3std10sys_common9backtrace26__rust_end_short_backtrace17h2ff2cfc953878925E]
	<?>.wasm-function[rust_begin_unwind]
	<?>.wasm-function[_ZN4core9panicking9panic_fmt17h285dc015a87be5a4E]
	<?>.wasm-function[_ZN4core9panicking5panic17h0abe4e7a620ae568E]
	<?>.wasm-function[_ZN154_$LT$stdweb..webcore..serialization..SerializedValue$u20$as$u20$core..convert..From$LT$stdweb..webcore..serialization..SerializedUntaggedReference$GT$$GT$4from17h1b90a50ca1020b2dE]
	<?>.wasm-function[_ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17h8342543359c53330E]
	<?>.wasm-function[_ZN97_$LT$stdweb..webcore..value..Reference$u20$as$u20$stdweb..webcore..serialization..JsSerialize$GT$8_into_js17h290f2e87c5477b73E]
	<?>.wasm-function[_ZN98_$LT$stdweb..webapi..document..Document$u20$as$u20$stdweb..webcore..serialization..JsSerialize$GT$8_into_js17h454a0bdc37d02575E]
	<?>.wasm-function[_ZN69_$LT$$RF$T$u20$as$u20$stdweb..webcore..serialization..JsSerialize$GT$8_into_js17h8d859425e2552faeE]
	<?>.wasm-function[_ZN179_$LT$stdweb..webcore..newtype..Newtype$LT$$LP$stdweb..webcore..serialization..NonFunctionTag$C$$LP$$RP$$RP$$C$T$GT$$u20$as$u20$stdweb..webcore..serialization..JsSerializeOwned$GT$13into_js_owned17hd4b8747f02240bf4E]
	<?>.wasm-function[_ZN6stdweb6webapi8document8Document14create_element17h13f8a5a9624b1909E]
	<?>.wasm-function[_ZN7uni_app3sys3App3new17h22a6b588d1de7c12E]
	<?>.wasm-function[_ZN9doryen_rs3app3App3new17hdb18acbf87669759E]
	<?>.wasm-function[_ZN5basic4main17h97848a66c5173674E]
	<?>.wasm-function[_ZN4core3ops8function6FnOnce9call_once17h95aace93dba0b342E]
	<?>.wasm-function[_ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h21ca42516ce6e722E]
	<?>.wasm-function[_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h4f059f43d05dd092E]
	<?>.wasm-function[_ZN3std2rt19lang_start_internal17h1ad6338b95de9507E]
	<?>.wasm-function[_ZN3std2rt10lang_start17h07ffb5252c2c9c60E]
	<?>.wasm-function[main]
	wasm-stub
	main
	initialize (basic.js:839)
	(анонимная функция) (basic.js:41)
	promiseReactionJob
[Log] Error loading Rust wasm module 'basic': – RuntimeError: Unreachable code should not be executed (evaluating 'Module.instance.exports.main()') — basic.js:839 (basic.js, line 46)
RuntimeError: Unreachable code should not be executed (evaluating 'Module.instance.exports.main()') — basic.js:839
[Error] Unhandled Promise Rejection: RuntimeError: Unreachable code should not be executed (evaluating 'Module.instance.exports.main()')
	(анонимная функция) (basic.js:47)
	promiseReactionJob

Examples panic on macOS

This looks like an exciting project! Unfortunately, when I try to run cargo run --example basic, I get

    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/examples/basic`
opengl 4.1 INTEL-12.4.7
shading language 4.10
vendor Intel Inc.
compiling VS
compiling FS
linking
loading file terminal_8x8.png
thread 'main' panicked at 'GLError: uniform_1i 1282 (invalid operation)', /Users/rb/.cargo/registry/src/github.com-1ecc6299db9ec823/uni-gl-0.1.1/src/webgl_native.rs:35:13
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:70
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:58
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
             at src/libstd/panicking.rs:478
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:385
   6: std::panicking::try::do_call
             at src/libstd/panicking.rs:340
   7: uni_gl::webgl::check_gl_error
             at /Users/rb/.cargo/registry/src/github.com-1ecc6299db9ec823/uni-gl-0.1.1/src/webgl_native.rs:35
   8: uni_gl::webgl::<impl uni_gl::common::WebGLRenderingContext>::new::{{closure}}
             at /Users/rb/.cargo/registry/src/github.com-1ecc6299db9ec823/uni-gl-0.1.1/src/webgl_native.rs:768
   9: doryen_rs::program::Program::update_uniform_texture
             at src/program.rs:272
  10: doryen_rs::program::Program::set_uniforms
             at src/program.rs:280
  11: doryen_rs::program::Program::render_primitive
             at src/program.rs:241
  12: doryen_rs::app::App::run::{{closure}}
             at src/app.rs:315
  13: core::char::convert::from_u32_unchecked
             at /Users/rb/.cargo/registry/src/github.com-1ecc6299db9ec823/uni-app-0.1.0/src/native_app.rs:298
  14: doryen_rs::app::App::handle_input
             at src/app.rs:278
  15: basic::main
             at examples/basic.rs:93
  16: std::rt::lang_start::{{closure}}
             at /rustc/c2d381d39d282c0586d50ea7d7a431ffd5ddb3fb/src/libstd/rt.rs:64
  17: std::panicking::try::do_call
             at src/libstd/rt.rs:49
             at src/libstd/panicking.rs:297
  18: panic_unwind::dwarf::eh::read_encoded_pointer
             at src/libpanic_unwind/lib.rs:92
  19: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
             at src/libstd/panicking.rs:276
             at src/libstd/panic.rs:388
             at src/libstd/rt.rs:48
  20: std::rt::lang_start
             at /rustc/c2d381d39d282c0586d50ea7d7a431ffd5ddb3fb/src/libstd/rt.rs:64
  21: basic::main

The same happens running other examples, like resize, subcell, perf. I can see a black window popping up for about a frame or so before the crash happens.

I am using rustc 1.33.0-nightly (c2d381d39 2019-01-10), on a 13'' MBP 2015, with macOS 10.14.2.

Don't use wildcard dependencies when relying on features from very specific versions

After you added the feature in #14 I went to update doryen-rs. This led to a compilation error:

error[E0560]: struct `uni_app::AppConfig` has no field named `intercept_close_request`
   --> C:\Users\alexs\.cargo\registry\src\github.com-1ecc6299db9ec823\doryen-rs-1.2.0\src\app.rs:177:13
    |
177 |             intercept_close_request: options.intercept_close_request,
    |             ^^^^^^^^^^^^^^^^^^^^^^^ `uni_app::AppConfig` does not have this field
    |
    = note: available fields are: `title`, `size`, `vsync`, `headless`, `fullscreen` ... and 2 others

error[E0599]: no variant or associated item named `CloseRequested` found for type `uni_app::AppEvent` in the current scope
   --> C:\Users\alexs\.cargo\registry\src\github.com-1ecc6299db9ec823\doryen-rs-1.2.0\src\input.rs:120:23
    |
120 |             AppEvent::CloseRequested => {
    |                       ^^^^^^^^^^^^^^ variant or associated item not found in `uni_app::AppEvent`

error: aborting due to 2 previous errors

Since doryen-rs's dependency on uni-app is set to version="0.1.*", the version I already had installed from before, i.e. 0.1.0, satisfied it. But 0.1.0's App doesn't have intercept_close_request, and its AppEvent doesn't have a CloseRequested variant!

Only after manually updating uni-app from 0.1.0 to 0.1.1 did doryen-rs compile successfully again.

text input

Add text input support through winit's ReceivedCharacter event (require changes in uni-app)

Black Edge in Examples

When I view the examples, there is a black edge on the top and right side. This doesn't seem right, but I can't figure out what about the code, or the index.html, would cause this.

Capture

Crashes on wayland

When I try to run the basic example with cargo run it crashes with this error message

[wayland-client error] Attempted to dispatch unknown opcode 0 for wl_shm, aborting.
fish: Job 1, 'cargo run' terminated by signal SIGABRT (Abort)

no max_fps?

I keep getting an error when using the examples.
error[E0560]: struct 'doryen_rs::AppOptions' has no field named 'max_fps'
Specifically, I copied from the lowfps.rs example, and modified nothing. What am I missing?

Constants for symbol characters

I'd like to be able to have a constant like ARROW_N instead of having to define my own constants to print those characters. How about we include this file in this library?

The characters with doyren-rs typecasting
pub const HLINE: u16 = '\u{c4}' as u16;
pub const VLINE: u16 = '\u{b3}' as u16;
pub const NE: u16 = '\u{bf}' as u16;
pub const NW: u16 = '\u{da}' as u16;
pub const SE: u16 = '\u{d9}' as u16;
pub const SW: u16 = '\u{c0}' as u16;
pub const TEEW: u16 = '\u{b4}' as u16;
pub const TEEE: u16 = '\u{c3}' as u16;
pub const TEEN: u16 = '\u{c1}' as u16;
pub const TEES: u16 = '\u{c2}' as u16;
pub const CROSS: u16 = '\u{c5}' as u16;
pub const DHLINE: u16 = '\u{cd}' as u16;
pub const DVLINE: u16 = '\u{ba}' as u16;
pub const DNE: u16 = '\u{bb}' as u16;
pub const DNW: u16 = '\u{c9}' as u16;
pub const DSE: u16 = '\u{bc}' as u16;
pub const DSW: u16 = '\u{c8}' as u16;
pub const DTEEW: u16 = '\u{b9}' as u16;
pub const DTEEE: u16 = '\u{cc}' as u16;
pub const DTEEN: u16 = '\u{ca}' as u16;
pub const DTEES: u16 = '\u{cb}' as u16;
pub const DCROSS: u16 = '\u{ce}' as u16;
pub const BLOCK1: u16 = '\u{b0}' as u16;
pub const BLOCK2: u16 = '\u{b1}' as u16;
pub const BLOCK3: u16 = '\u{b2}' as u16;
pub const ARROW_N: u16 = '\u{18}' as u16;
pub const ARROW_S: u16 = '\u{19}' as u16;
pub const ARROW_E: u16 = '\u{1a}' as u16;
pub const ARROW_W: u16 = '\u{1b}' as u16;
pub const ARROW2_N: u16 = '\u{1e}' as u16;
pub const ARROW2_S: u16 = '\u{1f}' as u16;
pub const ARROW2_E: u16 = '\u{10}' as u16;
pub const ARROW2_W: u16 = '\u{11}' as u16;
pub const DARROW_H: u16 = '\u{1d}' as u16;
pub const DARROW_V: u16 = '\u{12}' as u16;
pub const CHECKBOX_UNSET: u16 = '\u{e0}' as u16;
pub const CHECKBOX_SET: u16 = '\u{e1}' as u16;
pub const RADIO_UNSET: u16 = '\u{09}' as u16;
pub const RADIO_SET: u16 = '\u{0a}' as u16;
pub const SUBP_NW: u16 = '\u{e2}' as u16;
pub const SUBP_NE: u16 = '\u{e3}' as u16;
pub const SUBP_N: u16 = '\u{e4}' as u16;
pub const SUBP_SE: u16 = '\u{e5}' as u16;
pub const SUBP_DIAG: u16 = '\u{e6}' as u16;
pub const SUBP_E: u16 = '\u{e7}' as u16;
pub const SUBP_SW: u16 = '\u{e8}' as u16;
pub const SMILIE: u16 = '\u{01}' as u16;
pub const SMILIE_INV: u16 = '\u{02}' as u16;
pub const HEART: u16 = '\u{03}' as u16;
pub const DIAMOND: u16 = '\u{04}' as u16;
pub const CLUB: u16 = '\u{05}' as u16;
pub const SPADE: u16 = '\u{06}' as u16;
pub const BULLET: u16 = '\u{07}' as u16;
pub const BULLET_INV: u16 = '\u{08}' as u16;
pub const MALE: u16 = '\u{0b}' as u16;
pub const FEMALE: u16 = '\u{0c}' as u16;
pub const NOTE: u16 = '\u{0d}' as u16;
pub const NOTE_DOUBLE: u16 = '\u{0e}' as u16;
pub const LIGHT: u16 = '\u{0f}' as u16;
pub const EXCLAM_DOUBLE: u16 = '\u{13}' as u16;
pub const PILCROW: u16 = '\u{14}' as u16;
pub const SECTION: u16 = '\u{15}' as u16;
pub const POUND: u16 = '\u{9c}' as u16;
pub const MULTIPLICATION: u16 = '\u{9e}' as u16;
pub const FUNCTION: u16 = '\u{9f}' as u16;
pub const RESERVED: u16 = '\u{a9}' as u16;
pub const HALF: u16 = '\u{ab}' as u16;
pub const ONE_QUARTER: u16 = '\u{ac}' as u16;
pub const COPYRIGHT: u16 = '\u{b8}' as u16;
pub const CENT: u16 = '\u{bd}' as u16;
pub const YEN: u16 = '\u{be}' as u16;
pub const CURRENCY: u16 = '\u{cf}' as u16;
pub const THREE_QUARTERS: u16 = '\u{f3}' as u16;
pub const DIVISION: u16 = '\u{f6}' as u16;
pub const GRADE: u16 = '\u{f8}' as u16;
pub const UMLAUT: u16 = '\u{f9}' as u16;
pub const POW1: u16 = '\u{fb}' as u16;
pub const POW3: u16 = '\u{fc}' as u16;
pub const POW2: u16 = '\u{fd}' as u16;
pub const BULLET_SQUARE: u16 = '\u{fe}' as u16;

No characters on mobile

On my mobile phone, I can see the bg/fg colors, but not the characters. Chrome claims to support both webgl 1 and 2.
The gfx card is a Mali 720.

Checked both performance and Unicode demos, with the same results.

Displaying a formatted text

Hey there! Another issue for ya! Printing colored strings via %{color} is very convenient, but it doesn't allow you to have something like format!("%{white}Move with %{red}arrows %{} {}", fps).

bracket-lib port

This issue to track progress on using bracket-lib instead of unrust as backend.
Status of examples (fonts branch of bracket-lib)

  • demo
  • alpha (no frame overlay. this feature will probably be dropped in doryen-rs)
  • basic
  • blit
  • exit
  • fonts (example to be updated to provide fonts background color)
  • image
  • perf
  • resize
  • subcell
  • text_input (UTF-8 KO. it's KO as well on master branch)
  • unicode

Main blocking issue right now is WASM compatibility and cargo web support. I'll go back to this as soon as possible.

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.