SpritePlacer get physics


While far from complete, SpritePlacer now has physics.  Each sprite can have multiple physics shapes added to it.  This allows you to have sprites that aren’t rectangular.  You can see an example of this on the left (click to enlarge), the dumbbell shapes each have three physics shapes.  Two spheres and a rectangle are sufficient to make the collision shape for the sprite.  In addition to the collision shapes (and properties like restitution friction and density) its also possible to have different body types, as well as static and dynamic bodies you can have kinematic bodies.  While there isn’t much use for kinematic bodies at the moment they might be quite useful once I’ve implemented scripting.

There is a bunch of stuff still to implement physics wise and I’ll be resetting sprite positions once the editor is put back into edit mode after “running” the physics.

While I initially just wanted a way to place a bunch of sprites in a “level”, by the time I’ve added physics and scripting I’ll have in effect a 2d game creator.  I’m not sure just yet what events to support (collision, level loaded etc) but its funny how a simple project can gradually evolve into something else altogether!

Posted in Uncategorized | Leave a comment

SpritePlacer a level editor

Straight off the code is at https://github.com/chriscamacho/SpritePlacer As its using libGDX its cross platform, however if you want it to work on a Mac or Android device you’ll need to add your own simple platform stub.

There is nothing special about this simple level editor but it does boast a rudimentary file selection dialog, which is separate enough that you should be able to very easily integrate it into your own projects.

I have to say that I struggle somewhat with libGDX’s GUI as do anything in the wrong order and all sorts of odd things happen! This isn’t helped by the far too sparse javadoc and a wiki that usually just shows you a small bit of code instancing some widgets but not really using them or explaining how they are intended to be used…

But still you can usually bully it (eventually) into some sort of behaviour even if you’re unsure you’re using it in the right way!

LibGDX’s Sprite class is wrapped into a pixy class to store extra properties and also utility functions and a static list of all created pixies.

I chose to save and load from XML and while its only a single layer of hierarchy I still found XML useful.

Saving was by far the easiest task after dumping a very simple header its quite straight forward to iterate in turn through each pixy. The pixy class has a simple method to dump an XML representation of itself to a string.

Loading was a little more complex but I used the built in SAX parser as it doesn’t load the whole document into memory as an object.  The SAX parser uses callbacks as its traversing the document, which once you get your head round actually makes like easier.  Still that said saving is a one paragraph method and loading is a whole multiple method class in its own right!

Although probably not an ideal example of an XML parser, its probably a fair real world example to inspire your own parser (off the top of my head I can think a few ways to improving it – oh dear there I go again wanting to fix working things!)

In the future other than on going tidying I plan to add some kind of more useful user defined data than just a string and may also consider adding scripting and even box2d support.

Development is rather sporadic, but then no one knows about it to contribute so its just me when I get chance…


Posted in Uncategorized | Leave a comment

Debians “handy” fstab entries

Having just installed Debian (XFCE) on my “new” SSD (and boy does it fly! AND I get an extra hour out of the battery!) I hit a rather irritating puzzle.

Whenever I mounted a USB stick is was mounted without write permissions (rather infuriating as it kind of defeats the purpose of *convenient* portable storage) – Well as you do, I fiddled, googled, swore and then by chance happened to plug in a second USB stick and low and behold that had proper permissions, with a little experimentation I also discovered if I inserted them in a different order the original stick could get proper permissions (providing another had broken permissions)

eventually noticed that some where mounted in


and some where in


Well what’s going on here two automount deamons fighting? what?

Eventually I tracked it down to entries for /media/usb0 etc. in /etc/fstab, now I always thought that fstab was really only for fixed none removable devices that *needed* to be mounted at boot time.  Frankly I’d expect better of people from Debian I mean the person who wrote the line to mount /media/usb0 in fstab what, oh what, were they thinking – simply not the place to do it!

Fortunately like most issues in Linux once you know what the issue is, fixing it is trivial – in this case simply removing the misconfigured lines in fstab made the issue go away, now everything is happily mounted in


where it should be and with the permissions it should have….


Posted in Uncategorized | Leave a comment

Whats worse that secure boot ? a badly implemented bios !

NB if you’ve landed here from a search, because you have this issue read below about using a usb keyboard…

All in all I’m very happy with my Fujitsu Lifebook AH532, it’s got a great little cpu with a gpu (HG4000) that’s got plenty of grunt, does all the OpenGL experimenting I throw at it an can even play quite intensive games…

The only one real fly in the ointment is the BIOS, seems if you change your hard drive you are forced to install the new OS in EFI mode (bios mode boot install fails to be booted by the bios) having then installed an EFI bootloader, you can’t get into the BIOS…

A quick google will tell you that its a well known about issue and needs a reflashed BIOS – slight issue you can’t get into the boot menu either, so you have to reset this NVram – great news the two pads you have to short are under the memory – real handy that (still tempted to solder some wires on them and bring it out into a switch (probably in the HD bay) for easier access.

Anyhoo long story short I had allsorts of problems getting back access to by BIOS eventually eventually downgrading to the previous version of the BIOS….

At one point the keyboard wasn’t working at which point I found I could get into the BIOS with a USB keyboard – joy of joys! Now I was in the rest of the laptop to get back a broken tag of plastic that was rattling about and I did reseat the keyboard connector so I can’t tell for sure if that was the issue, but…. I can’t help but think that maybe the inaccessible BIOS and boot menu bug is because the built in keyboard isn’t properly initialised – you will get a beep because its registering a key press – just the wrong one…

If someone does install Linux on a new hard drive and has these same issues, before flashing your BIOS can you try getting into the BIOS with a USB keyboard – if it works or not please DO TELL me by leaving a comment here…. (ta!)

I now finally have a machine booting in BIOS mode (ie grub-pc not grub-efi) and I have access to the BIOS and boot menu… and the really good news – it actually was worth the hassle this SSD I install gives me a 7 second boot time (not that thats important) but it gives an indication of how zippy my machine is…


Posted in Uncategorized | Leave a comment

Configuring Alps laptop touch pad

Here mainly for my own historical notes (but if you happen to drop in here via google – you’re most welcome!) is how I configured my Alps touch pad to do tap clicks, middle button and scrolling etc…

First of you’ll need dkms

sudo apt-get install dkms

dkms is rather handy and will automagically(tm) compile and install from source code kernel modules when you install/upgrade a kernel package…

You’ll need the source from http://www.dahetral.com/public-download at the time of writing the source is at version 1.3.   You should end up with the source in usr/src/psmouse-alps-1.3 if you like this can be a symlink to your own development folder…

It behoves me to thank both the original creator and current contributors of this and wonder why it isn’t just part of the kernel source….

Then its just a case of telling dkms where it is and to get on with it…

sudo dkms add psmouse/alps-1.3
sudo dkms autoinstall
sudo rmmod psmouse
sudo modprobe psmouse

Just a quick note – while you can sudo su and execute the above commands without sudo, I prefer not to as its all too easy to forget to exit the su session and end up doing unintended things still using the root account…

While there are skeleton Xorg configs to use in /usr/share I found a more comprehensive example below – while not all of the features work on my hardware they might work for others…

On Debian testing (jessie) I had to create the following directory

 sudo mkdir /etc/X11/xorg.conf.d

into which I dropped the following config file (50-synaptics.conf)

Section "InputClass"
 Identifier "Touchpad" # required
 MatchIsTouchpad "yes" # required
 Driver "synaptics" # required
 Option "MinSpeed" "0.5"
 Option "MaxSpeed" "1.0"
 Option "AccelFactor" "0.075"
 Option "TapButton1" "1"
 Option "TapButton2" "2" # multitouch
 Option "TapButton3" "3" # multitouch
 Option "VertTwoFingerScroll" "1" # multitouch
 Option "HorizTwoFingerScroll" "1" # multitouch
 Option "VertEdgeScroll" "1"
 Option "CoastingSpeed" "8"
 Option "CornerCoasting" "1"
 Option "CircularScrolling" "1"
 Option "CircScrollTrigger" "7"
 Option "EdgeMotionUseAlways" "1"
 Option "LBCornerButton" "8" # browser "back" btn
 Option "RBCornerButton" "9" # browser "forward" btn

You should only need to restart your xorg session (log out and back in) but if you want to be paranoid you can do a windows (reboot)

While corner buttons don’t work for me, the useful bits like 2 finger scrolling and best of all middle and right mouse button clicks (2 or 3 finger tap) all work great! double tap and drag all in one gesture will also allow selecting too.



Posted in Uncategorized | Leave a comment

Microsoft helping Linux again…

Well I thought it might be the case and from my recent experiences it seems that yet again Microsoft have shot themselves in the foot. With coming so late to the mobile arena (and by mobile I mean tablets etc as well as phones) MS now seem to be wanting to force their desktop users into a touchscreen / mobile paradigm regardless as to whether that’s appropriate or even useful for their workflow. Given that the hardware requirements for their new OS are so redonkulous, the dropping of XP support has conspired to make the perfect storm which has no doubt blind sided MS.

I’ve noticed in conversation for a while now that people are generally uneasy with the direction computing is heading, whether its the future plans for the MS app store (have no illusions that before long it will be the only way you can install/publish software) or the absurd notion that TV advertisers would have us believe – that you MUST throw away old but perfectly functioning and usable hardware.

It’s from this perspective that I’ve heard increasing interest in Linux, for some its just replacing XP and for others its finding out if they might be able carry on their favorite activities but without MS.

At this point its well worth following an aside and asking does the lack of XP support really matter? Here’s a little thought experiment (which you could try if bored!) Take an unpatched original release of the XP install disk, after doing a default install connect the machine to the internet. Without the need to even browse any dodgy sites, just sat there connected to the internet, I would seriously doubt your experiment would last 10 minutes without being exploited – from now on your machine is helping with DDoS attacks or worse helping people anonymously download the most vile illegal material hopefully beyond your imagination …

This somewhat sobering look of what can happen to a machine without support shows what is to come for XP. I have no doubt that already there are some dodgy sites selling script kiddies nicely prepackaged tools that will scan for and use exploits that MS probably do know of but are now doing nothing about. As anyone who’s used Linux regularly knows this is where Linux scores very highly over Windows (any iteration) not only are updates much more frequent but they are much less of a drama even allowing the practical use of your machine (while they happen) and not necessitating the crossing of fingers.

This is one of the corner stones of security the prompt and frequent patching of exploits or even potential exploits.

So could MS have avoided all this? Well, yes actually – you see for years now MS have viewed an OS as some kind of “experience” (remind me what does XP stand for?) in reality all many of us want is a way to launch applications and a glorified file manager… and if a company really can’t make this run on even really modest hardware, even including an app store, then you have to wonder have they lost the ball let alone dropped it….




Posted in Uncategorized | Leave a comment

Olimex A20 battery consumption

2014-03-07-235844_1366x768_scrotStill no enclosure or firm idea of what I’m putting in it, but a keyboard does look certain!

The first power consumption test I did using a 6600mah (3v7 LiPo) is shown with the brown line, because I was running the LCD backlight at 100% and using a conventional laptop hard drive the power circuit called a halt when the battery was still half charged. I strongly suspect that I was simply drawing too much current for the battery to deliver as it became more depleted.

For the second test (in blue) I used a less retina burning but still quite readable 40% backlight and a solid state hard drive I managed to ride the battery all the way down to 11% with a total duration of over four and a half hours.  Although I’m probably putting a bit more of a drain on the battery than I should, I can set an alarm for 30% and shutdown at 20% and still get a little over four hours battery life, not too shabby.

The (power management) reported current is shown in orange, presumably the current is on an upward slope as the battery delivers decreasing voltage…

During these test, the system was put under a low load (10%-20% single core use) grabbing a web page once every 90 seconds, the readings were take once a minute. As the usage was continuous this for me gave an automated rough equivalent of normal use by an actual user, doing browsing and office type activities – ie not 100% on all cores compiling a kernel, while running an immersive 3d first person perspective shooter!




Posted in Uncategorized | 3 Comments

Olimex A20 GLES2.0 and Open Dynamics Engine

Threw this up cause its what I do almost any new platform I explore ;)

