Coder Social home page Coder Social logo

simple's People

Contributors

alexandercampbell avatar bombless avatar forgemo 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

Watchers

 avatar  avatar  avatar

simple's Issues

sprite sheet capability

Hi, your library is indeed simple and lacks an important simple feature, being able to draw a rectangle portion of an image.
Your draw_image code seems to allow setting the (x,y) of the rendering rectangle, but not the (w,h).
I thought (SDL2 canvas)[https://docs.rs/sdl2/0.34.5/sdl2/render/struct.Canvas.html#method.copy] went more like:

// the frame of the image on the sprite sheet
let frame = Rect {
    x:64,
    y:0,
    w:64,
    h:64,
};
// the screen size
let (width, height) = canvas.output_size()?
let screen_rectangle = Rect {
    x:0,
    y:0,
    w:width,
    h:height,
};
canvas.copy(&texture, frame, screen_rectangle);

However in your (code)[https://github.com/alexandercampbell/simple/blob/master/src/window.rs#L224] is looks like

// copy the texture onto the drawer()
self.canvas
     .copy(
         &(image.texture),
         Some(shape::Rect::new(
// I think this is not what you intend to do
              x,
              y,
// this should be editable
              image.get_width() as u32,
              image.get_height() as u32,
          )),
// this should be different I think
          None,
      )
     .unwrap();

Text Drawing Support

This library needs support for text drawing functions.

// use the default font
app.print("Monday", 32, 96);

// load a different font
let font = simple::Font::from_file(Path::new("my_font.ttf"));
app.set_font(font);
app.print("Monday", 64, 96);

// Wrap text inside of a rect.
// this will probably end up looking like
//
//  Monday is my
//  favorite day
//  of the entire
//  week!
//
app.print_rect("Monday is my favorite day of the entire week!", simple::Rect{
    x: 96,
    y: 96,
    w: 128,
    h: 512,
})

Tutorial

This project should have a TUTORIAL.md that shows how to make a small game.

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.