PDA

Ver la versión completa : Alguien a compilado con allegro?



the_goulin
01/03/2006, 21:33
Hola,

Pues nada que me dio hace unos dias por compilar un tipico Hello World con Alegro y bueno, compilar compiló sin problemas, pero cuando lo pongo en la gp2x se que queda la pantalla en negro y no hace nada.

alguien mas a probado a compilar y ejecutar?

hay q instalar algo mas?

compile siguiendo las instrucciones de la web ...


Asias..

schan
02/03/2006, 00:36
una pregunta tonta... has enlazado estáticamente?

Uncanny
02/03/2006, 02:02
A la pregunta de schan añado la de si es un simple "hello world" o tiene inicializado el sistema gráfico de Allegro. Una forma de hacer pruebas es usar sterm, ejecutas el programa desde sterm y ves si tiene algún error (los típicos "segmentation fault" o si está compilado dinámicamente te dirá que le falta algún *.so).

the_goulin
02/03/2006, 03:04
Pues si, esta compilado staticamente, y tambien inicializa el modo grafico de allegro.

he probado con sterm pero no da ningun fallo, solo me retorna al menu

adjunto codigos del make file y del programa




CROSS_COMPILE = C:/devkitGP2X/bin/arm-linux-
SDL_BASE = C:/devkitGP2X/bin/
LDFLAGS = -static

CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip

CFLAGS = `$(SDL_BASE)gp2x-allegro-config --cflags` -O2 -Werror
CXXFLAGS = `$(SDL_BASE)gp2x-allegro-config --cflags` -O2 -Werror
LIBS = `$(SDL_BASE)gp2x-allegro-config --libs`

SDLTEST_TARGET = prueba.gpe
SDLTEST_OBJS = exhello.o


all : $(SDLTEST_TARGET)

$(SDLTEST_TARGET) : $(SDLTEST_OBJS)
$(CXX) $(LDFLAGS) -o $(SDLTEST_TARGET) $(SDLTEST_OBJS) $(LIBS)
$(STRIP) $(SDLTEST_TARGET)

clean:
rm -f $(ALL_TARGETS) *.o *~


/*
* Example program for the Allegro library, by Shawn Hargreaves.
*
* This is a very simple program showing how to get into graphics
* mode and draw text onto the screen.
*/



#include "c:\devkitgp2x\include\allegro.h"



int main(void)
{
/* you should always do this at the start of Allegro programs */
if (allegro_init() != 0)
return 1;

/* set up the keyboard handler */
install_keyboard();

/* set a graphics mode sized 320x200 */
if (set_gfx_mode(GFX_AUTODETECT, 320, 240, 0, 0) != 0) {
if (set_gfx_mode(GFX_SAFE, 320, 240, 0, 0) != 0) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
return 1;
}
}

/* set the color palette */
set_palette(desktop_palette);

/* clear the screen to white */
clear_to_color(screen, makecol(255, 255, 255));

/* you don't need to do this, but on some platforms (eg. Windows) things
* will be drawn more quickly if you always acquire the screen before
* trying to draw onto it.
*/
acquire_screen();

/* write some text to the screen with black letters and transparent background */
textout_centre_ex(screen, font, "Hello, world!", SCREEN_W/2, SCREEN_H/2, makecol(0,0,0), -1);

/* you must always release bitmaps before calling any input functions */
release_screen();

/* wait for a keypress */
readkey();

return 0;
}

END_OF_MAIN()