Sign in to follow this  

Quick Question

This topic is 4760 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Do you uses C++ to write a program and then things like DirectX and Win32 to make them user friendly and beautiful or are DirectX and Win32 languages just like C++? A stupid question I know but I just gotta know

Share this post


Link to post
Share on other sites
DirectX, OpenGL and other API's are basically layers of code that are pre-created to help the developer grasp programming easier and to allow them to use many of the abilities of each API.

// NOTE: the above was put into the easiest terms I could think of!

For instance, the DirectX API, using D3D, allows you to easily create a cube in 3D. Using the API and the programming language you are using (ie. c++), you can manipulate the cube in many ways, without having to go through near as many lines of code.

Share this post


Link to post
Share on other sites
C++ is a language (like C, C#, Visual Basic, ruby, smalltalk, ...)

you use a langauge to write a program - it is the fundamental means through which you tell a computer what to do ...

DirectX and Win32 are APIs (Application Programming Interfaces) - (basically libraries of functionality) for example DirectX contains the subsections DirectDraw, DirectInput, DirectSound, Direct3D, DirectPlay, etc ... each of these defines some structures and functions that provide some advanced multimedia, networking, or interface functionality (DirectDraw for example provides functions for defining Video Buffers, Flipping them, Drawing (blitting) onto them, etc) (DirectInput provides functions for asking the operating system what controllers the system has (keyboard, mouse, joystick1, joystick2, etc - and functions to initiaze them, read state from them, get input, send force feedback, etc ...)

These 2 APIs that you mention are both installed into Microsoft Windows, and different programs access them by linking to them, or dynamically loading them at runtime ... so when a game starts, it loads the DirectX libraries it uses, and then calls functions in it. The same thing with the Win32 API, when you write a program that uses some aspect of the Win32 API, thouse functions reside in dll files in Windows, which your program links to / loads as needed, and then calls the functions it wants ... examples of Windows API functions are RegisterWindowEx(), TranslateMessage(), PostMessage(), etc ...

Most APIs are written in a particularly language and therefore are obviously made available through the normal means to anyone using that language - but they are also made available to people using other language by adhering to standard linking / binary formating rules, or by providing wrapper libraries for other languages to use. The most common means for an API to be published so that any langauge to use it is to use either C or Pascal calling conventions in the binary, which nearly all languages no how to call. Another option is to use COM which defines an exact registration and binary layout, so that any language may be made to support the COM spec, and then be able to use any COM object. ActiveX and DirectX both use the COM system to expose their interfaces ... (so people can use ActiveX and DirectX classes in VB, C, C++, Delphi, C#, etc).

Share this post


Link to post
Share on other sites

This topic is 4760 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this