Hey guys! Im having problems with a snippit of code ive written. I know this is basic C++ so its a little embarasing that i cant work it out myself. Ive googled the run time error message but im not 100% sure i understand what it means. Unhandeled exeption, access violation #ifndef SETTINGS_H #define SETTINGS_H #include<string> #include<vector> #include<iostream> using namespace std; class Settings { private: vector<string>board; protected: public: Settings(); bool loadAndDrawFont(); }; #endif #include "Settings.h" #include<allegro5\allegro.h> #include<allegro5\allegro_native_dialog.h> #include<allegro5\allegro_ttf.h> #include<allegro5\allegro_font.h> #include<iostream> Settings::Settings() { board.push_back("050106007"); board.push_back("620054090"); board.push_back("000908002"); board.push_back("300000568"); board.push_back("080605020"); board.push_back("546000009"); board.push_back("700502000"); board.push_back("030840016"); board.push_back("800301040"); } bool Settings::loadAndDrawFont() { //int blockSize = 36; ALLEGRO_FONT …

Member Avatar
Member Avatar
+0 forum 6

Hiya! Im not new to programming but sometimes i can be really noobie so im sure this is probably really silly. I have an undecleared indentifier that only shows up in the main but is fine in the header and cpp files. I thought it might be an include loop but it doesnt seem to be. It can find the draw function but not its parameter. What have i forgotten? Creature.h #ifndef CREATURE_H #define CREATURE_H #include <allegro5/allegro.h> #include <allegro5/allegro_image.h> #include <string> using std::string; class Creatures { private: int xPos; int yPos;; ALLEGRO_BITMAP* sprite; public: Creatures(int x, int y, string s); …

Member Avatar
Member Avatar
+0 forum 6

I originally asked this question at cplusplus.com but got no responses. In my program I have the main player and enemy tanks. When using the shotgun weapon it works fine for the main player but it kills the bad guy when they use the weapon. I don't understand how this is happening. I'll show (what I believe to be) the relevant code snippet, the cplusplus.com link and also attached is the code in its entirety. unsigned long* collisionhandler::checkpellethit(int good, int *n) { int z=0; unsigned long *dead = new unsigned long[weapons.size()]; int q = weapons.size(); for (int i=0;i<q;i++) { //printf("in …

Member Avatar
+0 forum 0

So, I'm using allegro game programming library. Before I move on to bigger and better things I wnat to get a handle on pointers. Specifically with things like structs, linked lists and maybe binary trees in the future. I posted a program that uses a linked list to keep tracks of a variable number of objects on the screen. GDB tells me it fails in the main also, the new style of posting is kinda buggy, for example I can move the cursor past the program code. gdb: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: …

Member Avatar
Member Avatar
+0 forum 3

Background, I want to install allegro on the iMac 10.6.8 after my macbook crapped out. It didn't compilers installed whatsoever, so I had to find Xcode at a seedy 3rd party site because apple no longer supports Xcode for 10.6. It came as a binary, simple install didn't give me any install options so I assume it installed fine. Oh yeah I installed GCC for reasons I don't remember, for the most part it looks like it installed correctly because gcc,g++ and gfortran are all on there. Funny thing is gcc and g++ have binaries in /usr/bin I have no …

Member Avatar
Member Avatar
+0 forum 1

Hello do you know whats wrong with this code? #include <stdio.h> #include <allegro5\allegro5.h> #include <allegro5\allegro_primitives.h> #include <allegro5\allegro_image.h> int main() { al_init(); FILE* pFile; return 0; } If I compile it, it fails and output is: main.c 1>c:\users\beda\documents\visual studio 2010\projects\c allegro\c allegro\main.c(9): error C2143: syntax error : missing ';' before 'type' But if I run it as C++ code (source code is called main.cpp) it runs without problems. And I am using VC++ 2010. Thanks for help.

Member Avatar
Member Avatar
+0 forum 1

Hi, I am trying to figure out allegro, and so far, so good. But I ran into this one snag in this code [CODE]const float FPS = 60;[/CODE] Does this set FPS? Someone on another forum said no, but it seems like that it is a predefined function that changes the Frames per second. When I mess around with it, that is what it does. Second thing: [CODE]timer = al_create_timer(1.0 / FPS);[/CODE] Does this set the timer based upon the fps? And then does that timer limit how long a certain action can be done for? [CODE]#include <stdio.h> #include <allegro5/allegro.h> …

Member Avatar
+0 forum 0

Hi, I am trying to figure out allegro, and so far, so good. But I ran into this one snag in this code: [CODE]const float FPS = 60;[/CODE]Does this set FPS? Someone on another forum said no, but it seems like that it is a predefined function that changes the Frames per second. When I mess around with it, that is what it does. Second thing: [CODE]timer = al_create_timer(1.0 / FPS);[/CODE] Does this set the timer based upon the fps? And then does that timer limit how long a certain action can be done for? [CODE]#include <stdio.h> #include <allegro5/allegro.h> const …

Member Avatar
+0 forum 0

Hello, I am trying to use the allegro game library (5.05) and I came across an error. It involved not being able to find -lgcc_eh so I switched it to static-lgcc_eh and it worked fine, that is until I got an error for not finding allegro-5.0.5-mt.dll . I looked in the .dll directory for it, and it was there. Tried it again. Still no avail. So I tried installing the DirectX files on their website (merging the two folders). Still does not work. I have tried looking all over the web for the topic, but Google was not playing nice …

Member Avatar
Member Avatar
+0 forum 1

I tried this once before on my laptop 10.5.8 but I couldn't get that to work despite online help: [url]http://forums.macrumors.com/showthread.php?t=1233494[/url] everything I tried is detailed in that thread I decided I want to try this again, using the same method perhaps on the iMac 10.6.8 I was just wondering if anyone here had experience or if you can give me any tips on what to look for.

Member Avatar
+0 forum 0

Running: Windows 7 Home Premium. I am not sure if I am posting this in the correct board, so please move this if I am incorrect in my post placement. I am trying to set Allegro up, for programming a 2D game in C (which is why I chose this board to post in). Allegro seemed like a good fit, because it supports MIDI and the syntax seems relatively simple. In a build tutorial for MinGW/Allegro ([url]http://wiki.allegro.cc/index.php?title=Build/MinGW[/url]), I installed/built everything up to libvorbis. libogg compiled and installed just fine using MSYS. However, when trying to ./configure libvorbis, I am met …

Member Avatar
Member Avatar
+0 forum 1

Hi! I'm running the latest OpenSuse 11.4. I have knowledge of C++ programming and I think I'm ready to start using graphics. I have downloaded [URL="http://sourceforge.net/projects/alleg/files/allegro/5.0.4/allegro-5.0.4.tar.gz/download"]allegro-5.0.4.tar.gz[/URL], extracted it and tried to include allegro.h file in my C++ code. Here is my testing file for allegro. [CODE]#include <iostream> #include "/Documents/Allegro/include/allegro5/allegro.h" int main(){ cout << "Allegro Y U NO WORK?" << endl; } [/CODE] I get the following error: [CODE]In file included from testin.cpp:2:0: Allegro/include/allegro5/allegro.h:26:27: fatal error: allegro5/base.h: No such file or directory compilation terminated. [/CODE] If you have any advice or a tutorial, please inform me of them.

Member Avatar
Member Avatar
+0 forum 1

When I was surfing on an internet I have found four c++ multimedia libraries, which can create games and GUI aplications (SDL, ClanLib, SFML, Allegro). I would like to learn one of them, but i don't have any experience with it. Can you recommend me one of them? I have read a lot of forums and chats about this problematic, but I still can't decide. The SDL bothers me (at least I think I've seen it somewhere) because it doesn't have a hardware-accelerated 2D graphics in Linux. Allegro is primarily designed for 2D graphics. And I don't know much about …

Member Avatar
+0 forum 0

first off i have a game in the making, its pretty simple but im just getting the feel of making the game before i get into depth with it. I'm wondering how i can run my game without needing to open up visual c++ 2010 and running it from there... like basically a exe that will run it for me... the next few things are that im wondering if anyone is willing to help me make the game. so someone like working on graphics while i program etc. heres the game that im planning on putting into graphics eventually: [url]http://www.youtube.com/watch?v=eM0s5bO0klk[/url] …

Member Avatar
Member Avatar
+0 forum 1

Hello all Currently i am developing my first game using Allegro 4.2.3 in C++. but i have got few problems/confusions 1.i want to use different font from that available by default. I have read there wiki and articles but i could not figure out any simple way. Specifically i would want a simple file from which i can load_font() and a way to generate this file. 2.allegro 5 is WIP and it is different from 4, and there is no doc available for Allegro 5 in download able format, even the online doc is not complete. Seeing all this should …

Member Avatar
+0 forum 0

Hello I am developing my first game in Allegro. Till now i found it easy to use. But now i read that for running a game allegro.dll is required on computer. Tell me if it is correct. Also many people say that SFML is better than Allegro, since the latter is old. Which one should i use, considering that i am comfortable with Allegro, but want it to be playable on other computers. Thanks Vinayak

Member Avatar
Member Avatar
+0 forum 2

i have a major error whenever i run my code... im using visual studio c++ 2010 express. here's the code: [CODE]# include <allegro.h> # include <iostream> # include <cmath> #define down 0 #define left 32 #define right 64 #define up 96 int main(){ allegro_init(); install_keyboard(); install_mouse(); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0); BITMAP* walking = load_bitmap("sprite1.bmp", NULL); BITMAP* buffer = create_bitmap(640, 480); int x = 0; int y = 0; bool done = false; while (done != true){ if (key[KEY_UP] && y != 0){ y = y--; } else if (key[KEY_DOWN] && y != 470){ y = y++; } if (key[KEY_LEFT] …

Member Avatar
Member Avatar
+0 forum 3

Talk about C++ & Allegro here, any problems and ideas are welcome!

Member Avatar
Member Avatar
+0 forum 2

Hi, I want to draw some rectangles with the same size and different colors by using an array but don´t know exactly how to do it in the for-loop. Thanks for help! [CODE]class Figure { private: int **figur; int row,col; public: Figure() : row(5), col(20){ } void allocate_place(int r, int c) { this->figur = new int *[r]; for (int i=0; i < r; i++) this->figur [i] = new int [c]; this->row = r; this->col = c; } void drawing_figure(BITMAP *buffer) { for (int i=0; i < this->row; i++) { for (int j=0; j < this->col; j++) { //rectfill(buffer, fig1x, fig1y, …

Member Avatar
+0 forum 0

Hi, I want to draw some rectangles with the same size and different colors by using an array but don´t know exactly how to do it in the for-loop. [CODE]class Figure { private: int **figur; int row,col; public: Figure() : row(5), col(20){ } void allocate_place(int r, int c) { this->figur = new int *[r]; for (int i=0; i < r; i++) this->figur [i] = new int [c]; this->row = r; this->col = c; } void drawing_figure(BITMAP *buffer) { for (int i=0; i < this->row; i++) { for (int j=0; j < this->col; j++) { //rectfill(buffer, fig1x, fig1y, fig1x+30, fig1y+30, makecol(0, …

Member Avatar
+0 forum 0

Hi all, So, I'm a real newbie at this, and I don't even know where to start really. I'd appreciate some help. I've downloaded Allegro 4.9 onto my computer (running Windows Vista), and I want to use it with Code::Blocks IDE. I've tried many a google search, but none of the tutorials seem to work properly. I've heard that you need to compile the library before you can link it, but I don't know how to do this either. (I've never before needed to download a library past the standard ones...) If someone could point me in the right direction, …

Member Avatar
Member Avatar
+0 forum 2

So, as a project for funzies, I decided to make a basic game where you run around the screen and get into fights when you encounter skeletons. However, I'm nowhere near the fighting parts yet. So far, the main character only appears when he moves (no idle animation), erases rocks he passes over, and can escape the grid he's on. Here is the code for his motion. The commented out section makes pictures of the character standing pop up in places of the screen faaaar away from his location. [code] void movePlayer() { tempX = x; tempY = y; /* …

Member Avatar
Member Avatar
+0 forum 1

I'm working on an animated sprite program. It animates an asteroid sprite and bounces the asteroid around the screen. When I compile, I am having trouble with 4 particular lines. I am getting the same three errors for each of the 4 lines. These are the errors (obviously for line 30): [B]30 expected `)' before ';' token 30 expected primary-expression before ')' token 30 expected `;' before ')' token[/B] The following are the 4 lines that are giving the problem: [B]rectfill(dest, spr->x, spr->y, spr->x + spr->width, spr->y + spr->height, BLACK); textout_ex(screen, font, "SpriteGrabber Program (ESC to quit)", 0, 0, WHITE, …

Member Avatar
Member Avatar
+0 forum 3

The End.