1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-25 18:35:55 +02:00

liballegro: minor cleanup, fixes, tuning

This commit is contained in:
David Kühling 2011-06-02 13:05:26 +02:00
parent 3fe0b2e5d7
commit 61755836b8
3 changed files with 67 additions and 34 deletions

View File

@ -232,10 +232,13 @@ endef
define Package/liballegro-data/install
$(INSTALL_DIR) $(1)/usr/share/allegro
$(INSTALL_DIR) $(1)/usr/share/allegro/docs/txt
$(CP) $(PKG_BUILD_DIR)/{keyboard.dat,language.dat} $(1)/usr/share/allegro
# readme file is used by the allegro 'shooter' demo
$(CP) $(PKG_BUILD_DIR)/docs/txt/readme.txt $(1)/usr/share/allegro/docs/txt
$(INSTALL_DIR) $(1)/usr/share/allegro/docs/{txt,src}
$(CP) $(PKG_BUILD_DIR)/docs/txt/readme.txt \
$(1)/usr/share/allegro/docs/txt
$(CP) $(PKG_BUILD_DIR)/docs/src/thanks._tx \
$(1)/usr/share/allegro/docs/src
endef
define Package/liballegro-demo/install

View File

@ -1,7 +1,7 @@
Index: allegro-4.4.2/demos/shooter/demo.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-06-02 11:18:39.000000000 +0200
+++ allegro-4.4.2/demos/shooter/demo.c 2011-06-02 11:20:02.000000000 +0200
--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-06-02 12:30:54.000000000 +0200
+++ allegro-4.4.2/demos/shooter/demo.c 2011-06-02 12:32:06.000000000 +0200
@@ -103,7 +103,7 @@
get_executable_name(buf, sizeof(buf));
replace_filename(buf2, buf, "demo.dat", sizeof(buf2));
@ -13,8 +13,8 @@ Index: allegro-4.4.2/demos/shooter/demo.c
allegro_message("Error loading %s\n", buf2);
Index: allegro-4.4.2/demos/skater/source/framewk.c
===================================================================
--- allegro-4.4.2.orig/demos/skater/source/framewk.c 2011-06-02 11:19:00.000000000 +0200
+++ allegro-4.4.2/demos/skater/source/framewk.c 2011-06-02 11:26:44.000000000 +0200
--- allegro-4.4.2.orig/demos/skater/source/framewk.c 2011-06-02 12:30:54.000000000 +0200
+++ allegro-4.4.2/demos/skater/source/framewk.c 2011-06-02 12:32:06.000000000 +0200
@@ -27,7 +27,7 @@
}
@ -41,8 +41,8 @@ Index: allegro-4.4.2/demos/skater/source/framewk.c
/* Read configuration file. */
Index: allegro-4.4.2/demos/skater/source/game_sk.c
===================================================================
--- allegro-4.4.2.orig/demos/skater/source/game_sk.c 2011-06-02 11:20:54.000000000 +0200
+++ allegro-4.4.2/demos/skater/source/game_sk.c 2011-06-02 11:26:38.000000000 +0200
--- allegro-4.4.2.orig/demos/skater/source/game_sk.c 2011-06-02 12:30:54.000000000 +0200
+++ allegro-4.4.2/demos/skater/source/game_sk.c 2011-06-02 12:32:06.000000000 +0200
@@ -70,10 +70,10 @@
char *load_game_resources(void)
{
@ -59,8 +59,8 @@ Index: allegro-4.4.2/demos/skater/source/game_sk.c
Index: allegro-4.4.2/demos/skater/source/level.c
===================================================================
--- allegro-4.4.2.orig/demos/skater/source/level.c 2011-06-02 11:22:02.000000000 +0200
+++ allegro-4.4.2/demos/skater/source/level.c 2011-06-02 11:26:49.000000000 +0200
--- allegro-4.4.2.orig/demos/skater/source/level.c 2011-06-02 12:30:54.000000000 +0200
+++ allegro-4.4.2/demos/skater/source/level.c 2011-06-02 12:32:06.000000000 +0200
@@ -74,8 +74,9 @@
#endif
char LocName[DEMO_PATH_LENGTH], TString[DEMO_PATH_LENGTH];
@ -72,3 +72,15 @@ Index: allegro-4.4.2/demos/skater/source/level.c
replace_filename(LocName, LocName, TString, DEMO_PATH_LENGTH);
#ifdef DEMO_USE_ALLEGRO_GL
Index: allegro-4.4.2/demos/shooter/title.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/title.c 2011-06-02 12:32:12.000000000 +0200
+++ allegro-4.4.2/demos/shooter/title.c 2011-06-02 12:32:13.000000000 +0200
@@ -82,6 +82,7 @@
int i;
get_executable_name(exe, sizeof(exe));
+ strcpy(exe, "/usr/share/allegro/dummy");
for (i = 0; locations[i] != NULL; i++) {
replace_filename(dir, exe, locations[i], sizeof(dir));
append_filename(buf, dir, name, bufsize);

View File

@ -1,7 +1,7 @@
Index: allegro-4.4.2/demos/shooter/demo.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-06-01 20:05:58.000000000 +0200
+++ allegro-4.4.2/demos/shooter/demo.c 2011-06-01 20:06:18.000000000 +0200
--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-06-02 12:32:25.000000000 +0200
+++ allegro-4.4.2/demos/shooter/demo.c 2011-06-02 12:32:44.000000000 +0200
@@ -1,3 +1,5 @@
+#define DEBUGMODE
+
@ -18,8 +18,8 @@ Index: allegro-4.4.2/demos/shooter/demo.c
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
Index: allegro-4.4.2/demos/shooter/display.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/display.c 2011-06-01 20:05:59.000000000 +0200
+++ allegro-4.4.2/demos/shooter/display.c 2011-06-01 20:06:18.000000000 +0200
--- allegro-4.4.2.orig/demos/shooter/display.c 2011-06-02 12:30:09.000000000 +0200
+++ allegro-4.4.2/demos/shooter/display.c 2011-06-02 12:32:44.000000000 +0200
@@ -28,18 +28,19 @@
break;
}
@ -53,13 +53,13 @@ Index: allegro-4.4.2/demos/shooter/display.c
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
Index: allegro-4.4.2/demos/shooter/game.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/game.c 2011-06-01 20:05:59.000000000 +0200
+++ allegro-4.4.2/demos/shooter/game.c 2011-06-01 20:37:13.000000000 +0200
--- allegro-4.4.2.orig/demos/shooter/game.c 2011-06-02 12:30:09.000000000 +0200
+++ allegro-4.4.2/demos/shooter/game.c 2011-06-02 12:36:29.000000000 +0200
@@ -58,12 +58,18 @@
static void draw_intro_item(int item, int size)
{
BITMAP *b = (BITMAP *) data[item].dat;
+ BITMAP *b_n = create_bitmap_ex(32, b->w, b->h);
+ BITMAP *b_n = create_bitmap_ex(bitmap_color_depth(screen), b->w, b->h);
+ clear_to_color(b_n,0xffff);
+ set_palette(data[GAME_PAL].dat);
+ blit (b, b_n, 0, 0, 0, 0, b->w, b->h);
@ -77,34 +77,52 @@ Index: allegro-4.4.2/demos/shooter/game.c
Index: allegro-4.4.2/demos/shooter/title.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/title.c 2011-06-01 20:05:58.000000000 +0200
+++ allegro-4.4.2/demos/shooter/title.c 2011-06-01 20:06:18.000000000 +0200
@@ -843,10 +843,11 @@
--- allegro-4.4.2.orig/demos/shooter/title.c 2011-06-02 12:32:26.000000000 +0200
+++ allegro-4.4.2/demos/shooter/title.c 2011-06-02 12:38:29.000000000 +0200
@@ -844,10 +844,18 @@
scroll_count = 1;
install_int(scroll_counter, 5);
- while ((c = scroll_count) < 160)
+ /* fix for stretch_blit: won't work over different color depth */
+ BITMAP *title = data[TITLE_BMP].dat;
+ BITMAP *title_n = create_bitmap_ex(bitmap_color_depth(screen),
+ title->w, title->h);
+ blit (title, title_n, 0, 0, 0, 0, title->w, title->h);
while ((c = scroll_count) < 160)
- stretch_blit(data[TITLE_BMP].dat, screen, 0, 0, 320, 128,
- SCREEN_W / 2 - c, SCREEN_H / 2 - c * 64 / 160 - 32,
- c * 2, c * 128 / 160);
+ /* todo: stretch_blit won't work over color depth */
+ /* while ((c = scroll_count) < 160) */
+ /* stretch_blit(data[TITLE_BMP].dat, screen, 0, 0, 320, 128, */
+ /* SCREEN_W / 2 - c, SCREEN_H / 2 - c * 64 / 160 - 32, */
+ /* c * 2, c * 128 / 160); */
+ {
+ stretch_blit(title_n, screen, 0, 0, 320, 128,
SCREEN_W / 2 - c, SCREEN_H / 2 - c * 64 / 160 - 32,
c * 2, c * 128 / 160);
+ }
+ destroy_bitmap(title_n);
remove_int(scroll_counter);
Index: allegro-4.4.2/demos/shooter/dirty.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/dirty.c 2011-06-01 20:11:58.000000000 +0200
+++ allegro-4.4.2/demos/shooter/dirty.c 2011-06-01 20:12:08.000000000 +0200
@@ -93,7 +93,7 @@
--- allegro-4.4.2.orig/demos/shooter/dirty.c 2011-06-02 12:30:09.000000000 +0200
+++ allegro-4.4.2/demos/shooter/dirty.c 2011-06-02 12:33:37.000000000 +0200
@@ -92,10 +92,13 @@
acquire_screen();
+ /* setup palette_color[] */
+ set_color_depth(32);
+
for (c = 0; c < old_dirty.count; c++) {
- if ((old_dirty.rect[c].w == 1) && (old_dirty.rect[c].h == 1)) {
+ if (0 && (old_dirty.rect[c].w == 1) && (old_dirty.rect[c].h == 1)) {
if ((old_dirty.rect[c].w == 1) && (old_dirty.rect[c].h == 1)) {
putpixel(screen, old_dirty.rect[c].x, old_dirty.rect[c].y,
getpixel(bmp, old_dirty.rect[c].x, old_dirty.rect[c].y));
- getpixel(bmp, old_dirty.rect[c].x, old_dirty.rect[c].y));
+ palette_color[getpixel(bmp, old_dirty.rect[c].x, old_dirty.rect[c].y)]);
}
else {
blit(bmp, screen, old_dirty.rect[c].x, old_dirty.rect[c].y,
@@ -103,6 +106,7 @@
old_dirty.rect[c].w, old_dirty.rect[c].h);
}
}
+ set_color_depth(8);
release_screen();
}