I’m in the process of converting my GLES2.0 framework away from GLFW and back to Xlib as I’ve had different issues with different embedded platforms using GLFW, oddly I’ve not seen these issues with my Xlib code…

The Allwinner A20 board here is showing 128 moving “3d” objects falling on a (very) simple mesh, the shaders in use are very simple texture and single light point shading with ambient lighting.  This is running on top of Debian (armhf) running LXDE.  This isn’t pushing a single thread to its limit on this platform and if I separated the dynamics and rendering into their own threads I could probably get 50% more performance (at a guess!)

If you’re interested in the Allwinner A20 be sure and checkout my previous two posts…

Posted in Uncategorized | Leave a comment

The kit arrived – a review of Olimex components

olimex-boxes Its been a few week so its been enough time to give me a good handle on the kit and give a fair minded review from my own perspective.  The first thing I’m going to talk about is rubbish! actually nothing to do with the end product but essential none the less.  I’m sure you’ve either heard of, or even experienced the horror stories about inadequate packaging, from LCD screens “protected” by a thin sheet of bubble wrap and an envelope, to equally thin envelopes containing thousands of pieces of fragmented plastic… I was very heartened to see how Olimex sent the package (which arrived promptly unlike the USPO, it seems UPS don’t just leave stuff in a warehouse for over a week at a time…) Inside the thick waterproof UPS plastic bag was a stout quality carton, inside which were a fair number of hard foam blocks containing the above pictured boxes, all with their own bubble wrapped packages – some with more foam inside.  Its really nice to see that a company is serious about getting their kit to you in good condition rather than shave a few cents of the price (which is ultimately self defeating…)

