Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Hellows

This thread is locked; no one can reply to it. rss feed Print
Hellows
Andre Xavier
Member #16,694
June 2017

Hellows, peeps!

Its been more than 6 years since I last coded something in C and I totally lost touch with allegro and game programming. Now that I have some time I want to recover this much appreciated hobby and I hope that soon, maybe not as soon as I want, this old man will be coding again.

I just have some questions to put myself in the right path:

I must be really old but why the installation area reads more than 4K topics but when I click on it just show 4? I really checked the options and changed them to display 100 but still just 4 shows up. Funny thing...

What would you recommend me? C or C++?

And I would like to say its good to be back! Im surprised with how many small games are in the allegro.cc website and how things have evolved so much! Actually, I feel lost at some things yet... :P

Anyway, thanks all for keeping everything up! I love you all, guys!
Hugs!

Xavier.

=^.^=

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Welcome, Xavier!

Xavier said:

I must be really old but why the installation area reads more than 4K topics but when I click on it just show 4? I really checked the options and changed them to display 100 but still just 4 shows up. Funny thing...

That's the a.cc forums for you. You have to search the forums or change the display date to see other older threads. Your best bet for information on Allegro is at http://liballeg.org first, and at http://wiki.allegro.cc second.

Xavier said:

What would you recommend me? C or C++?

If you're just getting back into programming, I would recommend C for now, and then move on to C++ when you're comfortable. Pretty much everything you can do in C you can do in C++ as well, but not the other way around. I suggest starting with the Allegro 5 tutorials on the wiki here :

https://wiki.allegro.cc/index.php?title=Getting_Started

https://wiki.allegro.cc/index.php?title=Allegro_5_API_Tutorials

Dizzy Egg
Member #10,824
March 2009
avatar

Hello! I agree with Edgar, C with Allegro5, make something amazing!

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

Andre Xavier
Member #16,694
June 2017

Thanks a lot for the guidance!

Definitely I can go with C for a restart! That makes everything a LOT easier! I would like to make a tic tac toe game for a start too! :D

I remember the old allegro 4.something with all the examples from George Foot. I loved that. I was considering checking them again before trying the version 5. What do you think?

I got mingw and code blocks. I tried codelite first but I definitely have a better feeling from code blocks. A lot less things on the screen makes it easier for me to read. :D I have been trying to install the allegro 4.x version but Ive been failing miserably. I got the version 5 but Im not sure exactly what to do with that to include them. Im not sure bettwin static or dynamic including it.

By the looks of it everything got a LOT more complicated after all these years... Holy crap, I really feel overloaded and lost sometimes... O.o

=^.^=

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Hey Xavier, let me help you out a bit.

