Search found 15 matches

by Norbo
Sat Sep 11, 2010 1:57 pm
Forum: Programming Discussion
Topic: No image displayed.
Replies: 3
Views: 563

No image displayed.

I cant see anything on the screen when i draw an image to it. The image is properly loaded and blitted, but it does not show on the screen. Im trying to blit a bitmap called title to buffer, and then buffer to screen. This is written in c++ and allegro. Can anybody help? My code: #include <allegro.h...
by Norbo
Thu Mar 26, 2009 2:15 am
Forum: Programming Discussion
Topic: Needed help with spliting up code
Replies: 22
Views: 1593

Re: Needed help with spliting up code

problem solved.
i had to rebuild by priject because dev c++ was going crazy
im moving on to c::b
by Norbo
Wed Mar 25, 2009 1:45 am
Forum: Programming Discussion
Topic: Needed help with spliting up code
Replies: 22
Views: 1593

Re: Needed help with spliting up code

I tried a little test to see if i have my globals somewere in my code i didint include globals.h in any of my files, and i didint have multiple definition probloms instead, i had the compiler complaining about the globals undeclared. when i included globals.h back again, i have multiple definition p...
by Norbo
Tue Mar 24, 2009 3:41 pm
Forum: Programming Discussion
Topic: Needed help with spliting up code
Replies: 22
Views: 1593

Re: Needed help with spliting up code

Wow, that was foolish of me..
Thank you.
But now i have multiple definitions errors... :evil:
by Norbo
Tue Mar 24, 2009 2:17 pm
Forum: Programming Discussion
Topic: Needed help with spliting up code
Replies: 22
Views: 1593

Re: Needed help with spliting up code

Im using Dev-C++ as my IDE this is my globals.h #ifndef GLOBALS_H #define GLOBALS_H #include "SDL/SDL.h" #include "SDL/SDL_image.h" #include <fstream> extern SDL_Surface *screen = NULL; extern SDL_Event event; extern SDL_Surface *bg = NULL; extern SDL_Surface *gameOverImage = NUL...
by Norbo
Tue Mar 24, 2009 10:41 am
Forum: Programming Discussion
Topic: Needed help with spliting up code
Replies: 22
Views: 1593

Re: Needed help with spliting up code

you must do "extern" before every function in the header file. False. I've never seen it done this way and assume bad practice. make sure those files are ...in your main project. Agree. Did you "add new/existing file" them? I never knew i had to add my files to the current proje...
by Norbo
Tue Mar 24, 2009 2:08 am
Forum: Programming Discussion
Topic: Needed help with spliting up code
Replies: 22
Views: 1593

Re: Needed help with spliting up code

PixelP wrote:you must do "extern" before every function in the header file. like:

Code: Select all

//functions.h
extern bool init();

Code: Select all

//functions.cpp
bool init()
{
//code
}
hmm okay i will try and post if it works here. thanks

EDIT: NOPE, DOSENT WORK :(
by Norbo
Mon Mar 23, 2009 3:52 pm
Forum: Programming Discussion
Topic: Needed help with spliting up code
Replies: 22
Views: 1593

Re: Needed help with spliting up code

yes, i am including everything
by Norbo
Mon Mar 23, 2009 2:07 pm
Forum: Programming Discussion
Topic: Needed help with spliting up code
Replies: 22
Views: 1593

Re: Needed help with spliting up code

but i have posted the errors... When i compile my main.cpp file, i have tons of errors, all saying 2 things: ' warning: <myVarName> initialized and declared `extern' Where myVarName is the name of the variable It says that for all my vars and: main.cpp: undefined reference to <myFunctionName> Where ...
by Norbo
Mon Mar 23, 2009 1:51 pm
Forum: Programming Discussion
Topic: Needed help with spliting up code
Replies: 22
Views: 1593

Needed help with spliting up code

I have a code and i wanted to split it up but i didint know how to. So i read the lazyfoo's article on splitting source files. I did everything right, but i have a problem with my functions. When i compile my main.cpp file, i have tons of errors, all saying 2 things: ' warning: <myVarName> initializ...
by Norbo
Sat Mar 21, 2009 7:25 am
Forum: Programming Discussion
Topic: SDL Menu?
Replies: 9
Views: 1491

Re: SDL Menu?

Okay i managed to fix all my compile time errors, but when i run my game it crashes immedietly. crashes i mean the little window from microsoft pops out and wants me to send a raport to them. i have no clue why. please help me ;( my new code: #include "SDL/SDL.h" #include "SDL/SDL_mix...
by Norbo
Fri Mar 20, 2009 4:30 pm
Forum: Programming Discussion
Topic: SDL Menu?
Replies: 9
Views: 1491

Re: SDL Menu?

One noticable error is the class delaration, you have to put a semicolon after the closing brace, this is essential. I didn't have a proper check through your code (just a glance), but you will probably have a few less errors now, if you add that semicolon. EDIT: also, you can't declare objects wit...
by Norbo
Fri Mar 20, 2009 3:56 pm
Forum: Programming Discussion
Topic: SDL Menu?
Replies: 9
Views: 1491

Re: SDL Menu?

Okay, i tried to make a menu but i failed. i got lots of errors, and really, i have no clue what they mean and why do they occur. here is my code: #include "SDL/SDL.h" #include "SDL/SDL_mixer.h" #include "SDL/SDL_ttf.h" #include "SDL/SDL_image.h" #include <str...
by Norbo
Thu Mar 19, 2009 3:46 pm
Forum: Programming Discussion
Topic: SDL Menu?
Replies: 9
Views: 1491

Re: SDL Menu?

All right guys, thanks for the replies.
I will try to make a button class and combine it somehow to a main menu
but not now, tomorow :)
gn
by Norbo
Thu Mar 19, 2009 12:03 pm
Forum: Programming Discussion
Topic: SDL Menu?
Replies: 9
Views: 1491

SDL Menu?

Hello, im new to these forums and new to sdl and c++, so dont bit** me out pls. I am not sure how to make a working main menu in sdl. Like you know, at a start of the game, there are usually things like start game, options credits etc. I was wondering how to make that type of a menu. I guess make so...