Devc++ Breakpoints Not Working

You can use the Dev-c debugger to help you find errors in your program. In debug mode, After that, do a full rebuild (Ctrl-F11), then set breakpoint(s) where you want the debugger to stop (otherwise it will just run the program). To set a breakpoint on a line, just click on. Debug is not showing up on the console. I have configured logging console. My older switches, if an interface goes down or is brought up, it shows up on the console, but not on the new 4507s. Any help would greatly be appreciated. WS-C4507R-E cat4500e-ipbase-mz.122-53.SG2.bin TG-4507#sh logging. Ah hah, that means you got the Insight setup and working properly but somehow the Dev-C does not include debugging info in your compiled exe. What version of Dev-C you got, did you go to Tools -Check for updates/packages and after you connect to the devpark.org listing, check to see in the Installed package if you have the latest ones.

  1. Devc++ Breakpoints Not Working Remotely
  2. Devc++ Breakpoints Not Working Capital
  3. Devc++ Breakpoints Not Working Principle
  4. Devc++ Breakpoints Not Working Skills
  5. Dev-c++ Breakpoints Not Working
-->

This article helps you resolve a problem where the debugger doesn't stop on breakpoints when you debug ASP.NET applications in Microsoft Visual Studio .NET.

Original product version: Visual Studio, ASP.NET
Original KB number: 306169

Symptoms

When you debug ASP.NET applications in Visual Studio .NET, the debugger might not stop on breakpoints.

Cause

This problem occurs because ASP.NET debugging isn't enabled on the application.

Resolution

To resolve this problem, follow these steps in Visual Studio .NET:

  1. In Solution Explorer, select the project name.
  2. From the Project menu, click Properties.
  3. Click to expand the Configuration Properties node.
  4. Under Debugging, in the Enable ASP.NET Debugging list, click True.

Table of Contents

    • Q3DMath (currently not used anymore by the tutorials)
Back to Index

C++, SDL and QuickCG

An SDL 1.2 codebase is given with this tutorial, called QuickCG. All the C++ code in the articles uses QuickCG and its functions to draw graphics on the screen.

This page will explain how to use QuickCG to get the examples working. Information is provided to get SDL and QuickCG working in the DevC++ IDE, as well as how to do ith with g++.

Then a few examples of scripts for QuickCG follow.

And finally, tables are given with all the QuickCG functions, some C++ functions and operators, QuickCG and SDL datatypes, and all the SDL names for keyboard keys.

QuickCG can be downloaded here:

  • quickcg.cpp
  • quickcg.h
  • main.cpp
  • quickcg.dev (optional DevC++ project file)

SDL is an API that can handle graphics, audio, keyboard, mouse and joystick input on many platforms, including Windows and Linux. SDL can also be used to initialize and use OpenGL for 3D graphics. The codebase of this tutorial uses SDL for its graphics and input, but the rest of the focus of this tutorial is on the graphics algorithms, and not SDL. In this tutorial SDL's functions are rarely used directly (but through QuickCG instead), though it's always handy to learn a thing or two about SDL if you'd like to make some games with it.

QuickCG was designed specifically for this tutorial, to be as easy to use and as universal as possible and to feel a bit like a scripting language. QuickCG includes functions to set up the screen, draw pixels and 2D primitives on it, handle input, do color model conversions, print texts and numbers on the screen using a built in font, load pictures, etc... QuickCG is less useful for making actual games because it's not really optimized.
A full list of all functions it contains is further on this page.

DevC++

This section is for if you want to use DevC++ in Windows to run the examples. Please note that DevC++ is very old now, at the time this tutorial was written it was popular but as of 2016 it is very outdated. Feel free to use a more modern tool such as Code::Blocks, Visual Studio, or if you have it: a POSIX terminal with g++ or clang++ (see next section) and your favorite text editor. The steps in this section can still be helpful in other IDE's, so read on.

DevC++ is a free IDE for Windows, that uses the compiler gcc 3.2 or later. For help on using DevC++, I suggest you check out the help files, try to open and compile some of the included examples, check out the bloodshed.net website, or just read on here. DevC++ can be downloaded from http://www.bloodshed.net/.

This chapter is only for Windows users who want to be able to compile QuickCG and the examples with the free DevC++ IDE. It's also perfectly possible to use SDL and QuickCG on other platforms, but for now that's not explained here. If you don't know how, use the SDL site or google to find out how to install it with your compiler, and then make a new project in your compiler and add the .cpp and .h files of QuickCG to it.

