Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Allegro 5 Book

This thread is locked; no one can reply to it. rss feed Print
Allegro 5 Book
bamccaig
Member #7,536
July 2006
avatar

I don't know X-G personally, but damn do I respect his drive.

FYI, there is a literal "X-G" member that has been away from the boards for a couple of years, but has been here for many years, is much more well known, and much more respected. You should refer to members with their full name to avoid such ambiguity.

AleX-G Squadron
Member #13,593
October 2011
avatar

@Gideon
Thank you!

@furinkan
If you are an english native speaker, it would greatly help if you translate chapter 2, which i have added as an attachment.

Whatever help anyone gives, it would benefit all allegro users.

www.anothergames.com

Trezker
Member #1,739
December 2001
avatar

While I agree it's a good idea to step back and look at the big picture and structure the book properly. I think at this point it's best for the progress to keep bulldozing through all the features of Allegro, you building good material that you can use in the book puzzle.

Also if you should burn out and say screw this in a few days, you'll have written a whole slew of good material that you can put up right away even if it's not all polished to perfection yet.

Keep going, I think it would be great for Allegro 5 to have a book. You're a hero for actually working on it.

Gideon Weems
Member #3,925
October 2003

I assumed AleX-G was the original X-G's reincarnated version, having shifted his skill points from lingual mastery to drive and dedication... Is that not the case? If so, I apologize.

AleX-G: Do you think you could attach a more easily editable format than PDF? I'd be happy to help, even if just a little.

AleX-G Squadron
Member #13,593
October 2011
avatar

I am not the X-G you are talking about.
Mine is a nickname where G stands for Gangsta, but that is just for fun.
I hope all want to help, because i am not going to let the work in the middle.
I am on page 133, just for curiosity.

I attached the second chapter on docx format.
You can edit the second chapter now.
Thanks for consideration!

www.anothergames.com

weapon_S
Member #7,859
October 2006
avatar

Everything that Trezker said I'd like to underline. I'm not very good at giving positive feedback... You seem to be going at an impressive pace. Don't forget to take a break after you have this job done.
Maybe I'll have a look at the docx.

AleX-G Squadron
Member #13,593
October 2011
avatar

Thanks. I was actually needing a lot of help with transformations.
I want to include it as a chapter, but since i only got the scale transform to work
I think it will not be done, unless someone can help with examples of all kinds of transformations, so i can verify they work and understand them better.
There is going to be a lot of work, but i think i will end working on the book on 1st September, because of the exams. I will work on the book in October after i am done with school. So, if you want the book as fast as possible and best possible, pls help!

www.anothergames.com

GrantG
Member #8,173
December 2006
avatar

Hmm, maybe I'm in the minority when I say this, but I always thought books were kind of useless for APIs that are being continuously developed.

By the time the book is done, proof-read, published, etc. The library/language/whatever has another version already released, or in development.

I'd much rather have an online manual or wiki that can be quickly updated or split into versions, than a book that is already somewhat outdated from the day I buy it.

Mordredd
Member #5,291
December 2004
avatar

I learned programming with allegro 4. I think, back then, it was really what a beginner needs to know, I could paste some commands, allocate some memory, write to it, blast it to the screen and write messy code. It was ideal for hacking.

I remember that I tried allegro 5 once, it worked immediately, but I feel its concepts are (probably obviously) more advanced than those of allegro 4. For me the point is: when I am able to understand and use allegro 5, I am probably also able to use other advanced libraries to create games and "surpass" it. For example, I use a lot of Qt with OpenGL directly, so I have no reason to come back to allegro 5 again, althought in itself, it is not bad. Since a long time, Qt does the event loop stuff, platform-independent threading, networking stuff, GUI and a lot of other neat things for me. For an advanced game I probably would look into readily available engines and adapt them.

The "hacking it together"-mentality of allegro 4 gave it its own validity.

edit:
The whole point: allegro 4 was so simple you did not need a book to understand it.

Trent Gamblin
Member #261
April 2000
avatar

Qt is great for games. It has Android and iOS ports, 90% of the drawing operations you need in OpenGL for 2D games, the list just goes on. Oh wait, that's Allegro 5! :P

LennyLen
Member #5,313
December 2004
avatar

For fun, I reformatted the given chapter using a more standard textbook page size and formatting style. It reduces the chapter from nine pages to two and a half, which is still, in my opinion, a bit too long to devote to showing how to create a dialog box.

