Wednesday, 11 May 2016

Back To Outer Space

You know that feeling when you dust down an old project and you remember how much fun it was to work on? That!

I started a shoot-em-up late last year. Needed a bit of a tidy up as did my simplegamelib package but the first level of the game is playable right here! So take a coffee break a blast some aliens old-school style complete with programmer pixel art.

For more serious game development in Dart, check out the impressive StageXL package.

Saturday, 7 May 2016

Minecraft Screenshot Viewer Update

This little example was written over 3 years ago and needs a little fix (1 line) to run on more modern versions of Dart. The content type headers are now available as enums and ContentType.HTML prevents the page being served as plain text. Although it is 'Minecraft' you could easily adapt this for any sort of custom web server.

For the full code see GitHub.

Tuesday, 3 May 2016

A Web Status Panel On The Raspberry Pi - Part Two

In part one of this series, the status panel on details exposed via the dart:io package. To get more useful information we will look at running external commands and feeding them back to the web status panel. This version of the panel will be Linux (may work on a Mac!) only though could be easily modified for other platforms.

The dart:io package has a useful command to execute a process with arguments and collect the results. This is unsurprisingly asychronous. I chose to wrap the command into a little helper:

  runCommand(String command, List args) async {
    ProcessResult results = await Process.run(command, args);
    return results.stdout;
  }

One of the commands I wrapped was free to get memory usage:

  get memoryUsage async {
    return await runCommand("free", ['-o', '-h']);
  }

The code for the web status panel is available from GitHub. A couple of configuration points. Firstly, you will need to set you own IP on the server. Secondly, depending on the version of Linux you are using on the system, you may need to open up the port through the firewall software.

The ARMv7 version of Dart is available from here - select Linux from the OS dropdown if it is not shown automatically. I am finding Dart is a good environment to run on the Raspberry Pi. Small, lightweight, fast and has certainly been less bother that running Python at times.

Please leave a comment if you have created anything interesting on the Pi with Dart!