Main Page Data Structures File List Data Fields Globals Related Pages

# mp3v2.cpp

Go to the documentation of this file.

    00001 /*  mp3player hardware test
    00002
    00003     15.05.2001: tk, initial implementation.
    00004
    00005     Copyright (c)2000 by Thomas Kindler, thomas.kindler@gmx.de
    00006
    00007     This program is free software; you can redistribute it and/or
    00008     modify it under the terms of the GNU General Public License as
    00009     published by the Free Software Foundation; either version 2 of
    00010     the License, or (at your option) any later version. Read the
    00011     full License at http://www.gnu.org/copyleft for more details.
    00012 */
    00013
    00014 // include files -----
    00015 //
    00016 #include <mem.h>
    00017 #include <malloc.h>
    00018 #include <stdio.h>
    00019 #include <math.h>
    00020 #include <conio.h>
    00021 #include <string.h>
    00022 #include <io.h>
    00023 #include <stdlib.h>
    00024 #include "misc.h"
    00025 #include "ztimer.h"
    00026 #include "vs1001.h"
    00027 #include "checkbios.h"
    00028 #include "gfxcore.h"
    00029 #include "gfxdriver.h"
    00030 #include "gfxutil.h"
    00031 #include "gfxfont.h"
    00032 #include "remote.h"
    00033 #include "ztimer.h"
    00034 #include "clib/rtos.h"
    00035 #include "clib/cgiapi.h"
    00036
    00037
    00038 void  gfxTest()
    00039 {
    00040   Bitmap *screen = BM_Alloc(122, 32);
    00041 //Bitmap *logo   = BM_Load("test.bmp");
    00042
    00043   Graphics  gfx;
    00044   GFX_Init(&gfx, screen);
    00045
    00046   BM_Clear(screen);
    00047
    00048   int x=0, y=24, u=33, v=0, w=122, h=8, op = 0;
    00049
    00050 /*  while (true) {
    00051     char c = getch();
    00052     char text[2] = {c, 0};
    00053
    00054     if (c != 0) {
    00055       if (c==27)
    00056         break;
    00057       if (c==13 || gfx.x + GFX_TextWidth(&gfx, text) >= screen->width)
    00058         GFX_MoveTo(&gfx, 0, gfx.y + font->height+1);
    00059
    00060       int bottom = gfx.y+font->height;
    00061       if (bottom >= screen->height) {
    00062         BM_Scroll(screen, 0, bottom - screen->height);
    00063         GFX_MoveRel(&gfx, 0, - (bottom - screen->height));
    00064       }
    00065
    00066       GFX_Print(&gfx, text);
    00067       LCD_Update(screen);
    00068     }
    00069   } */
    00070
    00071
    00072   while (!kbhit()) {
    00073     long key = RC_GetKey();
    00074 //    printf("%c", 12);
    00075     switch (key & ~RCKEY_REPEAT) {
    00076       case 0x10d52a10:   return;
    00077
    00078       case 0x10d52a14:   x--; break;
    00079       case 0x10d52a02:   x++; break;
    00080       case 0x10d52a18:   y--; break;
    00081       case 0x10d52a01:   y++; break;
    00082
    00083       case 0x10d52a17:   u--; break;
    00084       case 0x10d52a08:   u++; break;
    00085       case 0x10d52a04:   v--; break;
    00086       case 0x10d52a07:   v++; break;
    00087
    00088       case 0x10d52a1a:   w--; break;
    00089       case 0x10d52a03:   w++; break;
    00090       case 0x10d52a06:   h--; break;
    00091       case 0x10d52a09:   h++; break;
    00092
    00093       case 0x10d52a13:   op++; break;
    00094
    00095       case 0x10d52a19:
    00096         Bitmap *foo;
    00097         foo = BM_Alloc(screen->width+8, screen->height+8);
    00098         BM_Clear(foo);
    00099         BM_Blit(foo, 4, 4, screen);
    00100         BM_Save(foo, "www\\shot.bmp");
    00101         BM_Free(foo);
    00102         break;
    00103
    00104       default:
    00105         printf("unkown code: 0x%lx\n", key);
    00106         break;
    00107     }
    00108     BM_Clear(screen);
    00109
    00110 //    font->firstChar = u;
    00111 //    printf("%d\n", u);
    00112
    00113     GFX_PrintAt(&gfx, 0,  0, "PalmOS Fonts rul0r3n!");
    00114     GFX_PrintAt(&gfx, 0,  8, "K/oS MP3 Player v2");
    00115     GFX_PrintfAt(&gfx, 0, 16, "www.kreapc.de op=%d", op);
    00116 /*    op &= 15;
    00117     BM_Blit(screen, x, y, logo, u, v, -1, -1, op);
    00118 */
    00119
    00120 /*    GFX_SetFillStyle(&gfx, xHatchFill);
    00121     ZTimer_Start();
    00122     GFX_FillRect(&gfx, x, y, w, h);
    00123     int time1 = ZTimer_Stop();
    00124     GFX_MoveTo(&gfx, 0, 0);
    00125     GFX_Printf(&gfx, "%d,%d,%d,%d: %d us ", x, y, w, h, time1);
    00126 */
    00127
    00128 /*    GFX_SetColor(&gfx, 0);
    00129     GFX_SetBlitMode(&gfx, BLT_NOTCOPY);
    00130     BM_Clear(screen, 0xff);
    00131 */
    00132 /*    if (w&1)
    00133       GFX_LineX(&gfx, 1, 1, 120, 30);
    00134     else
    00135       GFX_LineX(&gfx, x, y, x+u, y+v);
    00136 */
    00137
    00138 //    GFX_RoundRect(&gfx, x, y, w, h);
    00139     GFX_ProgressBar(&gfx, x, y, w, h, u);
    00140
    00141 /*    GFX_PrintfAt(&gfx, 61, -1, "%d us", time);
    00142     int foo = GFX_PrintAt(&gfx, 0,  23, "Hello World");
    00143
    00144     GFX_PrintfAt(&gfx, 61, 8, "%d == %d", foo,
    00145                  GFX_TextWidth(&gfx, "Hello World"));
    00146 */
    00147     LCD_Update(screen);
    00148   }
    00149
    00150 }
    00151
    00152
    00153
    00154
    00155 void huge _pascal Example1_Func(rpCgiPtr request)
    00156 {
    00157   static char *text = "Nur ein kleiner Test!";
    00158   request->fHttpResponse         = CgiHttpOk;
    00159   request->fDataType             = CGIDataTypeText;
    00160   request->fResponseBufferPtr    = text;
    00161   request->fResponseBufferLength = strlen(text);
    00162 }
    00163
    00164
    00165 void main(int argc, char* argv[])
    00166 {
    00167   if (!CheckBIOS())
    00168     return;
    00169
    00170   CGI_Entry cgi = {"example", CgiHttpGet, Example1_Func};
    00171   CGI_Install(&cgi);
    00172
    00173   LCD_Init();
    00174   RC_Init();
    00175   VS_Init();
    00176
    00177   gfxTest();
    00178
    00179   VS_Done();
    00180   RC_Done();
    00181   LCD_Done();
    00182
    00183   CGI_Delete(cgi.PathPtr);
    00184 }