I was going to edit the text to a language style that I considered more appropriate for such a book, but then I realized I'd have to rewrite everything, so didn't bother. Especially since, as I already mentioned, I think this topic is given far more length than it deserves.

Also, the code sample given needs to be rewritten:

#include <allegro5\allegro.h>
#include <allegro5\allegro_native_dialog.h>

int main(void)
{
   al_show_native_message_box(NULL, "3.5",     "321World!",
   "Hello world!", "Whatever|Maybe","ALLEGRO_MESSAGEBOX_YES_NO");
   return -1;

   if(!al_init())
   {
      al_show_native_message_box(NULL, NULL, NULL, "Error!", NULL,
      NULL);
      return -1;
   }
}

I haven't really done any A5 programming, but I'm sure this is what you want:

#include <allegro5/allegro.h>
#include <allegro5/allegro_native_dialog.h>

int main()
{
   if(!al_init())
   {
      al_show_native_message_box(NULL, NULL, NULL, "Error!", NULL,
      ALLEGRO_MESSAGEBOX_ERROR);
      return -1;
   }

   al_show_native_message_box(NULL, "3.5",     "321World!",
   "Hello world!", "Whatever|Maybe",ALLEGRO_MESSAGEBOX_YES_NO);
   return 0;
}

Even then, will the al_show_native_message_box(NULL, NULL, NULL, "Error!", NULL, NULL); line even work if al_init() fails?

edit: Apparently the answer to that last question is yes, going by the manual.

Mordredd
Member #5,291
December 2004
avatar

Qt is great for games. It has Android and iOS ports, 90% of the drawing operations you need in OpenGL for 2D games, the list just goes on. Oh wait, that's Allegro 5!

I think you are not up-to-date. Qt also offers a powerful 2D object engine, btw. Forget about writing low-level object handling stuff, place your objects and run your game. What about networking in allegro 5?

http://sourceforge.net/p/necessitas/home/necessitas/

I have tested Necessitas and it works great. Afaik, there are also efforts to have Qt on the iPhone, but I am too lazy to google for it.

edit:
Another link: http://qt-project.org/doc/qt-4.8/QGraphicsScene.html

Trent Gamblin
Member #261
April 2000
avatar

None of that is actually good for games, aside from the networking. But I remember, you couldn't compile A5 yourself so you found something easier.

Just to demonstate. Here are the top rated games on qt-apps.org. These are the type of games you'd get with an operating system, but far from anything complex:

http://qt-apps.org/index.php?xsortmode=high&page=0&xcontentmode=4250x4251x4252x4253x4254&PHPSESSID=0a61f54cc58549290b8d0b8852c9e879

Dizzy Egg
Member #10,824
March 2009
avatar

As someone who has been using Allegro 5 for about 2 weeks, I can safely say from MY point of view that I wont ever want for another "games" library. It's easy to build under Windows with CMake, easy to link under Code::Blocks, and a pleasure to work with using events & blenders. Plus the options of integrating your own shaders makes it a 2D powerhouse. All input is handled, and addons include .ttf fonts and audio.

Anyone who doesn't like Allegro can't understand Allegro. No, can't build & install Allegro.

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Mordredd
Member #5,291
December 2004
avatar

But I remember, you couldn't compile A5 yourself so you found something easier.

There is no reason to be that arrogant. I had issues with cmake, since I never used it before at that time. Of course, I got it to compile. I am not Super-Trent, sorry.

While it's true that not many people use Qt for games, it is more than capable for this. Look here for what's possible with Qt: http://qt.nokia.com/qt-in-use/ambassadors/showcase/ (Under Industry select "Games/Entertainment")

SiegeLord
Member #7,827
October 2006
avatar

The whole point: allegro 4 was so simple you did not need a book to understand it.

Yes, it's so simple nobody has written tons of tutorials on it and a book. Why would they? In addition, since Allegro 5 is so complex, that currently, without a book, positively nobody is using it.

While it's true that not many people use Qt for games, it is more than capable for this.

So's Excel, and it's hardly an alternative to Allegro :P. I really don't see your point... you can use OpenGL with Qt? You could use OpenGL with Allegro 4 too. The point of Allegro 5 is that you don't have to use OpenGL directly... Allegro will use OpenGL on Linux/OSX, Direct3D/OpenGL on Windows, OpenGL ES on Android/iOS... all while abstracting the differences between those frameworks.

As for there being high level engines out there (like QGraphicsScene), A4 had the same issue, so it's hardly a point of comparison between A5 and A4. If you liked using low level features in A4, you'll like using them in A5. If you don't like using low level features, then you weren't/won't be using A4 to begin with.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

amarillion
Member #940
January 2001
avatar

Hey Alex-G, keep up the good work.

Here is some feedback on chapter 2:

Quote:

Being a string you will have to put between parentheses in order for it to work

-> I think you mean quotes: ", not parentheses: ()

Quote:

The same thing goes to the third parameter and the fourth

-> The same goes for the third and fourth parameters.

Quote:

in order for it to work

-> This is correct, but a very dense style that is more appropriate for scientific papers. It might be simpler to write "to make it work", or remove that bit of the sentence all together.

When I write code tutorials, I always like to give the code a distinctive style from the rest of the text. For example create a style in word for code, using a monospace font (such as courier new), and a light-grey background.

Final remark, you use a rather large font size. No wonder you write so many pages so quickly :) For the final version you will probably want to use a smaller font size.

Anyway, I applaud the effort. You probably won't make any money on this, but if it helps somebody, than it's totally worth it. I wrote a couple of tutorials myself a long time ago, and I still occasionally get positive feedback on it.

AleX-G Squadron
Member #13,593
October 2011
avatar

Thanks for the feedback.

I use large font size, because there may be people with problems in reading books
with little text. I myself hate little text because it makes your eyes dehydratate.

I think the text has to be big since there is no way the users will want to read
little text. The book is going great and i will try to include what i will learn on
this forum too. One think i am greatly keen on now is the transformations. I made
some nice mods to the old game i made last year and i think the work on the book has to go on.

There were some negative comments with the idea of the book, which i think were
extremely stupid and lowered the notoriety of the users writing them.

Again, thanks for all replies even to haterZ! 8-)

www.anothergames.com

furinkan
Member #10,271
October 2008
avatar

I read quite quickly (compared to most people, not you guys :P ), and I find the font being this big an irritant. My eyes are getting sore from moving left to right so quickly, and its difficult to read at my normal speed.

If you want to please people with poor eyesight, then keep it at 12 or 14 pt for regular text. I wouldn't even print this out, because I'd have to use a LOT of paper to get the info I wanted.

I usually take normal-sized pdf books and print them 4-6 pages per sheet to save paper.

EDIT:

I know its asshole-ic of me to ask without reading, but what are you using to write this in? Spinning off of Amarillion, it may be beneficial to syntax-highlight your code, that way it can be analyzed easily. Line numbers are a must.

AleX-G Squadron
Member #13,593
October 2011
avatar

I am using word 2010 to write it.
The font size is 22 but i will reduce it to 16 and there will be much less pages than expected.

www.anothergames.com

furinkan
Member #10,271
October 2008
avatar

If you write your code in an IDE, they usually have an export to rtf/html action. You can use that to copy your beautifully formatted (and dare I say functional!) code into word.

Personally, I still feel that 16pt is header sized font. There is the 'zoom' feature on the computer, and I'm pretty sure that anyone who has problems reading printed text probably already has reading glasses.

If you are using word 2010, I believe it has a way to index things. A book can never be better than its index!

LennyLen
Member #5,313
December 2004
avatar

16pt is still absurdly large. Fonts for print are generally 8 to 9pt. At the current rate, this book is going to be several thousand pages which means it would never be able to exist in physical form as the printing costs would be astronomical.

As much as I like the idea of a book for Allegro 5, I'm afraid I have to consider the current effort to be misguided and far too poorly written to be of practical use.

gnolam
Member #2,030
March 2002
avatar

Since everyone else is being too polite, I'm going to be the one to say it: if you're still at the level of asking questions like this one, you shouldn't be writing books about Allegro 5 or game programming.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

AleX-G Squadron
Member #13,593
October 2011
avatar

I don't know what size is going to be the font then. I will let you guys choose it, as best as possible.

@gnolam
Actually, go ask other people, who are very polite to give prices to their books around 20$-60$.

EDIT: BTW, i now know how to make the autoshooter.... so i am the right person to make the book!

www.anothergames.com



Go to: