Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Guys this is a really important question

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Guys this is a really important question
Polybios
Member #12,293
October 2010

pasta/

dada__
Member #16,089
September 2015
avatar

I use this:

src/ - all .c and .h files, object files are placed here too
resources/ - source files for my sprites/etc
static/ - all static files copied over when making a dist (DAT files are generated automatically from the resources and placed here during a build)
vendor/ - vendor code, including Allegro
dist/ - builds and dist zip files

I'm new to C, so I've never thought about project structure too much. It's just that I like simplicity. But I should probably at least put the .o files somewhere else.

Mark Oates
Member #1,146
March 2001
avatar

I like your choice for resources/.

Currently my resources go in bin/data/, but I might change that over to bin/resources/.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

bamccaig
Member #7,536
July 2006
avatar

As a convention, bin/ isn't for all non-textual files. It's for executable, often-though-not-necessarily binary, code. It would make better sense to have a separate directory for that. On a Linux file system you'd expect to install those kinds of things in /usr/lib/$program/. Locally it probably makes sense in a directory next to bin. Resources is a good description, but it's also very verbose. I like media/ for audio/visual data. Another good envelop is just data/.

Mark Oates
Member #1,146
March 2001
avatar

For me, it might end up being something like this:

bin/
  data/
    bitmaps/
    config/
    documents/
    fonts/
    languages/
    layouts/
    models/
    samples/
    scripts/

Also noticed that this is the way liballeg does it with build. The build/ dir (apparently just now realized) copies contents from ./data/ dir into ./build/examples/data/. But in this case, the binaries sit in examples/ and not in bin/ 🤔

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Audric
Member #907
January 2001

bamccaig said:

As a convention, bin/ isn't for all non-textual files. It's for executable, often-though-not-necessarily binary, code

In case some people can't think of an example, it means this is a right place to store scripts. A file with no extension could perfectly be a shell script (similar to a Windows .BAT file), perl script, Lua script or whatever. In the Unix/Linux world, the first line of the file would determine what should run it when you double-click it or type the name in command-line.

m c
Member #5,337
December 2004
avatar

#SelectExpand
1 2 Volume in drive C has no label. 3 Volume Serial Number is F4FD-FC3A 4 5 Directory of C:\Users\capt\Dropbox\master 6 712/16/2016 08:18 PM <DIR> . 812/16/2016 08:18 PM <DIR> .. 912/07/2016 08:08 PM <DIR> assets_buildtime 1012/16/2016 08:14 PM <DIR> assets_runtime 1112/15/2016 12:18 AM 4,266 CMakeLists.txt 1212/15/2016 04:10 PM <DIR> include 1312/13/2016 01:35 AM 6,653 Makefile 1412/16/2016 05:18 PM <DIR> src 15 2 File(s) 10,919 bytes 16 6 Dir(s) 307,930,775,552 bytes free

And "Data" is in another directory entirely. The program searches several locations on startup for a folder called Data with a file called instlist.ini inside it to automatically chdir into there, so it doesn't matter where the program is run from, it will find the game load files in c:\temp\Data, <userfolder>\Dropbox\Data, ./Data, ./../Data. ./../../Data, etc...

I always thought "how can I make it simpler" but then I couldn't.

When it can be installed, it can also check the registry for a install location to look for data. That way there is no need for "copy data files to build directory" for it to run, and no difference between debug build&run and installer->program files run.

(\ /)
(O.o)
(> <)

Thomas Fjellstrom
Member #476
June 2000
avatar

src and include.

--
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

GullRaDriel
Member #3,861
September 2003
avatar

Like Thomas.

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

 1   2 


Go to: