Thread: Setting up a project environment?

  1. #1
    Registered User
    Join Date
    Dec 2016
    Posts
    20

    Setting up a project environment?

    Hello people,
    This is not exactly a C question other than it being a C project, but I figured there are experienced people here so I posted here anyway.

    We are having a project course later next semester where we're supposed to make a game using primarily C and SDL. There are a lot of question marks for me as I’ve never been involved in game development (outside of modding) before.

    I’m mostly a windows user and back when I learned to program C I used Codeblocks to compile my code, other than that I have Ubuntu on a VM which I’ve used modestly.

    Setting up a project environment is being ridiculously hard or there are some fundamentals I’m not understanding. All I got working so far following the lazyFoo tutorials is SDL.h, when I tried to include _image.h or _ttf.h the compiler couldn’t find the h-file.

    The libraries that need to be included on top of my head are:
    SDL, SDL_ttf, SDL_image, SDL_net, sdl_audio, OpenGL, and possibly freeGlut.

    [1] Having this much trouble with the first two libraries is discouraging. And when the project actually starts a bunch of people will have to go through the same hurdle. Is there a good way of creating a shared project environment for everyone so that everyone can start from day 1?

    [2] I don't know what OS people will be working on and how that could possibly effect the compatibility during the making of the game.

    [3] Can I just skip using an IDE and just code in a text editor, and moving the libraries I need into the project folder directly instead of having to install them directly on my computer. Maybe the game should be developed in Linux?

    [4] Having been involved in a modding community for Warcraft for many years people crated all sorts of useful libraries, but I can’t seem to find anything that appealing for C. Except for a few articles of algorithms or tutorials.
    The first thing I wanted to make was a menu, but having to program my own library for creating different menus is very time consuming, and having to basically reinvent the wheel for everything you need done in your project seems overwhelming. Surely there must be stuff out there of use. Any suggestions of where I can find such work?

    [5] Any suggestions for reading material or tutorials for me on the topics of game design, C, SDL, OpenGL, algorithms, Project structure, etc.?

    [6] Anything else not included above.


    Writing this makes me miss programming in java...

    Sorry for asking such a broad and open ended question, and thanks in advance for your feedback.
    Last edited by Tiago Redaelli; 12-22-2016 at 06:29 AM.

  2. #2
    Registered User
    Join Date
    Dec 2010
    Location
    Shamokin PA (middle of nowhere)
    Posts
    145
    [3] Can I just skip using an IDE and just code in a text editor, and moving the libraries I need into the project folder directly instead of having to install them directly on my computer. Maybe the game should be developed in Linux?
    It doesn't work to just use a text editor, e.g., Windows Notepad, or whatever, because, even if you invoke the build system (whatever it may be, e.g., GCC, MSVC, etc) from the command line, any error messages or warnings will specify a line number. And if the line number is much greater than 25 or something like that, you are for sure going to wear yourself to a frazzle counting lines, and likely you'll wear your cursor up/down key out.

    I gave up on IDEs for creating projects a long time ago, and just build from the command line. About the best editor I've found so far is the Code::Blocks editor. I think I'd count NotePad++ a close second. So what I'm saying is that getting the IDE to correctly set up complicated projects to build can be a problem. just as you are finding out. The deal is that IDEs revolutionized coding many years ago - back in the 1980s. Before that everybody built from the command line. So since the adoption was so fast and total everybody started building bigger and more complicated IDEs to make coding easier. But I think a point was reached something to the effect of 'too much of a good thing'. I think we're way beyond the point now where IDEs are improving. In my opinion they've been getting worse for years and aren't even fit to use anymore. So I've gone full circle and build from the command line both with GCC and MSVC. But I still use as stripped down, simple, and lightweight of an editor as I can find. All I want are line numbers to allow me to go to the line mentioned in warning or error messages, project management ability to quickly allow me to move between files (I work on large projects usually with several dozen files), and a listing of functions in a seperate 'pane', where I can click on a function name and be quickly be taken there. I try to turn off every garbage option I can find such as intellisense, pop up code helpers, all that trash. At least its trash to me. I'm sure many others love it and that's fine. They can have it.

    In terms of building code, having to spend hours and hours fighting with the IDE to allow it to correctly locate everything it needs to build its command line string to send to the build system just drives me to exasperation. I'd rather be working on algorithms or writing code.

    These are just my thoughts related to one small point of your overall series of questions. I've told you what I do. Your milage may vary.

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    Quote Originally Posted by Tiago Redaelli View Post
    ... when I tried to include _image.h or _ttf.h the compiler couldn’t find the h-file.

    The libraries that need to be included on top of my head are:
    SDL, SDL_ttf, SDL_image, SDL_net, sdl_audio, OpenGL, and possibly freeGlut.

    [1] Having this much trouble with the first two libraries is discouraging.
    ...
    If you post the precise steps you followed and the trouble you're having, someone may be able to point you in the right direction. I recommend you create and build a small demo program after you install each library. Take SDL_ttf for example. A demo program for that should be able to render some text from a .ttf file. Usually there are demo programs with the libraries, but they are usually too complicated for this purpose. Make the minumum possible example that uses a library that demonstrates the value it contributes to your project (e.g. Render "Hello, world!" on the screen using foo.ttf with a 30 point font).
    Last edited by c99tutorial; 12-22-2016 at 03:16 PM.

  4. #4
    Registered User
    Join Date
    Dec 2016
    Posts
    20
    Quote Originally Posted by c99tutorial View Post
    If you post the precise steps you followed and the trouble you're having, someone may be able to point you in the right direction. I recommend you create and build a small demo program after you install each library. Take SDL_ttf for example. A demo program for that should be able to render some text from a .ttf file. Usually there are demo programs with the libraries, but they are usually too complicated for this purpose. Make the minumum possible example that uses a library that demonstrates the value it contributes to your project (e.g. Render "Hello, world!" on the screen using foo.ttf with a 30 point font).
    I finally managed to install codeblocks and all the SDL libraries properly on Ubuntu, which allowed me to create the standard SDL application. However when I tried to enter a command outside of libSDL, say IMG_Load(""), it didn't recognize the command.

    I'm not sure what file needs to be moved into the project folder, is it the SDL_ttf.dll or something of the sort? I'm also having a bit of trouble finding it in ubuntu, I'm thinking it should be inside /usr/bin/...

  5. #5
    Registered User
    Join Date
    Jun 2011
    Posts
    4,509
    Try moving the dll to the project folder. Have you tried using, say, the find command to locate this file?

    Also be sure you are setting up your project to link to the appropriate libraries. This was discussed here a while ago.

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by freddie View Post
    It doesn't work to just use a text editor, e.g., Windows Notepad, or whatever, because, even if you invoke the build system (whatever it may be, e.g., GCC, MSVC, etc) from the command line, any error messages or warnings will specify a line number. And if the line number is much greater than 25 or something like that, you are for sure going to wear yourself to a frazzle counting lines, and likely you'll wear your cursor up/down key out.
    All modern text editors (including all the major ones on Linux/Unix) have a feature to go to a particular line number. Most GUI text editors also have the option to show line numbers in the left margin.

    Quote Originally Posted by freddie View Post
    I try to turn off every garbage option I can find such as intellisense, pop up code helpers, all that trash. At least its trash to me. I'm sure many others love it and that's fine. They can have it.
    And most of us gladly accept it. Those features are about productivity, and they definitely improve that aspect of development. Even Vim has the ability to use code completion tools. If you are a professional developer, and you don't use productivity enhancers like Intellisense or its equivalents, you are literally wasting your time, and your employer's money.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  7. #7
    Registered User
    Join Date
    Dec 2016
    Posts
    20
    Quote Originally Posted by Matticus View Post
    Try moving the dll to the project folder. Have you tried using, say, the find command to locate this file?

    Also be sure you are setting up your project to link to the appropriate libraries. This was discussed here a while ago.
    None of the libraries came with the dll files for some reason (looking at the terminal). Which is weird as i thought installing the libraries would also get me the dll files?

  8. #8
    Registered User
    Join Date
    Jun 2011
    Posts
    4,509
    Did you download it from here? It should be included with the other files. Try searching for "SDL2_tff.dll" if you got the latest version (SDL2).

  9. #9
    Registered User
    Join Date
    Dec 2016
    Posts
    20
    I downloaded them through Synaptic Package Manager searching libSDL:

    some of the packages i downloaded:

    libsdl-gfx1.2.-5
    libsdl-gfx1.2-dev
    libsdl-image1.2-dev
    libsdl-mixer1.2
    libsdl-mixer1.2-dev
    libsdl-net1.2
    libsdl-net1.2-dev
    libsdl-ttf2.0-0
    libsdl-ttf2.0-dev
    libsdl1.2-dev
    libsdl1.2debian
    libsdl2-2.0-0
    libsdl2-dev
    libsdl2-net-2.0-0
    libsdl2.net-dbg
    libsdl2-net-dev

    Im thinking i forgot to configure them, but not sure how to do it exactly.
    Last edited by Tiago Redaelli; 12-23-2016 at 09:47 AM.

  10. #10
    Registered User
    Join Date
    Sep 2014
    Posts
    364
    You have mixed up 2 versions of libSDL.

    This files are from libSDL version 1.2:
    Code:
    libsdl-gfx1.2.-5
    libsdl-gfx1.2-dev
    libsdl-image1.2-dev
    libsdl-mixer1.2
    libsdl-mixer1.2-dev
    libsdl-net1.2
    libsdl-net1.2-dev
    libsdl-ttf2.0-0
    libsdl-ttf2.0-dev
    libsdl1.2-dev
    libsdl1.2debian
    This files are from libSDL version 2.0:
    Code:
    libsdl2-2.0-0
    libsdl2-dev
    libsdl2-net-2.0-0
    libsdl2.net-dbg
    libsdl2-net-dev
    I recommend that you should use version 2 of libSDL for new projects.
    To use it, include the right files:
    Code:
    #include <SDL2/SDL.h>
    On FrontPage - SDL Wiki' you can find more information and the API for libSDL2.
    Other have classes, we are class

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Setting an environment variable using setenv()
    By kill'emall in forum Linux Programming
    Replies: 4
    Last Post: 10-12-2014, 03:22 AM
  2. Some advice in setting my Linux dev environment
    By Mario F. in forum General Discussions
    Replies: 19
    Last Post: 08-28-2010, 07:20 AM
  3. Setting path environment variable
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 09-01-2006, 03:03 PM
  4. Setting environment variables.
    By Ezzetabi in forum C++ Programming
    Replies: 10
    Last Post: 07-26-2005, 08:30 AM
  5. Setting OS Environment Variables
    By ImNotMad in forum C Programming
    Replies: 4
    Last Post: 10-23-2003, 02:07 AM

Tags for this Thread