The Simple DirectMedia Layer (SDL) library allows for manageable multimedia programming in console mode. Now you can mix graphics, animated or otherwise, with sound and make your game project more interesting. I am showing an example for Dev-C++ using math generated graphics, purloined from the NET, and give some instructions where to get SDL and how to install it properly.

Member Avatar
+2 forum 0

A program that plays a MIDI file and stops it, and than starts a different MIDI file. The same concept applies to .wav files mciSendString("play the_file",NULL,0,NULL); starts playing it, and as expected mciSendString("stop the_file",NULL,0,NULL); stops playing it.

Member Avatar
Member Avatar
+0 forum 5

The WinBGI package allows you to do some of the Borland BGI graphics in a specially created window form. So don't throw out the old Borland manuals, you can still use them to do some fancy graphing! Yes, you can gotoxy() again! This code was modified for Dev-C++, a real workhorse come to think of it. Thanks free_eagle for getting this started!

Member Avatar
+1 forum 0

An example how to line up your decimal points in a column like output of floating point numbers. Both C and C++ versions are shown. Thanks are given to Bud Tugly, my 77 year old senior student.

Member Avatar
Member Avatar
+2 forum 1
Code Snippet clear screen

A simple demostration of how to clear the console screen in at least Dev-C++ 4.9.8.0 (I don't know about the other since I've only tried it on this one, but may and probably works,, with few if at all minor adjustments), what more can I say, other than it's not the best way to do it but may be useful.

Member Avatar
Member Avatar
+0 forum 12
Code Snippet Setcolor

Setcolor was entirely programmed by Mahen of Mauritius. Who have never wished of changing the Font colors of the Command Prompt on the fly. Well this is where Setcolor comes in handy. The main function of this program is to change the default Font color of your Command Prompt. The colors start from 0 up to 9999. The following gives an example of the program's usage: C:WINDOWS>setcolor 12 C:WINDOWS>setcolor -help Usage: Setcolor -Help Displays this Message -Default Returns the Font back to normal "number" Changes the color of the Font according to number NOTICE: You must not claim this program …

Member Avatar
Member Avatar
+0 forum 2

This code gets the local time from your computer, formats the date and the time and displays the result. Does not include the bavarian time measurement of how many steins you have finished since you got up in the morning.

Member Avatar
+2 forum 0
Code Snippet Change Counter

Yep. I have no life. Here's the simplest and stupidest form of C++ coding ever known to man kind...the change counter. What does it do? Count change :-)

Member Avatar
+0 forum 0

Nothing new, but something for the neophyte to ponder. Some of the functions (algorithms) used by STL containers can be applied to a normal array to do inane things like copying, displaying, finding max/min, reversing, replacing, searching, shuffling, sorting, summation. This can really simplify your code.

Member Avatar
Member Avatar
+3 forum 2

With the help of BCX I managed to create some C++ code that will allow you to send text to your printer and specify the font and other things. Play around with the options to suit your own needs. I have to admire the genius behind BCX, even though it spits out more code than you want! NOTICE: Please experiment with this code, modify it, improve it, and claim it as yours!!!!

Member Avatar
Member Avatar
+1 forum 1

Short little sound files of chicken, horses, dogs, cars, trains and other annoying things is the realm of the wave file (.wav). These are easy to play and guaranteed to confuse grandpapa. Again, we are using Windows' sound workhorse winmm.lib file. Ze function this time is PlaySound(). Here is ze C++ console code.

Member Avatar
Member Avatar
+1 forum 3

Many of you know how I like to use sound to make the old computer box more interesting. The midi file packs a lot of neat instrumental music. It is very simple to play, even in a console application, using the winmm.lib file that comes with just about any Windows based compiler. Here is the code. Turn up the speakers and blast the dust off the rafters!

Member Avatar
Member Avatar
+0 forum 6

You can have fun and learn something too. Not too much fun though! Here we take a lighthearted look at C++ string, various ways to assign a string and substring, spell forward and reverse, find characters and substrings, append, insert, replace, remove characters, separate a sentence into words and more.

Member Avatar
+2 forum 0

Log files are useful things. They are used in programs to display the values or variables or other useful information such as what the program is doing. This is useful is the program crashes at some point or is not behaving as it should. By writing values and events to a log you can check back and see what happened! Most logs are text files, which take a while to search though and arent very easy to debug. HTML files however support different colours for different events (ie green text if it worked, red if its an error....) and images …

Member Avatar
Member Avatar
+0 forum 9

