January 21, 2021, 04:47:03 AM

Author Topic: Question about C programming  (Read 655 times)

Online Matty

  • Hero Member
  • *****
  • Posts: 1339
    • MattiesGames
Question about C programming
« on: April 15, 2020, 06:27:34 PM »
Good Morning.

I have started doing a little C programming.

I wrote a few simple programs the other day and thought to myself I'd like as part of teaching myself some gamey type coding things to do the following as an exercise:


1. Load and display two images from file, png and jpg.
2. Cause the program to react to a mouse click on either of them.
3. Render text to the screen using an arbitrary ttf font.

My question is for the exercise, should I do it using:

Gdi

Directx

Opengl

?

What would you choose?

I eat cheese in the trees when its eight degrees

Offline bsisko

  • Full Member
  • ***
  • Posts: 109
Re: Question about C programming
« Reply #1 on: April 16, 2020, 06:27:42 AM »
To answer your question, most games use DriectX, while most 3D games use a version of OpenGL, so I would use one of those two graphic libraries for your exeercise.

Now a question for you.  Which  C compiler are you using?  Embarcadero C++ Builder,  Visual Studio 2019 or some other?
Prepare to be assimilated !  Resistance is futile!

Online Matty

  • Hero Member
  • *****
  • Posts: 1339
    • MattiesGames
Re: Question about C programming
« Reply #2 on: April 16, 2020, 07:41:37 AM »
Currently mingw
I eat cheese in the trees when its eight degrees

Offline dawlane

  • Full Member
  • ***
  • Posts: 189
Re: Question about C programming
« Reply #3 on: April 16, 2020, 08:40:36 AM »
GDI/GDI+ are used mostly for every day applications such as Paint programs etc.

DirectX is the the main set of graphic and sound API's for game development on Windows.

OpenGL is strictly a cross platform graphics API. You would have to use other API's for input and sound. Example: OpenAL for sound.

And for MinGW. Make sure that you have the headers for the DirectX version you are going to use.
The best tool to use is Visual Studio or Visual Studio command line tools with an IDE that can use them.

Online Matty

  • Hero Member
  • *****
  • Posts: 1339
    • MattiesGames
Re: Question about C programming
« Reply #4 on: April 17, 2020, 10:54:32 AM »
Thanks, that is good information
I eat cheese in the trees when its eight degrees

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 2057
Re: Question about C programming
« Reply #5 on: April 17, 2020, 11:48:38 AM »
if you are sticking to windows then c++ gives maybe a better way into things (most demos, etc are c++) and visual studio just can't be beaten as a dev environment :)

Offline Aurel

  • Full Member
  • ***
  • Posts: 206
    • AurelSoft
Re: Question about C programming
« Reply #6 on: April 17, 2020, 02:46:36 PM »
C++ is maybe better but is much more cpomplex than C ,i also forced myself to learn more C, lurking for some simple and good GDI programs ,which are fine for simple 2D programs,i am using MingW with Falcon IDE

guest7581

  • Guest
Re: Question about C programming
« Reply #7 on: April 17, 2020, 06:48:15 PM »
Raylib. It's the easiest way to start with C and graphics.

Offline Pakz

  • Full Member
  • ***
  • Posts: 195
    • My homepage
Re: Question about C programming
« Reply #8 on: April 18, 2020, 04:35:39 AM »
Raylib!(2d/3d opengl) Just download and install the package with the Notepad++ editor and you can compile and run straight away(F6) Note that the MinGw version has a false positive at the moment and you need to disable the vp to install it. There is the same download with another compiler though.

Check: my 2 weeks of coding results so far :

https://github.com/Pakz001/Raylib-Examples


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal