Trouble with Allegro

Started by
6 comments, last by konForce 16 years, 6 months ago
I picked up Game Programming All in One. This was an example in the book.
#include <stdlib.h>
#include "allegro.h"

int main(void) {
    allegro_init();
    install_keyboard();
    
    int ret = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 00);
    if (ret != 0) {
            allegro_message(allegro_error);
            return 1;
    }
    
    textprintf(screen, font, 0, 0, makecol(255, 255, 255),
        "%dx%d", SCREEN_W, SCREEN_H);
    
    while(!key[KEY_ESC]);
    allegro_exit();
    return 0;
    
}
END_OF_MAIN()    
i don't understand what's wrong with it.
Advertisement
Does it compile for you? Are you getting any error message(s) or warning(s)? If so, what are they? If you're not getting errors/warnings and it's compiling fine then what isn't happening as expected?

- Jason Astle-Adams

14 C:\Dev-Cpp\Untitled1.cpp [Warning] `textprintf' is deprecated (declared at C:/Dev-Cpp/include/allegro/alcompat.h:177)
In other words....the "textprintf" is an undeclared function.
Yes the textprintf is deprecated which means you must be using the latest Allegro 4.2.2 library. no biggy. If I was you I would go to the allegro API manual webpage for 4.2.2 which can be found here

and look at the text functions that you are allowed to use. Now, if you are using 4.2.1 version then I don't know what you could of done wrong.

Hope this helps,

code'n'4'fun!
Quote:In other words....the "textprintf" is an undeclared function.

No, it means nothing like that. It's just a warning.

You can still use textprintf, but it has been replaced with a newer function (textprintf_ex). Functions marked as deprecated no longer appear in the documentation and may be removed from the library in future versions. However, there really is no likelihood of a function in Allegro 4 ever being removed in a future 4.Y.Z version.
I downloaded 4.2.1 Is there anything significant I'm missing out on with 4.2.2?
Downgrading to 4.2.1 is pointless. It has nothing to do with the deprecated function warnings.

This topic is closed to new replies.

Advertisement