Build quality wasn’t restricted to the boxes however, throughout build quality is good and I have to say that the products are basically at least as advertised ! so there’s a turn up for the books!

The (A20) board is quite well thought out and the serial-debugnumber of GPIO pins is massively generous, more than I’ve seen in a number of FPGA boards! Given that just about every peripheral connection of the SoC is brought out to a connector this is quite extraordinary, and very nice to see… One thing you’ll want to bring to the party is a serial to USB connector, if like me you have a max232 breakout board and separate serial-usb cable then you’ll need to power the level shifter, usefully the +5 pin of GPIO socket 2 is right next the the 3v3 debug socket…

There are really only two criticisms I can level at the Olimex kit, the hardware and software… don’t worry not all of the hardware and not all of the software!

First of all the hardware issue – alongside the A20 I ordered a touch screen LCD, I can live with the fact that the touch screen is not attached (A little double sided tape soon sorts that) but after carefully aligning the right hand side of the display area, I discovered it was over two millimetres smaller than the actual display area… not ideal… additionally as to be expected from a resistive touch screen, accuracy is somewhat of an issue – no great surprise.  If you want a kiosk type screen with large buttons, then its just the ticket, however gtk/system menu selection even with a stylus are going to be problematic especially near the screen edges.

The software issue – is mainly due to the nature of the flexibility of the board, it could easily be put in an industrial setting running headless, but then just as easily it could slot into a hand held games system.  Due to this even the “ultimate” SD image, should only really be consider as your starting point, although I’ve not done much with the Android image I get the feeling from the forum that the same is the case there…

Olimex has done a lot of the work for us though, their various blog posts contain many useful nuggets of information that can be used to build your own image.  Oddly though debootstrap hasn’t been mentioned, basically given a bootable image and a kernel you can install Debian onto new media very easily.


So what can be done with an A20 system?  Well actually quite a lot, aside from an LCD display you can as easily link it to a HDMI or VGA monitor.  When doing Kernel hacking the previously mentioned debug serial port is very useful.  There is even a SATA interface, however you’ll need a low power device (SSD for example) if you want to do anything on battery power, indeed even with a 6600mAh battery you’re probably pulling more current than you should even with an SSD device.  3D support for the time being is with a binary blob – *sigh* – EGL is a little picky however, for example I couldn’t get GLFW 3.1 to open a window, that said when I changed my framework back to using Xlib everything just worked, but then again my Java wrapper for GLES is working very erratically :( !

My overall impression of the Olimex components is really very favourable especially their LCD modules which are very sensibly priced.  Once you get time to dig into the internals of the A20 it’s really a very nice piece of kit, if you’d set out to build a board without comprise I really don’t think you’d be upset if you came up with this product, it genuinely does get the most out of the A20 SoC.

Given that I want to use a SATA device I’m going to have to look at the battery side of things again and I do fancy stripping that zippy keyboard from its case… I’m going to have to have a think about what kind of enclosure I’m going to put all this kit into (sensible enclosure suggestions most welcome!) … oh and there’s a honeymoon coming up, so it could be a while before my device is fully built…

Posted in Uncategorized | 3 Comments

Build your own Tablet / Laptop – introducing olimex.com

Like many people into electronics I’ve always had the hankering to build my own portable system.  You will often build a PC from components and very carefully select their pro’s and con’s to meet your specific requirements,  This is frequently more difficult with portable system.

After finally giving up on getting a working Pandora, I’m ashamed to say while they were built in my own country the build quality was sadly rather poor.  However I’m glad that I did have various semi working Pandora’s because they did make my mind up on a number of points

  • It must be open source – ideally everything circuit diagrams, datasheets, software and ideally no driver blobs.
  • While it might be nice to multi boot into Android (ASOP) on the odd occasion for me in terms of programming on the go, applications, freedom etc it has to be Gnu/Linux!
  • The graphics and CPU for that matter should at least have enough grunt to allow moderately complex OpenGL applications to be created and run
  • All the usual things you’d expect like Wifi, Chargeable battery etc. but with some exceptions
  • The screen should be a decent size, so bigger than a phone, but still something you could just about get into a jacket pocket
  • SATA – probably a bit much to ask for but an actual harddrive in device would be so much nicer than SD cards in terms or reliability and speed.

My design decisions were not just dictated by must haves but also by a list of things I was quite indifferent to (my Meh list!)

  • GPS / compass  – I don’t have a great use for this as if I need to find something in a strange town I’m as likely to use my phone or shockingly ask someone!
  • Accelerometer / Gyro / G sensor – I often turn screen rotation off on a phone or tablet and do it manually, the device doesn’t know the orientation of your head and gravity doesn’t always point down!
  • RFID tag / RFID reader – Something that might allow retailers to track my physical movements – no thanks, as for a reader I really can’t see a need for it myself…
  • Camera – I have a good quality camera if a focal length that no portable device is going to match… again for a quick snap there’s the phone in my pocket and video sexting isn’t my bag ;)
  • built in analogue stick, keyboard, fire buttons etc… Gaming isn’t my primary concern, that said there will be USB ports and I may well make a tablet lap-perch / sleeve thingie that I can plug the tablet in, that should have keyboard / joystick – add a wireless mouse and that should do the trick.
  • 3/4 G I thought long and hard about this there is always tethering but the only real use I have for mobile data is an occasional price check most times for anything more substantial I’ll be inside a WIFI footprint.
  • built in FPGA – well no… if I want to design some custom circuit I’ll wait till I’m back home! this isn’t going to be a monster bitcoin mining monster!

