brewpanel/sdlgui.h

Sat, 25 Apr 2020 20:31:31 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 25 Apr 2020 20:31:31 +0200
changeset 605
e00f8ff4de9a
parent 443
6b80a37fdf8d
child 637
21e542c15832
permissions
-rw-r--r--

Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.

#ifndef _SDLGUI_H
#define _SDLGUI_H

#ifdef HAVE_SDL_SDL_H

enum
{
  SGBOX,
  SGTEXT,
  SGTTF,
  SGBUTTON,
  SGLCD,
  SGLEDRED,
  SGLEDGREEN,
  SGLEDBLUE,
  SGLEDYELLOW
};


/* Object flags: */
#define SG_TOUCHEXIT		 1   /* Exit immediately when mouse button is pressed down */
#define SG_EXIT			 2   /* Exit when mouse button has been pressed (and released) */
#define SG_DEFAULT		 4   /* Marks a default button, selectable with return key */
#define SG_CANCEL		 8   /* Marks a cancel button, selectable with ESC key */
#define SG_HIDE			16   /* Button is inactive */

/* Object states: */
#define SG_SELECTED		 1
#define	SG_LCD_BLINK		 2
#define	SG_LCD_CURSOR		 4
#define	SG_LCD_DISPLAY		 8
#define	SG_LCD_BLIGHT		16

/* Return codes: */
#define SDLGUI_ERROR		-1
#define SDLGUI_QUIT		-2
#define SDLGUI_UNKNOWNEVENT	-3


typedef struct
{
    int		type;			/* What type of object */
    int		flags;			/* Object flags */
    int		state;			/* Object state */
    int		x, y;			/* The offset to the upper left corner */
    int		w, h;			/* Width and height */
    char	*txt;			/* Text string */
}  SGOBJ;



void SDLGui_LED(SGOBJ *dlg, int fd, int LED, int on);
void SDLGui_Cursor(SGOBJ *dlg, int fd, int x, int y, int on, int blink);
void SDLGui_CGChar(SGOBJ *dlg, int fd, int x, int y, Uint8 dataf[8]);
void SDLGui_Char(SGOBJ *dlg, int fd, int x, int y, Uint8 c);
void SDLGui_DrawLCD(SGOBJ *bdlg, int objnum);
int  SDLGui_Init(void);
int  SDLGui_UnInit(void);
int  SDLGui_SetScreen(SDL_Surface *pScrn);
void SDLGui_DrawDialog(SGOBJ *dlg);
int  SDLGui_DoDialogInit(SGOBJ *dlg);
int  SDLGui_DoDialogLoop(SGOBJ *dlg);
void SDLGui_DoDialogEnd(void);
void SDLGui_CenterDlg(SGOBJ *dlg);
int  SDLGui_LCDinit(SGOBJ *dlg, int *x, int *y, int *w, int *h, int *cols, int *rows, int lcdindex);
void SDLGui_LCDwrite(SGOBJ *dlg, int fd, int x, int y, Uint8 c, int lcdindex);

#endif

#endif

mercurial