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

Go to the source code of this file.

Macros

#define ALLEGRO_UNSTABLE   1

Functions

static void drag_right (N_GUI_CTX *gui, int x, int y, int step)
 Press at (x, y), move right in three steps of step with the button held, and release where the pointer ended.
static void expect_true (const char *label, int cond)
 Assert a condition, logging which check failed.
int main (void)
static ALLEGRO_EVENT mouse_event (int type, int x, int y)
 Build a mouse event at (x, y).
static void on_slider (int id, double value, void *data)
 Slider callback: counts the changes it is told about.

Variables

static int failures = 0
 Count of failed assertions.
static int slider_changes = 0
 How many times the slider's callback fired.

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 41 of file ex_gui_frameless_drag.c.

Function Documentation

◆ drag_right()

void drag_right ( N_GUI_CTX * gui,
int x,
int y,
int step )
static

Press at (x, y), move right in three steps of step with the button held, and release where the pointer ended.

Parameters
guiThe context.
xPress x.
yPress y.
stepPixels per motion event.
Examples
ex_gui_frameless_drag.c.

Definition at line 110 of file ex_gui_frameless_drag.c.

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

Referenced by main().

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

◆ expect_true()

void expect_true ( const char * label,
int cond )
static

Assert a condition, logging which check failed.

Parameters
labelWhat is being checked.
condNon-zero to pass.

Definition at line 63 of file ex_gui_frameless_drag.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ main()

◆ mouse_event()

ALLEGRO_EVENT mouse_event ( int type,
int x,
int y )
static

Build a mouse event at (x, y).

Parameters
typeThe ALLEGRO_EVENT_MOUSE_* type.
xCursor x.
yCursor y.
Returns
The event.

Definition at line 92 of file ex_gui_frameless_drag.c.

References type().

Here is the call graph for this function:

◆ on_slider()

void on_slider ( int id,
double value,
void * data )
static

Slider callback: counts the changes it is told about.

Parameters
idWidget id, unused.
valueNew value, unused.
dataUnused.
Examples
ex_gui_frameless_drag.c.

Definition at line 78 of file ex_gui_frameless_drag.c.

References slider_changes.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

◆ failures

int failures = 0
static

Count of failed assertions.

Definition at line 53 of file ex_gui_frameless_drag.c.

◆ slider_changes

int slider_changes = 0
static

How many times the slider's callback fired.

Examples
ex_gui_frameless_drag.c.

Definition at line 56 of file ex_gui_frameless_drag.c.

Referenced by main(), and on_slider().