Every time I debug my project it fails to appear. An error message pops up and states a "debug error" occurred and gives me the option to either abort or Retry. When I choose to Retry another message pops up telling me "MYPROJECT has triggered a breakpoint". I don't know what this means.
Here are other output errors:
'Ultimate Pong.exe': Loaded 'C:\Documents and Settings\Family\My Documents\Visual Studio 2010\Projects\Ultimate Pong\Debug\Ultimate Pong.exe', Symbols loaded. 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\Allegro\bin\allegro-5.0.5-monolith-md-debug.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.2600.5512_x-ww_dfb54e0c\GdiPlus.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\psapi.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\glu32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\comdlg32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\msvcr100d.dll', Symbols loaded. 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\shimeng.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Unloaded 'C:\WINDOWS\system32\shimeng.dll' 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\d3d9.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\d3d8thk.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\version.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\d3dref9.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\msctf.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\apphelp.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\msctfime.ime', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\mslbui.dll', Cannot find or open the PDB file 'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', Cannot find or open the PDB file The thread 'Win32 Thread' (0xa90) has exited with code 3 (0x3). The program '[3052] Ultimate Pong.exe: Native' has exited with code 3 (0x3).
Here is my source code:
I need help understanding what the problem is.
You need to install the keyboard before you use it.
I placed the al_install_keyboard after the display. The primitives appear (thanks), but the program is not accepting any input. Any ideas.
#include <allegro5\allegro.h>
#include <allegro5\allegro_primitives.h>
int main()
{
int player1_x = 50;
int player1_y = 400;
int player2_x = 850;
int player2_y = 400;
int ball_x = 454;
int ball_y = 350;
int ball_rad = 10;
bool done = false;
//Initializes the allegro program
al_init();
al_set_new_display_flags(ALLEGRO_WINDOWED);
al_set_new_display_refresh_rate(60); // The refresh rate for display
//Makes the display window the width and height
ALLEGRO_DISPLAY *display = al_create_display( 900,800);
// Places "Ultimate Pong" on the window
al_set_window_title(display,"Ultimate Pong");
// Initializes keyboard device for user input
al_install_keyboard();
// Creating the event queue
event_queue = al_create_event_queue();
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
// Registers so it can be place keyboard input on the queue
al_register_event_source(event_queue, al_get_keyboard_event_source());
// Initializes primitives
al_init_primitives_addon();
while(!done)
{
ALLEGRO_EVENT ev;
al_wait_for_event(event_queue, &ev);
if(ev.type == ALLEGRO_KEY_DOWN)
{
switch(ev.keyboard.keycode)
{
case ALLEGRO_KEY_LEFT:
player1_y -= 20;
break;
case ALLEGRO_KEY_RIGHT:
player1_y += 20;
}
}
else if(ev.type == ALLEGRO_KEY_UP)
{
if(ev.keyboard.keycode == ALLEGRO_KEY_ESCAPE)
done = true;
}
// Paddle number 1
al_draw_filled_rectangle(player1_x , player1_y, player1_x + 10, player1_y - 100, al_map_rgb(99,99,100));
// Paddle number 2
al_draw_filled_rectangle(player2_x, player2_y, player2_x + 10, player2_y,al_map_rgb(99,99,100));
// Ball
al_draw_filled_circle(ball_x, ball_y, ball_rad,al_map_rgb(250,0,0));
// Helps what has been drawn visible on screen. Switches from blank screen to the actually image
al_flip_display(); /
al_clear_to_color(al_map_rgb(0,0,0));
}
al_destroy_event_queue(event_queue);
al_destroy_display(display); // Destroys the display
return 0;
}
Use tags to format your code when posting. Click the formatting help button for the syntax.
ev.type needs to be ALLEGRO_EVENT_KEY_DOWN.
You are using ALLEGRO_KEY_DOWN which is just a constant that represents a keycode for the "down" key.