Well so much for thoughts on design then, how about practical considerations… My initial investigations into displays (for me what seemed the major hurdle) resulted in disappointment whenever I looked.  All I seemed able to find were really VERY expensive displays at disappointing resolutions or worse still great looking kit that turned out to be vaporware  (very frustrating) … months went by…

It seemed the way to go would be to salvage an LCD panel from a netbook and find some kind of HDMI -> LVDS / power board – again more vaporware and more disappointment.  Finally it looked like I had an excuse to get into FPGA’s ! YaY – no where as difficult to get into as I expected and before long I actually had some kind of VGA controller working, as practice for the glue I’d have to build for whatever LCD panel – I knew it would be hard… but I was sure I could do it.

I spent a long time looking for some kind of SBC to base my design on and this was very much because of the design choices I had made. For example the Raspberry Pi was a possible candidate for a while but although its touted as an open source machine as many know it has a dirty little secret – the slave (arm) CPU eventually got open source drivers or rather interfaces but the master (gpu) processor that really runs the whole show is strictly an off limits propitiatory black box, single core, a little slow and not massive amounts of memory – especially if you favoured the GPU eventually all ruled this SBC out.

So with not a massive amount of hope I kept looking, one night while browsing near to bed time I stumbled into this website – hardware looked good, there even seemed to be some displays… tired I plodded off to bed.

Then I had a feverish dream…. The SBC had open source GPU drivers faster than the proprietary ones… it was dual core….. it even had just about enough RAM… there were lots of interface options… 100’s of GPIO pins (literally) …. there seemed loads of sensor modules too…. and the kicker it had a SATA interface… what a LiPo charging circuit? WOW! ….and then the dream just went wild, not only were there LCD modules, but included in the price were interface boards that you could just plug directly into the SBC and they would just work…

Of course all this would mean that the price MUST be through the roof, but wait the more I looked these prices seemed realistic - it would be economically practical and even desirable to build something with this….

Of course I was dreaming!!!  Never the less the next morning I determined to clear the fevered fog from my mind and take a proper look at the olimex site I had discovered.  I literally could not believe what I was looking at, I actually wasn’t dreaming, this was affordable good quality kit and these weren’t some fly by night vaporware company, these are guys supplying the likes of Digikey, Mouser and Farnel none of these guys are going to deal with anything other that the real deal!

Well after a day or so thinking about do I make a laptop, or a tablet (or both!), I flexed the old plastic friend and bought an A20 board (which the spec reads like they followed everyone’s wish list and added a few extra bits) and also a 7″ LCD touch screen, with a few other bits and pieces I decided I’d need not forgetting TAX and postage it came to a little over 200€ which amounts at the time of purchase to something in the order of £165 – that includes a LiPo battery too – sure I’ll need to make myself some kind of enclosure but these guys have just made my dream an economic plausibility!

So now all I have to do is….

  • wait for it to arrive…
  • assemble it…
  • make the software stack work how I want…
  • make a enclosure that will fit in a jacket pocket…
  • not much then…

but think on this – basically its just an assembly job, probably no electronics involved! I wouldn’t want to be a laptop manufacturer in the coming years….

BTW I’m in no way involved with Olimex – just amazed at their products that answer so well a problem I’ve been chewing over for literally years.

Posted in Uncategorized | 4 Comments