dartlove 0.0.3

Dartlove #

Love2D ported to Dart for developing web games using HTML canvas. Devs familiar with the LOVE2D API will feel right at home and get to create games with Dart!

Notice! #

This library is under heavy construction! I will update this page with documentation and examples in the near future. This is my first package for pub (Dart's package manager) so I'm still learning!

Usage #

TODO

TODO #

  • Fill out the Usage section above
  • More examples and documentation
  • Eventually transition to WebGL???
  • Port the love.audio module
  • Add a custom love.touch module
  • Find a way to add user-defined fonts

License #

MIT License

Copyright 2019 Novemberisms

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0.0.1 #

  • Initial version with Graphics, Keyboard, and Mouse support.

0.0.2 #

  • Added support for LOVE2D canvases api for drawing to an external rendertarget

0.0.3 #

  • Using negative scale factors in graphics calls will now properly flip images and drawables
  • dt is now clamped to a max value to prevent massive frame jumps when latency is high.
  • Added graphics.getDimensions, which returns a Point dart:math object.

example/dartlove_example.dart

import 'package:dartlove/dartlove.dart';

main() => run(MyApp(), "#canvas");

class MyApp extends LoveApp {
  Image image;
  num x = 0;
  num y = 0;
  num speed = 250;

  @override
  void load() async {
    image = await graphics.newImageAsync("asset/ball.png");
  }

  @override
  void update(num dt) {
    var inputX = 0;
    var inputY = 0;

    if (keyboard.isDown("up")) inputY--;
    if (keyboard.isDown("left")) inputX--;
    if (keyboard.isDown("down")) inputY++;
    if (keyboard.isDown("right")) inputX++;

    x += inputX * speed * dt;
    y += inputY * speed * dt;
  }

  @override
  void draw() {
    graphics.print("Hello World", 10, 10);
    graphics.draw(image, x, y);
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dartlove: ^0.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dartlove/dartlove.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: web

Primary library: package:dartlove/dartlove.dart with components: html.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
meta ^1.1.6 1.1.7
Dev dependencies
test ^1.0.0

Admin