adbmp.c

This example shows a little dialog including a Bitmap

The Bitmap data is defined in adlogo.h, which is kind of unintersesting now. Here is the example code:

00001 /*
00002         Advanved Dialogs v1.05 - Example program
00003         Copyright (C) 2005-2007 Jonas Gehring
00004 
00005         Advanced Dialogs is free software; you can redistribute it and/or modify
00006         it under the terms of the GNU Lesser General Public License as published by
00007         the Free Software Foundation; either version 2 of the License, or
00008         (at your option) any later version.
00009 
00010         Advanced Dialogs is distributed in the hope that it will be useful,
00011         but WITHOUT ANY WARRANTY; without even the implied warranty of
00012         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013         GNU Lesser General Public License for more details.
00014 
00015         You should have received a copy of the GNU Lesser General Public License
00016         along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 // C Source File
00021 // Created 18.01.2006; 06:45:10
00022 
00023 
00024 
00025 #include <tigcclib.h>                                   // Include all standard header files
00026 
00027 #include <extgraph.h>                                   // Include ExtGraph v2.00beta5 by TI-Chess Team
00028 #include <AdvDialogs.h>                                 // Powered by Advanced Dialogs v1.05
00029 
00030 #include "adlogo.h"                                     // Advanced Dialogs logo (image data)
00031 
00032 
00033 // Main Function
00034 void _main(void)
00035 {
00036         void *buffer;
00037         
00038         // Allocate space for the LCD buffer
00039         if ((buffer = malloc(LCD_SIZE)) == NULL)
00040         {
00041                 return;
00042         }
00043 
00044         memcpy(buffer, LCD_MEM, LCD_SIZE);
00045         
00046         if (!GrayOn())                                                  // Turn on grayscale graphics
00047         {
00048                 free(buffer);
00049                 return;
00050         }
00051 
00052         memcpy(GrayGetPlane(LIGHT_PLANE), buffer, LCD_SIZE);
00053         memcpy(GrayGetPlane(DARK_PLANE), buffer, LCD_SIZE);
00054 
00055         // Create dialog
00056         ADVDIALOG *dialog = AdvDlgNew(135, 68, "Advanced Dialogs", FALSE);
00057         
00058         // Create bitmap
00059         ADVBITMAP *bitmap = AdvDlgBitmapNew(64, 28, adlogo2, adlogo1);
00060 
00061         // Add bitmap to the dialog
00062         if (bitmap != NULL)
00063         {
00064                 AdvDlgAddBitmap(dialog, 0, 2, 9, bitmap);
00065         }
00066 
00067         // Add text to the dialog
00068         AdvDlgAddText(dialog, 0, 0, "Advanced Dialogs", TXT_ALIGNRIGHT, COLOR_BLACK);
00069         AdvDlgAddText(dialog, 0, 1, "version "ADVDLG_VERSION_STR, TXT_ALIGNRIGHT, COLOR_BLACK);
00070         AdvDlgAddText(dialog, 0, 4, "visit our website:", TXT_STANDARD, COLOR_BLACK);
00071         AdvDlgAddText(dialog, 0, 5, "http://boolsoft.mobifiles.de", TXT_STANDARD, COLOR_WHITE);
00072         
00073         // Add button
00074         AdvDlgAddButton(dialog, 1, B_OK);
00075         
00076         // Execute dialog
00077         AdvDlgDo(dialog, DUMMY_HANDLER);
00078         
00079         // Free the dialog - this also frees all bitmaps that were added to it
00080         AdvDlgFree(dialog);
00081 
00082         GrayOff();
00083         
00084         memcpy(LCD_MEM, buffer, LCD_SIZE);
00085         free(buffer);
00086         
00087         ST_helpMsg("http://www.boolsoft.org");
00088 }
00089 

Generated on Thu Oct 4 19:42:03 2007 for Advanced Dialogs by  doxygen 1.5.1