Ejemplo n.º 1
0
void Browser::keyPressEvent(QKeyEvent * event)
{
  switch ( event->key() )
    {
    case Qt::Key_K: /* next */
      nextpage();
      break;
    case Qt::Key_J: /* previous */
      previouspage();
      break;
    case Qt::Key_Q: /* quit - just for test */
      //save();
      close();
      break;
    case Qt::Key_R: /* Reload config file - just for test */
      reload();
      break;
    case Qt::Key_P:
      playpause();
      break;
    case Qt::Key_T: /* just for debug */
      test();
      break;
    default: // n'importe quelle autre touche
      std::cout << "UNDEF KEY" << std::endl;
      break;
    }
}
Ejemplo n.º 2
0
void
SMK_playFlic(char *path)
{
#if 0
     int  frames=0,i;

     if (access(path,F_OK) != 0) {
          return;
     }
     if (!noSoundFlag) {
          smk=SmackOpen(path,SMACKTRACKS,SMACKAUTOEXTRA);
     }
     else {
          smk=SmackOpen(path,0,SMACKAUTOEXTRA);
     }
     if (smk) {
          GFX_fadeOut(255);        // make sure game palette is faded
          walock[SMACKTILE]=200;
          allocache(&waloff[SMACKTILE],320L*200L,&walock[SMACKTILE]);
          tilesizx[SMACKTILE]=200;
          tilesizy[SMACKTILE]=320;
          SmackToBuffer(smk,0L,0L,320L,200L,(void *)waloff[SMACKTILE],0);
          keystatus[1]=0;
          keystatus[28]=0;
          keystatus[57]=0;
          while (1) {
               if (smk->NewPalette) {
                    SMK_loadPalette(smk->Palette);
               }
               SmackDoFrame(smk);
               SmackNextFrame(smk);
               rotatesprite(320L<<15,200L<<15,65536L,512,SMACKTILE,0,0,2+4+64,
                            0L,0L,xdim-1L,ydim-1L);
               nextpage();
               SMK_setPalette();
               while (SmackWait(smk)) {
                    if (keystatus[1] || keystatus[57] || keystatus[28]) {
                         goto done;
                    }
               }
               if (keystatus[1] || keystatus[57] || keystatus[28]) {
                    goto done;
               }
               frames++;
               if (frames == smk->Frames) {
                    goto done;
               }
          }
done:
          walock[SMACKTILE]=1;
          SmackClose(smk);
          for (i = 0 ; i < MAXRADBUFFS ; i++) {
               radbuf[i].cache_lock=1;
          }
     }
#endif
}
Ejemplo n.º 3
0
void doframe ()
{
   long frameptr, pitch, xdim, ydim;
   startdirectdraw(&frameptr,&pitch,&xdim,&ydim);
   voxsetframebuffer(frameptr,pitch,xdim,ydim);
   setcamera(&ipos,&istr,&ihei,&ifor,xdim*.5,ydim*.5,xdim*.5);
   opticast();

   drawsprite(&desklamp);

   stopdirectdraw();
   nextpage();
   readkeyboard(); if (keystatus[1]) quitloop();
}
Ejemplo n.º 4
0
static void editorprint(control m)
{
    printer lpr;
    font f;
    textbox t = getdata(m);
    const char *contents = gettext(t);
    char msg[LF_FACESIZE + 128];
    char *linebuf = NULL;
    int cc, rr, fh, page, linep, i, j, istartline;
    int top, left;

    if (!(lpr = newprinter(0.0, 0.0, ""))) return;
    f = gnewfont(lpr, strcmp(fontname, "FixedFont") ? fontname : "Courier New",
		 fontsty, pointsize, 0.0, 1);
    top = devicepixelsy(lpr) / 5;
    left = devicepixelsx(lpr) / 5;
    fh = fontheight(f);
    rr = getheight(lpr) - top;
    cc = getwidth(lpr) - 2*left;

    linep = rr; /* line in printer page */
    page = 1;
    i = 0;
    while (i < strlen(contents)) {
	if ( linep + fh >= rr ) { /* new page */
	    if (page > 1) nextpage(lpr);
	    snprintf(msg, LF_FACESIZE + 128, "Page %d", page++);
	    gdrawstr(lpr, f, Black, pt(cc - gstrwidth(lpr, f, msg) - 1, top),
		     msg);
	    linep = top + 2*fh;
	}
	j = 0;
	istartline = i;
	while (contents[i] != '\n' && contents[i] != '\0') {
	    ++i; ++j;
	}
	linebuf = realloc(linebuf, (j+1)*sizeof(char));
	strncpy(linebuf, &contents[istartline], j);
	linebuf[j] = '\0';
	gdrawstr(lpr, f, Black, pt(left, linep), linebuf);
	linep += fh;
	++i;
    }
    free(linebuf);
    if (f != FixedFont) del(f);
    del(lpr);
}
Ejemplo n.º 5
0
void 
playanm(short anim_num)
    {
    unsigned char *animbuf, *palptr;
    int i, j, k, length = 0, numframes = 0;
    int32 handle = -1;
    unsigned char ANIMvesapal[4*256];
    unsigned char tempbuf[256];
    unsigned char *palook_bak = palookup[0];
    UserInput uinfo = { FALSE, FALSE, dir_None };

    ANIMnum = anim_num;

    KB_FlushKeyboardQueue();    
    KB_ClearKeysDown();    
    
    DSPRINTF(ds,"PlayAnm");
    MONO_PRINT(ds);

    DSPRINTF(ds,"PlayAnm");
    MONO_PRINT(ds);

    animbuf = LoadAnm(anim_num);
    if (!animbuf)    
        return;
    
    DSPRINTF(ds,"PlayAnm - Palette Stuff");
    MONO_PRINT(ds);

    for (i = 0; i < 256; i++)
        tempbuf[i] = i;
    palookup[0] = tempbuf;    
        
    ANIM_LoadAnim(animbuf);
    ANIMnumframes = ANIM_NumFrames();
    numframes = ANIMnumframes;
    
    palptr = ANIM_GetPalette();
    for (i = 0; i < 768; i++)
	ANIMvesapal[i] = palptr[i]>>2;

    tilesizx[ANIM_TILE(ANIMnum)] = 200;
    tilesizy[ANIM_TILE(ANIMnum)] = 320;

    clearview(0);

    setbrightness(gs.Brightness,ANIMvesapal,2);
    if (ANIMnum == 1)
        {
        // draw the first frame
        waloff[ANIM_TILE(ANIMnum)] = (intptr_t)ANIM_DrawFrame(1);
        invalidatetile(ANIM_TILE(ANIMnum), 0, 1<<4);
        rotatesprite(0 << 16, 0 << 16, 65536L, 512, ANIM_TILE(ANIMnum), 0, 0, 2 + 4 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1);
        }

    SoundState = 0;
    //ototalclock = totalclock + 120*2;
    ototalclock = totalclock;

    for (i = 1; i < numframes; i++)
        {
        while (totalclock < ototalclock)
            {
			handleevents();
            CONTROL_GetUserInput(&uinfo);
            CONTROL_ClearUserInput(&uinfo);
            switch (ANIMnum)
                {
                case ANIM_INTRO:
                    if (KB_KeyWaiting() || uinfo.button0 || uinfo.button1 || quitevent)
                        goto ENDOFANIMLOOP;
                    break;
                case ANIM_SERP:
                    if (KEY_PRESSED(KEYSC_ESC) || uinfo.button1 || quitevent)
                        goto ENDOFANIMLOOP;
                    break;
                }    
                
            getpackets();
            }

        switch (ANIMnum)
            {
            case ANIM_INTRO:
                AnimShareIntro(i,numframes);    
                break;
            case ANIM_SERP:
                AnimSerp(i,numframes);    
                break;
            case ANIM_SUMO:
                AnimSumo(i,numframes);    
                break;
            case ANIM_ZILLA:
                AnimZilla(i,numframes);    
                break;
            }    
            
        waloff[ANIM_TILE(ANIMnum)] = (intptr_t)ANIM_DrawFrame(i);
        invalidatetile(ANIM_TILE(ANIMnum), 0, 1<<4);

        rotatesprite(0 << 16, 0 << 16, 65536L, 512, ANIM_TILE(ANIMnum), 0, 0, 2 + 4 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1);
        nextpage();
        }

    // pause on final frame    
    while (totalclock < ototalclock) {
		handleevents();
        getpackets();
	}
        
ENDOFANIMLOOP:

    clearview(0);
    nextpage();
    palookup[0] = palook_bak;
    setbrightness(gs.Brightness, (unsigned char*)palette_data, 2);
    
    KB_FlushKeyboardQueue();    
    KB_ClearKeysDown();    
    ANIM_FreeAnim();
    walock[ANIM_TILE(ANIMnum)] = 1;
    }
Ejemplo n.º 6
0
void
playanm ( short anim_num )
{
    char *animbuf, *palptr;
    long i, j, k, numframes = 0;
    int32 handle = -1;
    char ANIMvesapal[4 * 256];
    char tempbuf[256];
    char *palook_bak = palookup[0];
    ANIMnum = anim_num;
    KB_FlushKeyboardQueue();
    KB_ClearKeysDown();
    DSPRINTF ( ds, "PlayAnm" );
    MONO_PRINT ( ds );
    DSPRINTF ( ds, "PlayAnm" );
    MONO_PRINT ( ds );
    animbuf = LoadAnm ( anim_num );
    
    if ( !animbuf )
    {
        return;
    }
    
    DSPRINTF ( ds, "PlayAnm - Palette Stuff" );
    MONO_PRINT ( ds );
    
    for ( i = 0; i < 256; i++ )
    {
        tempbuf[i] = i;
    }
    
    palookup[0] = tempbuf;
    ANIM_LoadAnim ( ( uint8_t * ) animbuf, length );
    ANIMnumframes = ANIM_NumFrames();
    numframes = ANIMnumframes;
    palptr = ( char * ) ANIM_GetPalette();
    
    for ( i = 0; i < 768; i++ )
    {
        ANIMvesapal[i] = palptr[i] >> 2;
    }
    
    tilesiz[TILE_ANIM].x = 200;
    tilesiz[TILE_ANIM].y = 320;
    setbasepal ( 0, ( const uint8_t * ) ANIMvesapal );
    setbrightness ( gs.Brightness, 0, 2 );
    
    if ( ANIMnum == 1 )
    {
        // draw the first frame
        waloff[TILE_ANIM] = FP_OFF ( ANIM_DrawFrame ( 1 ) );
        invalidatetile ( TILE_ANIM, 0, 1 << 4 );
        rotatesprite ( 0 << 16, 0 << 16, 65536L, 512, TILE_ANIM, 0, 0, 2 + 4 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1 );
    }
    
    SoundState = 0;
    //ototalclock = totalclock + 120*2;
    ototalclock = totalclock;
    
    for ( i = 1; i < numframes; i++ )
    {
        while ( totalclock < ototalclock )
        {
            switch ( ANIMnum )
            {
                case 0:
                    if ( KB_KeyWaiting() )
                    {
                        goto ENDOFANIMLOOP;
                    }
                    
                    break;
                    
                case 1:
                    if ( KEY_PRESSED ( KEYSC_ESC ) )
                    {
                        goto ENDOFANIMLOOP;
                    }
                    
                    break;
            }
            
            getpackets();
        }
        
        switch ( ANIMnum )
        {
            case ANIM_INTRO:
                AnimShareIntro ( i, numframes );
                break;
                
            case ANIM_SERP:
                AnimSerp ( i, numframes );
                break;
                
            case ANIM_SUMO:
                AnimSumo ( i, numframes );
                break;
                
            case ANIM_ZILLA:
                AnimZilla ( i, numframes );
                break;
        }
        
        waloff[TILE_ANIM] = FP_OFF ( ANIM_DrawFrame ( i ) );
        invalidatetile ( TILE_ANIM, 0, 1 << 4 );
        rotatesprite ( 0 << 16, 0 << 16, 65536L, 512, TILE_ANIM, 0, 0, 2 + 4 + 8 + 16 + 64, 0, 0, xdim - 1, ydim - 1 );
        nextpage();
    }
    
    // pause on final frame
    while ( totalclock < ototalclock )
    {
        getpackets();
    }
    
ENDOFANIMLOOP:
    clearview ( 0 );
    nextpage();
    palookup[0] = palook_bak;
    //    setbrightness(gs.Brightness, (char*)palette_data, 2);
    setbasepal ( 0, ( const uint8_t * ) palette_data );
    setbrightness ( gs.Brightness, 0, 2 );
    KB_FlushKeyboardQueue();
    KB_ClearKeysDown();
    ANIM_FreeAnim();
    walock[ANIM_TILE ( ANIMnum )] = 1;
}