Re: [AD] small demo patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> I think it should be changed to this:
> 
> #ifdef ALLEGRO_VRAM_SINGLE_SURFACE
>     if (set_gfx_mode(c, w, h, w, h * 3) != 0 &&
>         set_gfx_mode(c, w, h, w, h * 2) != 0 &&
>         set_gfx_mode(c, w, h, w, h) != 0) {
> #else
>     if (set_gfx_mode(c, w, h, 0, 0) != 0) {
> #endif

I dislike the if (set_gfx_mode(...) && set_gfx_mode(...) && ...) 
construction, personally. I would prefer the attached patch instead.

> Forgive me for not supplying a diff, but I accidently overwrote my local 
> CVS copy of demo.c.

You can just do cvs diff -u demo/demo.c > demo.diff, right?

> One more thing.. I personally think it's high-time 
> someone removes the MIDI driver check hack. If you're gonna use the 
> sample, use the sample, or else use the MIDI. You don't do something 
> like this in normal games so doing it here is very bad design, IMO. 
> Especially for those that try to learn by example.

I think I agree... the demo plays a wave file if it can't use MIDI, right? 
I think it's ok to use a wav fiel for the opening FLI, but not for the 
actual game. Not sure if it does that though...

Evert
Index: demo/demo.c
===================================================================
RCS file: /cvsroot/alleg/allegro/demo/demo.c,v
retrieving revision 1.25
diff -u -r1.25 demo.c
--- demo/demo.c	11 Jul 2004 16:08:24 -0000	1.25
+++ demo/demo.c	16 Jul 2004 08:37:16 -0000
@@ -2068,7 +2068,7 @@
 
 int main(int argc, char *argv[])
 {
-   int c, w, h;
+   int c, w, h, num_pages;
    char buf[256], buf2[256];
    BITMAP *bmp;
    CREDIT_NAME *cred;
@@ -2178,10 +2178,26 @@
 
    if (pick_animation_type(&animation_type) < 0)
       exit(1);
+      
+   switch (animation_type) {
+
+      case PAGE_FLIP:
+      case RETRACE_FLIP: 
+	 num_pages = 2;
+	 break;
+
+      case TRIPLE_BUFFER: 
+	 num_pages = 3;
+	 break;
+
+      default: 
+	 num_pages = 1;
+	 break;
+   }
 
    set_color_depth(8);
 #ifdef ALLEGRO_VRAM_SINGLE_SURFACE
-   if (set_gfx_mode(c, w, h, w, h * 2) != 0) {
+   if (set_gfx_mode(c, w, h, w, h * num_pages) != 0) {
 #else
    if (set_gfx_mode(c, w, h, 0, 0) != 0) {
 #endif


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/