If you don't have the newest version of DevC++ installed yet, follow these steps to get it up and running with SDL. If you have it installed, but not yet the SDL developer libraries, start at step 2).

It's not very easy to install SDL 1.2 for DevC++, but it is possible to get the newest version of SDL 1.2 to work with DevC++, if you follow these steps very carefully:
1) download and install the latest version of DevCpp from http://www.bloodshed.net/dev/devcpp.html
2) download SDL 1.2 from http://www.libsdl.org/: download the Development Libraries for Mingw32 (under Windows) and the runtime libraries for Windows. You may need WinRAR to be able to unpack the .tar.gz files. Note: This tutorial was written during the time of SDL 1.2, and will not work with the latest SDL 2.0 and higher.
3) The runtime library contains the file SDL.DLL, put it either in your C:WindowsSystem32 folder, or put one in the folder of your compiled program, and don't forget that you always have to include SDL.DLL with your program if you want other people who don't have the file to run it. Programs compiled for the newest version of SDL won't work with older versions of the DLL.
4) Unpack the SDL developer files, but not yet inside the DevC++ folder, put them in another folder.
5) Copy the SDL folder of the development files, which is inside the folder include, into the include folder of DevC++ (so that all the SDL header files are in DevC++ under include/SDL)
6) Copy the files in the lib folder of the development files, into the lib folder of DevC++.

Now you have installed DevC++ with SDL 1.2! You still need to know how to make a working project that uses SDL though. The other files in the development package include the full SDL documentation, example and tests, and the binaries. Your DevC++ folder structure should now look like this, where the SDL folder is new, and the lib folder contains new files from the SDL development package.

If you use the SDL 1.2 codebase (QuickCG) provided with the tutorial, unzip it to your code folder (that folder where you store all your DevC++ projects and code in, which is hopefully not in the unreliable My Documents folder of Windows), and just open its *.dev file with Dev-C++, and it should compile and run correctly. To compile it, use 'Execute -> Compile' from the menu. The exe file will appear in the same folder as where your code is located. You can run it with 'Execute -> Run'. You can also compile&run your projects by pressing F9. If it doesn't work, look a bit further for a list of possible solutions. It's highly recommended that you use QuickCG for this tutorial, because the rest of the tutorial focuses on the commands of it and not on the actual SDL itself.

But if you want to make a new SDL project of your own in DevC++ (not needed for this tutorial):

7) Start up DevC++ and make a new project. Add any .cpp and .h files you need to it.
8) In the menu Project open Project Options and locate the setting for Linker Commands (in DevC++ 5 Beta 8.10 it's under Parameters) and add:
-lmingw32
-mwindows
-lSDLmain
-lSDL
Note that the order IS important! If you put -lSDL first and then -lSDLmain it won't work!
9) In your cpp files, #include <SDL/SDL.h>
10) Under Linker options, turn off the console.
11) Under Compiler in Project Options, and under the general Compiler Options, turn on all settings for optimizations, because they really make a big difference! You can also add -s to the linker parameters to reduce the size of the *.exe files it generates, if you don't do this, the exe's will be full of debugging information, even if the debugging setting is off (as of DevC++ 5 Beta 8.10)
If you're getting compiler errors when trying to compile your SDL project, here are some things to check:

  • Did you follow steps 1-6 or 1-11 correctly, in the correct order? Read every detail?
  • Did you #include the SDL.h header file in the code?
  • Is the SDL.h file in the correct folder of DevC++? (if it's in the SDL folder inside include, you have to include it with #include 'SDL/SDL.h', if it's directly in the include folder, use #include 'SDL.h')
  • Are all the other SDL header files in the correct folder of DevC++?
  • Are the SDL library files (libSDL.a and libSDLmain.a) correctly in the lib folder of DevC++?
  • Did you put -lSDLmain and -lSDL in the correct order in the Linker parameters?
  • Are the options -lmingw32 -mwindows -lSDLmain -lSDL correctly in the linker parameters, and not wrongly in the compiler parameters?
  • Did you make a main function?
  • Try if the FAQ on the http://bloodshed.netorhttp://www.libsdl.org site answer your problem. There's info about DevC++ in the faq from libsdl.org. These sites also have search functions.
  • Try searching for some keywords from the compiler or linker error with google. You might find forum posts which describe your problem.
  • If you have a different version of DevC++ than version 5 Beta 8.10, things might be different (I encourage using the newest version, there may be more recent information available than this tutorial). Try to find the correct way to tell the linker to add the files libSDLmain.a and libSDL.a, and give the linker the options -lmingw32 and -mwindows, and the correct folders for include and library files.
  • If you're trying to get your own project to work, try if QuickCG that you can download with this tutorial works correctly (open its *.dev file, compile and run it). If it does, but your own project doesn't, try giving your project the same settings as the project from QuickCG.
Once you got it to work, you can run example code of the tutorials by opening the quickcg.dev file with DevC++ and going to main.cpp file where you can enter the code. Here's a screenshot of the main.cpp file after opening it.Devc++ breakpoints not working remotely

g++

This section is for if you want to use g++ to run the examples.

With g++ it's quite easy: place all .cpp and .h files of QuickCG in the same directory, put the example code of tutorials in the main.cpp file, and then you can compile it with the following command:

g++ *.cpp -lSDL -O3

The -O3 is optional if you want compiler optimization. The -lSDL lets it link to SDL. This requires you to have SDL installed on your distro (look for sdl and sdl-devel packages or similar).

Using QuickCG

QuickCG currently exists out of the following code files and a .dev file:
  • QuickCG.cpp: this contains all the functions of QuickCG
  • QuickCG.h: #include this header file in all *.cpp files where you want to use QuickCG's functions
  • Q3DMath.cpp: contains 3D functions (currently not used anymore in the tutorial)
  • Q3DMath.h: #include this if you want to use the 3D functions and classes (currently not used anymore in the tutorial)
  • main.cpp: in this file you can type the code of the examples of this tutorial. Leave the #includes at the top of the file intact to be able to run all examples.
  • QuickCG.dev: this is the project file for DevC++ that contains all necessary settings, if you don't use DevC++ you can remove this file and make your own project that uses the .cpp and .h files.
The main.cpp file file is where you can put the code of the examples of this tutorial. If no main function is mentioned in a code example, make one yourself and put the example inside the main function.
There's normally a small example included in the main.cpp file:

Here's what it does:
  • The screen function will create the graphical window, with a resolution of 256*256 pixels, windowed, and with the caption 'Small Test Script'. You always have to use the screen function at the start of any program, or you'd be drawing pixels on a non existing window.
  • Next comes a double for loop, which goes through every pixel of the window: w and h are global variables that contain the width and the height of the window.
  • Inside the for loops is the function pset. This function will plot a pixel at location x, y with RGB color x, y, 128. This means the red color component will depend on the location x of the pixel, the green color component will vary with the location y of the pixel, and blue component will always be 128.
  • After the loop comes the function redraw. You always have to use this function before you'll be able to see any new pixels you've drawn. The redraw function is relatively slow, so do NOT call it after every single pixel, but only once after all pixels of the screen have been drawn.
  • Finally, the sleep function will let the program pause until you press any key. If the sleep function wouldn't be there, the program would close immediately and you wouldn't be able to see the result.
If you compile and run this code, the output will be as follows:
Now try to change the program a bit, for example, copypaste this instead into the main function (use CTRL+SHIFT+i to indent it in DevC++5):

What has changed, is that you'll now see a green sine function pattern, and a text 'Hello World!', because putting text on the screen is what the print function does. The output should look as follows:
Now another, easier, example:

The drawDisk command will draw a filled circle at the given position, with a certain radius and RGB color. The disk function is called 3 times: to draw a face, and two eyes.
The drawDine command will draw a line.
The redraw() and sleep() commands are again needed so that the new pixels will show up, and so that the program won't close immediately.
The output should look like this:
A full list of all commands is below, and the next chapter is full of easy examples of all functions to learn working with QuickCG.

Devc++ Breakpoints Not Working Remotely


Full Function List

This list contains all functions, global variables, etc... from QuickCG. If functions have default parameters, these are given as well.

QuickCG Global Variables

Global variables are normally not recommended for big programming projects, but the examples of this tutorial are small and it's easier to have them here.
VariableInformation
wint w;
The width of the graphical window, after you used the screen function. In the examples of this tutorial, w is most often used in double for loops that go through every pixel on screen.
hint h;
The height of the graphical window, after you used the screen function
fontboolfont[256][8][8];
This is the font used for the print function. Even though you canaccess and change the font variable from within the code, it'snever needed to do so.

QuickCG Data Types

ColorRGBA simple struct containing 3 integers named r, g and b, with constructors:
ColorRGB(Uint8 r, Uint8 g, Uint8 b);
ColorRGB(ColorRGB8bit color);
ColorRGB();
There are also some predefined RGB colors:
static const ColorRGB RGB_Black ( 0, 0, 0);
static const ColorRGB RGB_Red (255, 0, 0);
static const ColorRGB RGB_Green ( 0, 255, 0);
static const ColorRGB RGB_Blue ( 0, 0, 255);
static const ColorRGB RGB_Cyan ( 0, 255, 255);
static const ColorRGB RGB_Magenta (255, 0, 255);
static const ColorRGB RGB_Yellow (255, 255, 0);
static const ColorRGB RGB_White (255, 255, 255);
static const ColorRGB RGB_Gray (128, 128, 128);
static const ColorRGB RGB_Grey (192, 192, 192);
static const ColorRGB RGB_Maroon (128, 0, 0);
static const ColorRGB RGB_Darkgreen( 0, 128, 0);
static const ColorRGB RGB_Navy ( 0, 0, 128);
static const ColorRGB RGB_Teal ( 0, 128, 128);
static const ColorRGB RGB_Purple (128, 0, 128);
static const ColorRGB RGB_Olive (128, 128, 0);
The ColorRGB class has also got the operators '+','-', '*', '/', ' and'!=' defined so that you can add them, multiply withintegers, ... to do color arithmetic more easily.
ColorRGB8bitA simple struct containing 3Uint8's named r, g and b, with constructors:
ColorRGB8bit(Uint8 r, Uint8 g, Uint8 b);
ColorRGB8bit(ColorRGB color);
ColorRGB8bit();
ColorHSLA simple struct containing 3integers named h, s and l, with constructors:
ColorHSL(Uint8 h, Uint8 s, Uint8 l);
ColorHSL();
ColorHSVA simple struct containing 3integers named h, s and v, with constructors:
ColorHSV(Uint8 h, Uint8 s, Uint8 v);
ColorHSV();

Normally, colors used in QuickCG are supposed to have 8 bit components: they're values from 0 to 255. They were however made integer instead of Uint8 so that you can store intermediate results of calculations in the structs without the values wrapping around. So you can write expressions like 'ColorRGB color3 = (color * opacity + color2 * (256 - opacity)) / 256;' and get the result you'd expect.
The ColorRGB8bit type was then added because SDL requires Uint8variables for color components, and is used only internally by afew QuickCG functions with lots of SDL code.

Basic SDL Data Types

Devc++ Breakpoints Not Working Capital

Devc++ Breakpoints Not Working

Devc++ Breakpoints Not Working Principle

Uint8Unsigned 8-bit integer, these are used in the tutorial for color components
Sint8Signed 8-bit integer
Uint16Unsigned 16-bit integer
Sint16Signed 16-bit integer
Uint32Unsigned 32-bit integer
Sint32Signed 32-bit integer
Uint64Unsigned 64-bit integer
Sint64Signed 64-bit integer

The 64-bit type isn't supported on all platforms.

QuickCG Functions

FunctionInformation
screenvoid screen(int width, int height, bool fullscreen, char* text=' ');
This is probably the most important function, because it createsthe graphical screen but also the whole SDL context. Always call this function at the beginning ofyour programs, even if you don't need a screen. The integers width and height determinate theresolution of your window. If fullscreen is 0, it'll be a window,if it's 1, the graphics will be drawn fullscreen. text can be usedto give a title to the window. For example to create a window of640*480 pixels with the title 'Hello', use:screen(640,480,0,'Hello');
keyDownbool keyDown(int key);
After using the readKeys() or done() function for the current frame, this function can checkfor every key whether or not it's pressed. For example, to check if the 'a' button is pressed, check if keyDown(SDLK_a)is true. For a full list of all the keys, see the SDL Key table below.
keyPressedbool keyPressed(int key);
The same as keyDown(), but while keyDown will return true as long as the key is pressed, keyPressed will onlyreturn true the first time you check, and return true again only if the key has been released and pressed again. So whilekeyDown would be useful in a game for a key to walk forward, keyPressed can be used for a key that selects a weapon.
redrawvoid redraw();
This redraws the screen. If you draw things like pixels, circlesand lines, you won't see them before you called redraw(); Thisfunction is relatively slow though, so don't use it after everysingle pixel, but only after you've drawn the whole screen.
clsvoid cls(int R = 0, int G = 0, int B = 0);
This clears the screen to black again. For example if you're makinga bouncing ball program you have to draw a circle at a new positionevery time, but if you didn't use cls(), the old circles at oldpositions will still be visible. You can also clear the screen to acertain RGB color.
psetvoid pset(int x, int y, ColorRGB color);
This function draws a pixel on the screen at position x, y (x hasto be between 0 and w-1, y has to be between 0 and h-1), with givenRGB color: ColorRGB color has 3 components r, g, b which are valuesbetween 0 and 255
pgetColorRGB pget(int x, int y);
Returns the color value of the pixel at position x, y. Thisrequires reading the color from the memory of the video card, andis quite slow. When you need this function a lot, for example ifyou're working with transparency or flood fill, it's better to usea buffer to hold the colors, read from this buffer, and draw thisbuffer to the screen with drawBuffer.
drawBuffervoid drawBuffer(Uint32 *buffer);
Draws a whole buffer at once to the screen. The buffer has to beexactly the same size as the screen, and is a 2D array. Colorvalues are in 24-bit format in one integer instead of 3 separate8-bit variables. If it's possible to use a buffer, it can be muchfaster than drawing each pixel separately.
onScreenbool onScreen(int x, int y);
Checks if the point with coordinates x, y is on the screen: insidethe rectangle (0, 0) - ((w - 1), (h - 1)).
sleepvoid sleep();
When calling this function, the program will pause until you pressany key.
waitFramevoid waitFrame(double oldTime, double frameDuration);
This is made to be handy in cases where you want to limit an effect to a maximum amount of frames per second. The parameter oldTime is the time of the previous frame after calling waitFrame that frame, and frameDuration is the number of seconds per frame (e.g. 0.05 seconds per frame is 20 frames per second). It waits until the minimum time since the previous frame is passed.
donebool done();
This function returns whether or not you want to close the program,that is, if you press escape, or press the close button of thewindow. Use this function in a while loop as follows:'while(!done()) {code goes here}'. Then the loop will keeprunning, until you press escape or the close button of thewindow.
endvoid end();
Calling this function immediately ends the program.
readKeysvoid readKeys();
This function uses SDL Events to check what keys are pressed, andgives the result to the global inkeys[] variable.
getMouseStatevoid getMouseState(int& mouseX, int& mouseY, bool& LMB, bool& RMB);
Stores the position and pressedbuttons of the mouse in the given variables (passed by reference)mouseX: the x coordinate of the mouse cursor, mouseY: the ycoordinate of the mouse cursor, LMB: true if the left mouse buttonis pressed, RMB: true if the right mouse button ispressed.
getMouseStatevoid getMouseState(int& mouseX, int& mouseY);
Stores the position of the mouse in the given variables (passed by reference) mouseX: the x coordinate of the mouse cursor, mouseY: the y coordinate of the mouse cursor.
getTickslong getTicks();
This function returns the time since the program started running in milliseconds.
maxmax(x, y)
Returns the maximum of x and y, works with anything: it's definedwith preprocessor commands.
minmin(x, y)
Returns the minimum of x and y, works with anything: it's definedwith preprocessor commands.
horLinebool horLine(int y, int x1, int x2, ColorRGB color);
Draw a horizontal line from position x1, y to x2, y with givencolor. It's a bit faster than using drawLine() if you need ahorizontal line.
verLinebool verLine(int x, int y1, int y2, ColorRGB color);
Draw a vertical line from position x1, y to x2, y with given color.It's a bit faster than using drawLine() if you need a verticalline.
drawLinebool drawLine(int x1, int y1, int x2, int y2, ColorRGB color);
Draw a line from x1, y1 to x2, y2 with given color, using theBresenham line drawing algorithm. Note that all coordinates mustlie inside the screen, or the program will crash. You can useclipLine() in combination with drawLine() if you need to draw anarbitrary line, because the line function itself can't draw linesoutside the screen and will return 0 it any of the endpoints liesoutside the screen.
drawCirclebool drawCircle(int xc, int yc, int radius, ColorRGB color);
Draw a circle with its center at xc,yc, with radius radius, andRGB color red, green, blue. This is an unfilled circle.
drawDiskbool drawCisk(int xc, int yc, int radius, ColorRGB color);
Like circle, but this time it's filled.
drawRectbool drawRect(int x1, int y1, int x2, int y2, ColorRGB color);
Draw a rectangle with corners in x1,y1 and x2, y2, with givencolor.
clipLinebool clipLine(int x1, int y1, int x2, int y2, int & x3, int & y3, int & x4, int &y4);
Use this if you need to bring the endpoints of a line you're tryingto draw into the screen. Give the function a line with coordinatesx1,y1-x2,y2, and it'll return a line with coordinates x3,y3-x4,y4that are on the edges or inside the screen (that is, inside therectangle 0,w-0,h). x3,y3,x4 and y4 have to be given to thefunction by reference, so for example use 'clipLine(x1, y1, x2,y2, x3, y3, x4, y4)', where x3, y3, x4 and y4 are normalintegers that can be changed by the function, to give thecoordinates of the new line to those variables. The functionreturns 1 if the line is on the screen and 0 if the line isn't onthe screen.
RGBtoHSLColorHSL RGBtoHSL(ColorRGB colorRGB);
Converts a color from the RGB to the HSL color model.
HSLtoRGBColorRGB HSLtoRGB(ColorHSL colorHSL);
Converts a color from the HSL to the RGB color model.
RGBtoHSVColorHSV RGBtoHSV(ColorRGB colorRGB);
Converts a color from the RGB to the HSV color model.
HSVtoRGBColorRGB HSVtoRGB(ColorHSV colorHSV);
Converts a color from the HSV to the RGB color model.
RGBtoINTUint32 RGBtoINT(ColorRGB colorRGB);
Converts a color from RGB to a single integer for the video hardware memory structure
INTtoRGBColorRGB INTtoRGB(Uint32 colorINT);
Converts a color from a single integer to 3 bytes: r, g, and b from the ColorRGB struct.
loadImageint loadImage(std::vector& out, unsigned long& w, unsigned long& h, const std::string& filename)
loads a PNG image (no other image formats supported) with given filename into the std::vector. Also returns the width and height of the image. If there happens a problem during loading, the function returns '1' which means 'error'.
loadImageint loadImage(std::vector& out, unsigned long& w, unsigned long& h, const std::string& filename)
The same as the other loadImage function, but stores the color in Uint32's instead, which is the format for SDL.
printtemplate<typename T> int print(const T& val, int x = 0, int y = 0, const ColorRGB& color = RGB_White, bool bg = 0, const ColorRGB& color2 = RGB_Black);
Draws a text on screen, using the standard IBM ASCII font, made out of 256 characters of 8*8 pixels each.
'*text' is the text you want to output, 'x' and 'y' the location (in pixels) of the top left corner of the first letter, 'color' the foreground color, 'color2' the background, and bg whether or not the background should be visible: if bg is 0, the background is invisible, if gb is 1, it's fully opaque. The parameter forceLength is the minimum length that should be printed, if the string is shorter, it prints 0 characters behind it (useful if background is enabled and want to draw over a certain fixed length). The return value is h * x + y where x is x position of next letter, y is y position of next letter and h is height of the screen. This return value is useful to find the start location for a possible next print command that should be behind the previous text: x coordinate is then returnvalue / h, y coordinate is returnvalue % h.
getInputStringvoid getInputString(std::string& text, const std::string& message = ', bool clear = false, int x = 0, int y = 0, const ColorRGB& color = RGB_White, bool bg = 0, const ColorRGB& color2 = RGB_Black);
Prints the message, after the message you can enter a string, which is stored in text. The boolean 'clear' determines if the text is still visible after the user pressed enter.
getInputtemplate<typename T> T getInput(const std::string& message = ', bool clear = false, int x = 0, int y = 0, const ColorRGB& color = RGB_White, bool bg = 0, const ColorRGB& color2 = RGB_Black);
Convert user input into arbitrary variables.

C++ Operators

OperatorInformation
+, -, *, /Add, Subtract, Multiply and Divide. Some of these are also defined for QuickCG's matrices and vectors
%Modulo Division
&Bitwise AND
|Bitwise OR
^Bitwise XOR
=Set equal to
Operators for conditions
&&, ||Logical AND and OR (to use in conditions)
Is it equal?
!=Not equal to
>,<, >=, <=Greater than, Smaller than, Greater than or equal to, Smaller than or equal to

C++ Functions

Some of those come from the standard header file <cmath>, sothey're in the namespace std. The line 'using namespace std;' isput on top of the code though, so you don't need to to add 'std::'in front of the functions. This tutorial focuses on the algorithmsand the math and it's easier to recognise mathematical functions ifthere's no 'std::' in front of them.
FunctionInformation
sqrt(x)The square root of x
cos(x), sin(x), tan(x)Cosine, Sine and Tangent (in radians)
acos(x), asin(x), atan(x)The inverse of Cosine, Sine and Tangent
pow(x, y)The power of one real number to another
ln(x)Natural Logarithm
exp(x)The exponential of a real number
int(x), float(x), double(x)Convert to integer or to floating point number. When dividing two integers through each other, the result will be an integer unless you convert one to a float.
floor(x)Returns the next lowest integer, e.g. 3.1 becomes 3.0. Only works on floating point numbers and doubles.
ceil(x)Returns the next highest integer, e.g. 3.1 becomes 4.0. Only works on floating point numbers and doubles.
abs(x), fabs(x)Returns the absolute value of x. The function abs is for integers, while fabs is for floating point numbers and doubles.

C++ Arrays and Pointers

If you're not experienced with C++ these pointers might be useful:
Address of a variable
  • Create the variable with int variableName
  • Get its address with &variableName
Creating a pointer to a variable
  • Create the variable with int variableName
  • Create the pointer with int* pointerName
  • Set the pointer to the address of the variable with pointerName = variableName
  • You can now set variableName to 100 by using the pointerwith *pointerName = 100
Creating an 80 * 90 *100 3D arrayfloat arrayName[80][90][100];
Accessing element 10, 20, 30 from a 80 * 90 * 100 3D arrayarrayName[10][20][30] or arrayName[90 * 100 * 10 + 100 * 20 + 30]
Passing a variable 'by address', so the function can change it
  • Create the function as void functionName(int* pointerName)
  • Call the function with functionName(&pointerName)
  • Use the variable in the function with &pointerName
Passing a variable 'by reference', so the function can change it
  • Create the function as void functionName(int& variableName)
  • Call the function with functionName(variableName)
  • Use the variable in the function simply with variableName
Passing a variable by 'const reference', so the function can read it without making a copy (which can be inefficient if you're passing a large data structure)
  • Create the function as void functionName(const int& variableName)
  • Call the function with functionName(variableName)
  • Use the variable in the function simply with variableName
Passing a 1D array to a function, so the function can read and change it
  • Create the function as void functionName(int* arrayName)
  • Call the function with functionName(arrayName)
  • Use the array in the function with arrayName[index]
Passing a 3D array to a function
  • Create the function as void functionName(int* arrayName)
  • Call the function with functionname(arrayName[0][0])
  • Use the array in the function with arrayName[index]
  • So even though it's a 3D array, you use two [][]'s to give it to the function, and can use only 1 [] inside the function.
  • Inside the function, treat the array as a 1D array. Access its elements by using the way given in the second option of the third row of this table.
std::vectors For arrays with dynamic size, std::vectors<Type>, part of the C++ standard, are much more useful. Include the header <vector> to be able to use them. They have functions to resize, get the size, clear, push variables on top, and members can be accessed with [] just like with C-style arrays. Since they're a large datastructure, pass them by (const) reference to functions.

SDL Key List (copied from the SDL Reference)

SDLKeyASCII valueCommon name
SDLK_BACKSPACE'b'backspace
SDLK_TAB't'tab
SDLK_CLEAR
clear
SDLK_RETURN'r'return
SDLK_PAUSE
pause
SDLK_ESCAPE'^['escape
SDLK_SPACE' 'space
SDLK_EXCLAIM'!'exclaim
SDLK_QUOTEDBL''quotedbl
SDLK_HASH'#'hash
SDLK_DOLLAR'$'dollar
SDLK_AMPERSAND'&'ampersand
SDLK_QUOTE''quote
SDLK_LEFTPAREN'('left parenthesis
SDLK_RIGHTPAREN')'right parenthesis
SDLK_ASTERISK'*'asterisk
SDLK_PLUS'+'plus sign
SDLK_COMMA','comma
SDLK_MINUS'-'minus sign
SDLK_PERIOD'.'period
SDLK_SLASH'/'forward slash
SDLK_0'0'0
SDLK_1'1'1
SDLK_2'2'2
SDLK_3'3'3
SDLK_4'4'4
SDLK_5'5'5
SDLK_6'6'6
SDLK_7'7'7
SDLK_8'8'8
SDLK_9'9'9
SDLK_COLON':'colon
SDLK_SEMICOLON';'semicolon
SDLK_LESS'<'less-than sign
SDLK_EQUALS'='equals sign
SDLK_GREATER'>'greater-than sign
SDLK_QUESTION'?'question mark
SDLK_AT'@'at
SDLK_LEFTBRACKET'['left bracket
SDLK_BACKSLASH'backslash
SDLK_RIGHTBRACKET']'right bracket
SDLK_CARET'^'caret
SDLK_UNDERSCORE'_'underscore
SDLK_BACKQUOTE'`'grave
SDLK_a'a'a
SDLK_b'b'b
SDLK_c'c'c
SDLK_d'd'd
SDLK_e'e'e
SDLK_f'f'f
SDLK_g'g'g
SDLK_h'h'h
SDLK_i'i'i
SDLK_j'j'j
SDLK_k'k'k
SDLK_l'l'l
SDLK_m'm'm
SDLK_n'n'n
SDLK_o'o'o
SDLK_p'p'p
SDLK_q'q'q
SDLK_r'r'r
SDLK_s's's
SDLK_t't't
SDLK_u'u'u
SDLK_v'v'v
SDLK_w'w'w
SDLK_x'x'x
SDLK_y'y'y
SDLK_z'z'z
SDLK_DELETE'^?'delete
SDLK_KP0
keypad 0
SDLK_KP1
keypad 1
SDLK_KP2
keypad 2
SDLK_KP3
keypad 3
SDLK_KP4
keypad 4
SDLK_KP5
keypad 5
SDLK_KP6
keypad 6
SDLK_KP7
keypad 7
SDLK_KP8
keypad 8
SDLK_KP9
keypad 9
SDLK_KP_PERIOD'.'keypad period
SDLK_KP_DIVIDE'/'keypad divide
SDLK_KP_MULTIPLY'*'keypad multiply
SDLK_KP_MINUS'-'keypad minus
SDLK_KP_PLUS'+'keypad plus
SDLK_KP_ENTER'r'keypad enter
SDLK_KP_EQUALS'='keypad equals
SDLK_UP
up arrow
SDLK_DOWN
down arrow
SDLK_RIGHT
right arrow
SDLK_LEFT
left arrow
SDLK_INSERT
insert
SDLK_HOME
home
SDLK_END
end
SDLK_PAGEUP
page up
SDLK_PAGEDOWN
page down
SDLK_F1
F1
SDLK_F2
F2
SDLK_F3
F3
SDLK_F4
F4
SDLK_F5
F5
SDLK_F6
F6
SDLK_F7
F7
SDLK_F8
F8
SDLK_F9
F9
SDLK_F10
F10
SDLK_F11
F11
SDLK_F12
F12
SDLK_F13
F13
SDLK_F14
F14
SDLK_F15
F15
SDLK_NUMLOCK
numlock
SDLK_CAPSLOCK
capslock
SDLK_SCROLLOCK
scrollock
SDLK_RSHIFT
right shift
SDLK_LSHIFT
left shift
SDLK_RCTRL
right ctrl
SDLK_LCTRL
left ctrl
SDLK_RALT
right alt
SDLK_LALT
left alt
SDLK_RMETA
right meta
SDLK_LMETA
left meta
SDLK_LSUPER
left windows key
SDLK_RSUPER
right windows key
SDLK_MODE
mode shift
SDLK_HELP
help
SDLK_PRINT
print-screen
SDLK_SYSREQ
SysRq
SDLK_BREAK
break
SDLK_MENU
menu
SDLK_POWER
power
SDLK_EURO
euro

SDL ModifierMeaning
KMOD_NONENo modifiers applicable
KMOD_NUMNumlock is down
KMOD_CAPSCapslock is down
KMOD_LCTRLLeft Control is down
KMOD_RCTRLRight Control is down
KMOD_RSHIFTRight Shift is down
KMOD_LSHIFTLeft Shift is down
KMOD_RALTRight Alt is down
KMOD_LALTLeft Alt is down
KMOD_CTRLA Control key is down
KMOD_SHIFTA Shift key is down
KMOD_ALTAn Alt key is down

Devc++ Breakpoints Not Working Skills

Last edited: 21 August 2007

Dev-c++ Breakpoints Not Working


Copyright (c) 2004-2007 by Lode Vandevenne. All rights reserved.