Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_gui_popup.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <allegro5/allegro_primitives.h>
#include "nilorea/n_common.h"
#include "nilorea/n_log.h"
#include "nilorea/n_gui.h"
#include "nilorea/n_gui_popup.h"
Include dependency graph for ex_gui_popup.c:

Go to the source code of this file.

Macros

#define ALLEGRO_UNSTABLE   1

Functions

static void draw (N_GUI_CTX *gui)
 draw the whole context into a memory bitmap
static void expect_true (const char *what, int ok)
 record one check
static void feed (N_GUI_CTX *gui, int type, float x, float y, int button)
 feed one mouse event
static const N_GUI_WINDOW * level_window (N_GUI_CTX *gui, const N_GUI_POPUP *popup, int level)
 a level's window, or NULL when it is not open
int main (int argc, char **argv)
static void on_pick (N_GUI_POPUP *popup, int tag, void *user_data)
 the pick callback
static int process_args (int argc, char **argv)
 read -V LOGLEVEL

Variables

static int failures = 0
static int log_level = 3
static int picked_tag = 0
static int picks = 0
 what the callback saw

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 17 of file ex_gui_popup.c.

Function Documentation

◆ draw()

void draw ( N_GUI_CTX * gui)
static

draw the whole context into a memory bitmap

Definition at line 84 of file ex_gui_popup.c.

References gui, and n_gui_draw().

Here is the call graph for this function:

◆ expect_true()

void expect_true ( const char * what,
int ok )
static

record one check

Definition at line 38 of file ex_gui_popup.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ feed()

void feed ( N_GUI_CTX * gui,
int type,
float x,
float y,
int button )
static

feed one mouse event

Definition at line 71 of file ex_gui_popup.c.

References gui, n_gui_process_event(), and type().

Here is the call graph for this function:

◆ level_window()

const N_GUI_WINDOW * level_window ( N_GUI_CTX * gui,
const N_GUI_POPUP * popup,
int level )
static

a level's window, or NULL when it is not open

Examples
ex_gui_popup.c.

Definition at line 99 of file ex_gui_popup.c.

References gui, n_gui_get_window(), n_gui_popup_window(), and n_gui_window_is_open().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

◆ on_pick()

void on_pick ( N_GUI_POPUP * popup,
int tag,
void * user_data )
static

the pick callback

Examples
ex_gui_popup.c.

Definition at line 63 of file ex_gui_popup.c.

References expect_true(), n_gui_popup_is_open(), picked_tag, and picks.

Referenced by main(), and n_gui_popup_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_args()

int process_args ( int argc,
char ** argv )
static

read -V LOGLEVEL

Definition at line 48 of file ex_gui_popup.c.

References log_level.

Variable Documentation

◆ failures

int failures = 0
static

Definition at line 32 of file ex_gui_popup.c.

◆ log_level

int log_level = 3
static

Definition at line 31 of file ex_gui_popup.c.

◆ picked_tag

int picked_tag = 0
static
Examples
ex_gui_popup.c.

Definition at line 35 of file ex_gui_popup.c.

Referenced by main(), and on_pick().

◆ picks

int picks = 0
static

what the callback saw

Examples
ex_gui_popup.c.

Definition at line 35 of file ex_gui_popup.c.

Referenced by main(), and on_pick().