First you need to pick a compiler that matches your version of allegro (whether it's for 4 or 5). Second download the binaries. Since you're going with CB and MinGW I suggest you start out with my pre-made binaries from here :

https://www.allegro.cc/forums/thread/616935.

Simply extract the folders anywhere you like. Generally you move the mingw folder to c:\mingw to make it easier for codeblocks and other programs to find your compiler.

Next you need to setup either your command line or your CB project (do not use the global compiler, it just mixes and messes everything up).

First I'll show you how to compile with a simple command line :

Here's a simple list of commands to use with gcc :
-I path\to\include\dir
-L path\to\lib\dir
-l$NAME where $NAME is libNAME.a,
-o $OUTPUTFILENAME
-g (add in debugging symbols)
-O[0-3] (ie. -O1) optimize from 0 (none) to 3 (lots)
-c output only object files
-Wall turn on all warnings
-Wextra turn on extra warnings
-Werror stop on errors (usually not very helpful)

Anytime you open a command shell, you'll need to set your %PATH% variable to include c:\mingw\bin or wherever you installed MinGW. You can do that with :

c:>set path=c:\mingw\bin;%PATH%
c:>set path

The second command will output the current path. You can also change your system environment variable PATH to do the same thing if you want it to be permananent.

In CodeBlocks go to Menu->Project->BuildOptions and click on the overall project button in the top left. Then select search directories and set the compiler and linker search directories to match those of your allegro distribution that you are using (ie. from the binaries I provided, in the \include and \lib folders. You also need to set the linker settings (for the libraries that you need to link to) here :

Compiler Search Directories
{"name":"610945","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/2\/f28c2d7e98ef59a6c8ea033eb235d79f.png","w":744,"h":424,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/2\/f28c2d7e98ef59a6c8ea033eb235d79f"}610945

Linker Search Directories
{"name":"610946","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/1\/119f8a26416d8aeb73c4241312b2b57c.png","w":744,"h":424,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/1\/119f8a26416d8aeb73c4241312b2b57c"}610946

Linker Settings
{"name":"610947","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/b\/2bee17cd67ba42461170e7e550ec8e0f.png","w":744,"h":424,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/b\/2bee17cd67ba42461170e7e550ec8e0f"}610947

After that you'll need to add files to your project by using Menu->Project->Add Files or Menu->File->New File. Then build and run the project as necessary, fixing compiler errors as you go.

There are more advanced things, but those are the basics. I'll see if I can't get this up on the wiki. The page up there for codeblocks and mingw is like 10 years out of date. :P xD

l j
Member #10,584
January 2009
avatar

C is less complex than C++. Learning C first might help you understand low level memory management better and will probably help you to keep things simple.

C++ has many more concepts and will encourage you to write things more abstract, at least in my experience. But it seems a lot of people eventually end up learning to love over-engineering everything.

If you learn C++ and C after you might have more trouble with memory management and exceptions as you won't have smart pointers or destructors.

If you learn C and then C++ you might have trouble with best practices and write code more prone to memory leaks and error as you'll more likely end up writing C-like C++ code not making proper use of destructors, smart pointers and containers.

On the other hand what is considered a best practice in general application development might not be considered a good practice at all by some or many for game development.

One big advantage of C is that it easily interfaces with almost everything. Pretty much any programming language will have an API for making calls to C libraries while you'd probably have to write a C API on top of your C++ libraries to do the same thing.

I don't think it really matters whether you choose C++ or C to learn. Maybe learn them both at the same time or do something like learning Haskell and C at the same time to learn to think at a very high and a low level of abstraction.

Andre Xavier
Member #16,694
June 2017

Ooooook! :D

Edgar, you are my hero! Everything is working now! I got a small code from the allegro wiki to test the display, compiled it and it works! The only funny thing is that I need to copy the dlls to the folder where the executable is so I can run it. I suppose that eventually Ill find out which dlls are necessary and which arent. I think I can finally begun to focus on learning allegro again alongside C. Thanks a lot, friend! :D Im your fan now!

By the way, whats that -leagle_debug command on the linker settings?

And Taron, thanks for the advice! Ill go slow and stay just with C for the beginning then. No need to complicate anything anymore than it already is, right? :)

Is Shawn Hargreaves still around? He still is part of the allegro community?

Thanks a lot, peeps!
Hugs.

Xavier

=^.^=

Gideon Weems
Member #3,925
October 2003

I remember the old allegro 4.something with all the examples from George Foot.

Allegro Vivace? It's on the wiki.

Quote:

By the looks of it everything got a LOT more complicated after all these years...

It may seem daunting, but if you take Allegro 5 in bite-size chunks, everything (except maybe voices/mixers) fits together very nicely. The wiki helps a lot!

Chris Katko
Member #1,881
January 2002
avatar

Allegro 5 sounds more complex but really it all comes down to "set up allegro, setup graphics, make an event queue, tell the queue to respond to whatever events you want (drawing, logic, keyboard), and when the event is fired you call the right function in your main loop."

I put together a "template" main source file that has all those filled in already, so whenever I make a new project it's already ready-to-go.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

bamccaig
Member #7,536
July 2006
avatar

As far as I know Hargreaves has not been part of the project for a decade or more. He has moved on to greener pastures. Last I knew he had been a part of the XNA team, and also its successor. As far as I know he's still part of Microsoft, but I'm not sure where he is anymore. Not that I ever knew him or interacted with him. He's just a legend. For all I know, it's all bullshit and God created Allergro on the 8th day.

Chris Katko
Member #1,881
January 2002
avatar

http://www.shawnhargreaves.com/

Quote:

Microsoft, 2005 to present
2016-
Dev lead for PIX on Windows.

2014-
Dev lead for Win2D and Microsoft ANGLE team.

2012-2014
Dev lead for graphics on Windows Phone.

2008-2010
Responsible for graphics in XNA Game Studio 4.0, including API improvements and the new Windows Phone platform.

2007-2008
Added LIVE networking features to XNA Game Studio 2.0, 3.0, and XDK Extensions.

2005-2007
Designed and implemented the Content Pipeline for XNA Game Studio Express.

In addition to my product development work, I supported the XNA game developer community through blogging, conference presentations, developer support forums, and by writing many of the XNA samples. See www.shawnhargreaves.com for links.

https://blogs.msdn.microsoft.com/pix/introduction/

Quote:

PIX is a performance tuning and debugging tool for Windows and Xbox game developers using DirectX 12. It provides seven main modes of operation:

GPU captures for debugging and analyzing the performance of Direct3D 12 graphics rendering.
Timing captures for understanding the performance and threading of all CPU and GPU work carried out by your game.
Function Summary captures accumulate information about how long each function runs for and how often each is called.
Callgraph captures trace the execution of a single function.
Memory Allocation captures provide insight into the memory allocations made by your game.
File IO captures help you identify inefficiencies in your title’s disk IO patterns and package layout.
System Monitor displays realtime counter data while a game is running.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Go to: