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:

/*
        Advanved Dialogs v1.0.7 - Example program
        Copyright (C) 2005-2008 Jonas Gehring

        Advanced Dialogs is free software; you can redistribute it and/or modify
        it under the terms of the GNU Lesser General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        Advanced Dialogs is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU Lesser General Public License for more details.

        You should have received a copy of the GNU Lesser General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


// C Source File
// Created 18.01.2006; 06:45:10



#include <tigcclib.h>                                   // Include all standard header files

#include <extgraph.h>                                   // Include ExtGraph v2.00beta5 by TI-Chess Team
#include <AdvDialogs.h>                                 // Powered by Advanced Dialogs v1.0.7

#include "adlogo.h"                                     // Advanced Dialogs logo (image data)


// Main Function
void _main(void)
{
        void *buffer;
        
        // Allocate space for the LCD buffer
        if ((buffer = malloc(LCD_SIZE)) == NULL)
        {
                return;
        }

        memcpy(buffer, LCD_MEM, LCD_SIZE);
        
        if (!GrayOn())                                                  // Turn on grayscale graphics
        {
                free(buffer);
                return;
        }

        memcpy(GrayGetPlane(LIGHT_PLANE), buffer, LCD_SIZE);
        memcpy(GrayGetPlane(DARK_PLANE), buffer, LCD_SIZE);

        // Create dialog
        ADVDIALOG *dialog = AdvDlgNew(135, 68, "Advanced Dialogs", FALSE);
        
        // Create bitmap
        ADVBITMAP *bitmap = AdvDlgBitmapNew(64, 28, adlogo2, adlogo1);

        // Add bitmap to the dialog
        if (bitmap != NULL)
        {
                AdvDlgAddBitmap(dialog, 0, 2, 9, bitmap);
        }

        // Add text to the dialog
        AdvDlgAddText(dialog, 0, 0, "Advanced Dialogs", TXT_ALIGNRIGHT, COLOR_BLACK);
        AdvDlgAddText(dialog, 0, 1, "version "ADVDLG_VERSION_STR, TXT_ALIGNRIGHT, COLOR_BLACK);
        AdvDlgAddText(dialog, 0, 4, "visit our website:", TXT_STANDARD, COLOR_BLACK);
        AdvDlgAddText(dialog, 0, 5, "http://www.boolsoft.org", TXT_STANDARD, COLOR_WHITE);
        
        // Add button
        AdvDlgAddButton(dialog, 1, B_OK);
        
        // Execute dialog
        AdvDlgDo(dialog, DUMMY_HANDLER);
        
        // Free the dialog - this also frees all bitmaps that were added to it
        AdvDlgFree(dialog);

        GrayOff();
        
        memcpy(LCD_MEM, buffer, LCD_SIZE);
        free(buffer);
        
        ST_helpMsg("http://www.boolsoft.org");
}


Generated on Wed Nov 5 09:46:56 2008 for Advanced Dialogs by  doxygen 1.5.7.1