Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Allegro 5 and Raspberry Pi

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Allegro 5 and Raspberry Pi
Eric Johnson
Member #14,841
January 2013
avatar

Hi there.

I have recently purchased a Raspberry Pi Model B, and I am interested in creating games for the tiny device. I already know how to create games using Allegro 5, so that's no worry, but will this work on Raspbian? Meaning, will I be able to create and compile C++ code using Allegro 5 on this OS?

Thank you for your time. :)

Indeterminatus
Member #737
November 2000
avatar

I don't know if anyone has tried yet. If not, be the first ;)

_______________________________
Indeterminatus. [Atomic Butcher]
si tacuisses, philosophus mansisses

Eric Johnson
Member #14,841
January 2013
avatar

Aah, a potential challenge then. 8-)

Thanks for the reply.

Hard Rock
Member #1,547
September 2001
avatar

Trent over at http://www.nooskewl.com/ has ported his game using allegro to the Raspberry Pi. The game is now open source and he already made several fixes to allegro to get it to work if I'm not mistaken.

_________________________________________________
Hard Rock
[ Stars Dev Company ][ Twitter ][Global Warming: ARA My TINS 07 Entry][Pong Ultra Website][GifAllegS Ver 1.07]
"Well there's also coolwebsearch but we'll let that be an IE exclusive feature" - arielb on the New Browser Plugins "What's better, HTML or Variables?"

Trent Gamblin
Member #261
April 2000
avatar

Yeah, Allegro 5.1 in git has a Raspberry Pi port. There are build instructions in README_raspberrypi.txt. From a users perspective it's pretty much the same as writing for any other OS. The only difference is whatever you pass to al_create_display will be scaled to native resolution (so you should probably pass native resolution) and the keyboard driver at the console (not in X) is laggy/unusable. Looking for a fix for that..

Eric Johnson
Member #14,841
January 2013
avatar

Trent Gamblin, thank you for the post. What does this mean exactly, will I not be able to use keyboard inputs to power my game on the Pi? ???

Trent Gamblin
Member #261
April 2000
avatar

In X the keyboard driver works well. If you exit X to the command line then the keyboard driver doesn't work so well. There's a bug report open on it. I dunno if I can look at fixing it right now but it's on my list. Maybe since you're going to be one of the first to use the port I can make some time for it this weekend :).

Eric Johnson
Member #14,841
January 2013
avatar

Oh I see. Are you the main guy behind the Pi port?

Trent Gamblin
Member #261
April 2000
avatar

I guess so, I'm the one who initially made the port anyway. It needs some testers making games for it, I think I'm the only one to port a game to it fully. I'll try to get around to the keyboard driver soon as it would benefit my game(s) too.

Eric Johnson
Member #14,841
January 2013
avatar

Wow, that's actually pretty cool; good on you. ;)
On a side note, I won't receive my Pi for about ten days (ordered it yesterday).

Have you tried USB controllers or joysticks with the RPi and Allegro before? The reason I ask is because I want to use a USB controller to play games on my RPi. However, if keyboards may sometimes be an issue with Allegro on the RPi, it would stand to reason that the controller could too.

Trent Gamblin
Member #261
April 2000
avatar

Controllers work fine, or at least mine does. I just had a look at the keyboard driver and found the bug. Seems it was a case of search and replace gone wrong.

We used to have an ALLEGRO_EVENT_KEY_REPEAT, but that was replaced by ...KEY_CHAR. IIRC REPEAT didn't fire on the first press of the key, but CHAR is supposed to. So the code just hadn't been updated, because the RPi port is the first A5 platform to use it.

I'll push a fix in just a few minutes.

Eric Johnson
Member #14,841
January 2013
avatar

I'll take full advantage of my controllers now. ;D

And you fixed it; great going! I can't wait to get my Pi and make some games on it. :D You're the best.

_Kronk_
Member #12,347
November 2010

This is actually really cool. Nice work Trent! Now I have something cool to do with a Pi if I ever get one :D

--------------------------------------------------
"If only our dreams were fires to ignite, then we could let the whole world burn" -Emery

My blog: http://joshuadover.tumblr.com

Eric Johnson
Member #14,841
January 2013
avatar

Long time no see, right guys? :P
So my Raspberry Pi finally arrived today (woo!).

Does anyone have a link to where I could download Allegro 5 for RPi?
I've already downloaded Code::Blocks, and am quite eager to begin. :D

Peter Wang
Member #23
April 2000

Build it from git or the 5.1.5 release (see the announcement on the Allegro Development thread)

Eric Johnson
Member #14,841
January 2013
avatar

Thank you very much. :)

I downloaded the .zip file which includes Allegro 5. Would I just include the entire include folder like I would in any other IDE and it should work on RPi?

Thomas Fjellstrom
Member #476
June 2000
avatar

You'll need to build allegro yourself. Which means compiling it on the Raspberry Pi, or cross-compiling it on your computer.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Eric Johnson
Member #14,841
January 2013
avatar

Thomas Fjellstrom, I have downloaded the 5.1.5 version (which has RPi support, supposedly) and plan on compiling it from my RPi. I'll let you all know how it goes later on, when I have more time.

UPDATE
I attempted to compile Allegro 5 on my RPi using Code::Blocks, but it returned this error...

fatal error: allegro5/platform/alplatf.h: No such file or directory.

Thomas Fjellstrom
Member #476
June 2000
avatar

I don't think you should use CodeBlocks to compile allegro.

Instead, check out the readme file, and use CMake and make to build allegro from the command line.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Eric Johnson
Member #14,841
January 2013
avatar

Oh okay. I'm brand new to this. Ha ha. Would you still recommend I use C::B to write the code? Can that be done; I write the files in C::B, but compile it through the command line?

By the way, I read that I'm supposed to add some direct dependencies (from this page). How does that work? How would I do that with the command line? Like I said before, I'm a complete newbie. :-/

Thomas Fjellstrom
Member #476
June 2000
avatar

Code::Blocks is fine to write your apps. But you should build allegro with the standard build tools.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Eric Johnson
Member #14,841
January 2013
avatar

Hey again.

I've been messing around with compiling C++ code using the command line alone.
It has been working out nicely so far, but I am having issues with Allegro 5.

First off, allow me to demonstrate how I have been compiling code as of late.

g++ -o testprogram /home/pi/Desktop/main.cpp

Assuming that all went well, it could generate an executable on the Desktop called "testprogram".
However, let's say that main.cpp includes Allegro 5...

#include <allegro5/allegro.h>

It would fail. So I thought that I should link to Allegro's full path...

#include "/home/pi/Desktop/Games/allegro/include/allegro.h"

Still, it would fail, because it says that it couldn't find one of the files in which allegro.h was including.
So how would I set a relative path for my includes, and/or how could I link the libraries in the command line?

I appreciate your assistance.

Trent Gamblin
Member #261
April 2000
avatar

Keep it as #include <allegro5/allegro.h>. Then on the command line to gcc add
-I/some/path/include. The directory should have the allegro5 directory in it but not be the allegro5 directory.

Eric Johnson
Member #14,841
January 2013
avatar

Thank you for the reply.

I'm getting closer! Alas, I still have some issues. Mainly, right now it is saying "allegro5/platform/alplatf.h: No such file or directory", then terminates the compilation. I see that alplatf.h.cmake exists, but not the .h file on its own. Should I simply rename it from alplatf.h.cmake to alplatf.h, it compiles further, but runs into issues. My question now is: what do I do with the alplatf.h.cmake file? How do I convert it to .h safely?

Thank you!

Update
I see in the file itself that "/* alplatf.h is generated from alplatf.h.cmake */". How do I actually generate it from alplatf.h.cmake?

Thanks.

Trent Gamblin
Member #261
April 2000
avatar

Check your build directory where you ran cmake. You did run cmake right? It'll be in build/include/allegro5/platform/alplatf.h.

 1   2 


Go to: