Sign in to follow this  
JSD31526

Trouble with Allegro

Recommended Posts

JSD31526    122
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.

Share this post


Link to post
Share on other sites
jbadams    25677
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?

Share this post


Link to post
Share on other sites
coden4fun    100
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!

Share this post


Link to post
Share on other sites
konForce    592
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this