An introduction to the Win32 GUI. The code creates a simple window that you can play with. Many parameters can be changed if you like! The unusual thing about windows apps is that rather than directly handling inputs (ie the position of the mouse / what control has focus ect...) you process window messages. Whenever something happens, it sends a message to the window making a message queue. DispatchMessage() calls WindowProcedure (which if you look is assigned to be the default message handler for the class name ("WindowsApp") of which the window belongs. The good thing is that as all …

Member Avatar
Member Avatar
+0 forum 6

A singly (sp) and a Doubly Linked list class to create linked lists. Can be used to make dynamic arrays and could also be templated to work with any data type (this is old code and i didnt know how to at the time). Has been extremely useful to me even in its bare form like this.

Member Avatar
Member Avatar
+0 forum 2

The Standard Template Library (STL) vector is tempting. The burden of dimensioning an array is removed, and there are many wonderful functions to explore. The learning curve is a little steep, it will make your head swell, but in the end it's all worthwhile. Take a look at some of the code that is supposed to make programming easier.

Member Avatar
Member Avatar
+1 forum 4

Let's say you worked in the White House and had to keep two lists, one for the friends and one for the enemies. The boss came to you and said: "The Almighty talked to me out of a burning bush last night, telling me that I shall make my enemies my friends! Can you help me?"

Member Avatar
+2 forum 0

Another experiment with the Standard Template Library (STL). This time we are taking a look at map. Map is a Sorted Pair Associative Container (a mouthful). The pair is -- const Key, Data --, where Key has to be unique. It is Key that is sorted. In this code sample a simple word association is shown. The map is loaded, displayed, and searched.

Member Avatar
+1 forum 0

Using the C++ Standard Template Libraries (STL) can be easy, once you know how to do it. No need to putz around with doubly linked lists anymore! Here is code showing how a STL list allows you to add, insert, remove, sort, splice, merge, display, and clean-out-duplicate strings.

Member Avatar
+2 forum 0

This snippet shows how to draw a red circle on a Windows form. Original code via BCX, modified to compile with Dev C++. The GUI code looks a little complex. Gets simpler, once you get past the required overhead. For those who need some hand holding with the Dev C++ IDE: In the IDE go to FILE, then NEW, then Project, select Windows Application, give it a name (eg. Circle1) click OK. A filesave dialog box comes up, create a new folder and save Circle1.dev there. The DevCpp IDE comes up with a template, select and delete that and cut …

Member Avatar
+0 forum 0
Code Snippet FileExists

returns TRUE or FALSE depending on whether or not a file exists

Member Avatar
Member Avatar
+0 forum 5
Code Snippet AnimateDialog

this is a wrapper around the AnimateWindow API. this allows random animations in a dialog. I just call it in the dialog's OnInitDialog() handler. The 'fade' effect has not been implemented because I didn't like the idea of having to call RedrawWindow or something like that because sometimes the borders aren't drawn right for controls when you use that flag.

Member Avatar
Member Avatar
+0 forum 1
Code Snippet GetFolder

Returns the name of a folder in a CString after allowing user to browse for it. This is just a wrapper around the SHBrowseForFolder API, but it's great for only allowing a user to browse for folders!

Member Avatar
+0 forum 0

This programme can find the dimensions of cuboid and cylinder. In cuboids it can find missing dimensions also. Eg. if length is missing and volume is given it will find the length.

Member Avatar
+0 forum 0
Code Snippet Caluculator

calculator using macros in C++

Member Avatar
Member Avatar
+0 forum 2
Code Snippet Quiz Your self!!!

Have a look at this programme. it is my semister project

Member Avatar
Member Avatar
+0 forum 3

Well I thought u might be bored with the hangman stuff i posted a few days ago so here is a new gaming programme. well in this one all u have to do is try to guess the number correctly while running the programme. suggestions are welcome. this is not a very complicated programme all can understand this as well have fun with it. ENJOY!!!

Member Avatar
Member Avatar
+0 forum 1
Code Snippet Anonymous Objects

hi all .. this is intorduction to an anonymous classes, An anonymous class is one that doesn't have a name. In the following example, both structures inside the TRectangle union are anonymous classes: Here is an example of running the program: You want to identify your rectangle by its location or its dimensions? 1 - Location 2 - Dimension Enter your choice: 1 Enter the location of the rectangle on a Cartesian coordinate system First point X coordinate: -4 Y coordinate: 2 Second point X coordinate: 5 Y coordinate: 1 The rectangle spans from A(-4, 2) to B(5, 1). Press …

Member Avatar
Member Avatar
+0 forum 1

I don't know if this function may be helpful to anyone, but I just converted from a VB function recently to C++. I'm converting a text file string that is nine characters to a decimal value that has funny characters in it because it is exported from an old VAX. this function takes that string and returns it as a CString with either positive or negative value that you can then convert to an integer:

Member Avatar
+0 forum 0

The End.