Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

test_img.c

Example of display_icon().
/*
 * Copyright (C) 2003 BLADOX, s.r.o.  All rights reserved.
 * 
 * This file is part of an example program for Turbo. This example
 * program may be used, distributed and modified without limitation.
 *
 */

#include <config.h>
#include <turbo/turbo.h>

#include <stdlib.h>

/* *INDENT-OFF* */

lc_char PROGMEM lc_NA[]={ 
        LC_EN("Image Size Not Supported")
        LC_CZ("Velikost obrazku nepodporovana")
        LC_END
};

lc_char PROGMEM lc_Image[]={ 
        LC_EN("Image Test")
        LC_CZ("Test obrazku")
        LC_END
};

lc_char PROGMEM lc_X[]={ 
        LC_EN("Width?")
        LC_CZ("Sirka?")
        LC_END
};

lc_char PROGMEM lc_Y[]={ 
        LC_EN("Height?")
        LC_CZ("Vyska?")
        LC_END
};

/* *INDENT-ON* */

u8 img_fnc (u16 b)
{
  return 0xFF;
}

void action_menu (void *data)
{
  u8 *res;
  u8 x;
  u8 y;
  u8 j;

  res = get_input (locale (lc_X), 1, 3, NULL, Q_GET_INPUT_DIGITS);
  if (res == ENULL || res == NULL)
    return;
  res[res[0] + 1] = '\0';
  x = atoi (&res[2]);

  res = get_input (locale (lc_Y), 1, 3, NULL, Q_GET_INPUT_DIGITS);
  if (res == ENULL || res == NULL)
    return;
  res[res[0] + 1] = '\0';
  y = atoi (&res[2]);

  display_icon (x, y, IMG_BW, img_fnc, locale (lc_NA),
                Q_DISPLAY_ICON_SELF_EXP);
}

void turbo_handler (u8 action, void *data)
{
  if (action == ACTION_INSERT_MENU)
    insert_menu (locale (lc_Image));
  else if (action == ACTION_MENU_SELECTION)
    stk_thread (action_menu, data);
}


Copyright © 2004-2006 BLADOX
Turbo version 1.2