A simple DirectDraw sample

This is a very simple DirectDraw sample.

Setting up DirectX under Visual C/C++
I most likely won’t be doing DirectX development under Watcom or Borland C/C++ or Delphi or VisualBasic etc; so if you want such info included here, you’ll have to send it to me.

Firstly, the directories must be set up so that Visual C/C++ […]

Palettes, Gaming concepts, double buffering

Screen modes come in several flavours, based on how many bits are used to store the color of each pixel on the screen. Naturally, the more bits you use per pixel, the more colours you can display at once; but there is more data to move into graphics memory to update the screen.

1,2,4 and 8 […]

Direct X and its Components

“One of the main purposes of DirectX is to provide a standard way of accessing many different proprietary hardware devices”

DirectX is comprised of application programming interfaces (APIs) that are grouped into two classes:

The DirectX Foundation layer
The DirectX Media layer

These APIs enable programs to directly access many of your computer”s hardware devices.
The DirectX Foundation layer
Foundation […]

Exception Handling in C#

An exception usually signals an error. Thought it doesn’t always indicate an eror, it can also signal some particularly unusual even in your program that deserves special attention.
Exception & Errors Handling
No mater how good our program is, it always have to be able to handle possible errors. Most applications today contain some form of error […]

What’s new in C++?

As we begin the study of C++ and object oriented programming, a few commentsare in order to help you get started. Since the field of object oriented programming is probably new to you, you will find that there is a significant amount of new terminology for you to grasp. This is true of any new endeavor and you should
be warned not to be intimidated by all of the new concepts.

We will add a few new topics in each tutorial and you will slowly grasp the entire language.
Comments in C++
Examine the file named CONCOM.CPP for an example of several new things in C++. We will take the CONCOM.CPP new constructs one at a time beginning with the comments.
//CONCOM.CPP
#include /* This is the stream definition file */
void print_it(const int data_value);
main()
{
const int START = 3; // The value of START cannot be changed
const int STOP = 9; // The value of STOP cannot be changed
volatile int CENTER = 6; /* The value of CENTER may be changed
by something external to this
program. */
int index; /* A normal C variable */
for (index = START ; index < STOP ; index++)
print_it(index);
} /* End of program */

void print_it(const int data_value)
{
cout << “The value of the index is ” << data_value << “\n”;
}

// Result of execution
//
// The value of the index is 3
// The value of the index is 4
// The value of the index is 5
// The value of the index is 6
// The value of the index is 7
// The value of the index is 8
A comment begins with the double slash “//”, starts anywhere on a line, and runs to the end of that line where it is automatically terminated. The old method of comment definition used with ANSI- C can also be used with C++ as illustrated in lines 11 through 14, among other places in this program. The new method is the preferred method of comment definition because it is impossible to inadvertently comment out several lines of code. This can be done by forgetting to include the end of comment notation when using the older C method of comment notation. Good programming practice would be to use the new method for all comments and reserve the old method for use in commenting out a section of code during debugging since the two methods can be nested.

It would be well to caution you at this point however, that you should not use comments when the same sense of program definition can be obtained by using meaningful names for variables, constants, and functions. The careful selection of variable and function names can make nearly any code self documenting and you should strive to achieve this in your code.

Working with Namespaces in C#

Every application begins with a namespace in C# .NET that has the same name as the project. Of course, you can change the namespace to anything you like in order to maintain compatibility with other projects.

For example we declared namespace Mycplus.CSharpBasics while taking an Overview of C#. We can write the whole application with in […]

Statements in C#

The real nuts and bolts of a programming languages is that which controls the flow of a program called statements.
Types of Statements in C#
C# borrows most of its statements directly from C and C++, though there are some noteworthy additions and modifications.

Expression & Control statements
Labeled & goto statements

Control statements allow to branch the code depending […]

Polymorphism

Class inheritance is not just about reusing the classes at many locations, it also adds enormous flexibility to the way in which one can program his application.

The object-oriented programming approach focuses on objects as the basis for application building. Objects are instances of classes, which contain a description of related data and procedures. The Visual […]