header files

how and where do i add graphic header file in dev c++

Page 1 of 1

2 Replies - 4964 Views - Last Post: 16 November 2010 - 09:34 AM Rate Topic: -----

#1 nayebare   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 16-November 10

header files

Posted 16 November 2010 - 04:48 AM

please help am trying to build a snake game am anovice in programming but the foundations require that include graphics .h file in dev c++ software ,the problem is that i dont know from which site i can get it from and how to add it to dev c ++ software

This post has been edited by nayebare: 16 November 2010 - 04:51 AM

Is This A Good Question/Topic? 0
  • +

Replies To: header files

#2 Linkowiezi   User is offline

  • D.I.C Regular

Reputation: 58
  • View blog
  • Posts: 316
  • Joined: 07-October 08

Re: header files

Posted 16 November 2010 - 07:56 AM

Hi and welcome to D.I.C.

First off, you need to be much more specific.

What kind of application are you going to use?
Will it be a console application for windows only or do you want it to be cross platform and also will you be using 2D or maybe even 3D graphics with fancy shaders and effect for your snake game?

Since you state that you are a novice, I'm going to assume you want to make a really fancy snake game.
That will probably not work I'm afraid...

You should start off with a simple console application of tic tac toe.
For this you don't really need any "graphics.h" header file...
Although you can absolutley make one for handling the graphics of your text based console application.
Then after you have made the *.h file, you probably want to have a *.cpp file with the same name (except for the file extension).
Then depending on your Development Environment, you might have to manyally add the *.cpp file in your makefile
If you're using Bloodsheds Dev C++, it will automatically add if for you as long as you have it in your project.
Maybe you can just drag and drop it, I don't remember... it was ages since I used that program.

After you've managed to get your tic tac toe going:
Go on with using SFML or a similar library to deal with graphics and make a 2D version of your tic tac toe game.
You can use SFML to easily get a cross platform graphical environment up and running.
Draw some simple shapes, get keyboard and mouse events and such, then integrate OpenGL with it for more 3D support.
If you choose to go on with SFML read more into the subject here http://www.sfml-dev.org/

Hope this was of any use to you.
Was This Post Helpful? 0
  • +
  • -

#3 NickDMax   User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2255
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: header files

Posted 16 November 2010 - 09:34 AM

With a few exceptions the .h file alone will not help you. A header file just declares elements (functions, variables etc.) that should exist within the object code available to the linker. The object code my be in object files from the current project or in library files. So if you want to use a file, "graphics.h" you will also need the source files or the library containing the object code for those functions.

Since you want to use "graphics.h" I *assume* that you mean the old Borland's BGI graphics.h -- This library is very old and was made for the 16bit computers of the 1970's and 1980's. The last program I wrote using graphics.h was in the early 1990's. So we are talking about technology that is roughly 20 years old designed specifically for the Borland compilers.

So what can you do on a modern compiler?

Well there is winBGIm which should work. It is a win32 version of BGI (with mouse). It was built for MinGW which is the compiler that Dev-C++ (an IDE) uses.

another antiquated library available to you would be GrWin.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1