Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_gui_curve.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_curve.h"
Include dependency graph for ex_gui_curve.c:

Go to the source code of this file.

Macros

#define ALLEGRO_UNSTABLE   1
#define AT_X(cx)
 the editor sits at 50,50 and is 200 by 100: display position of a curve coordinate
#define AT_Y(cy)
 as AT_X, for y

Functions

static void background (float x, float y, float w, float h, void *user_data)
 a background
static void drag (N_GUI_CTX *gui, float fx, float fy, float tx, float ty)
 press, drag to, release
static void expect_true (const char *what, int ok)
 record one check
static void feed (N_GUI_CTX *gui, int type, int x, int y, int button)
 feed one mouse event at display coordinates
static float flat (const float *xs, const float *ys, int count, float x, void *user_data)
 a caller's own curve: flat
int main (int argc, char **argv)
static int near (float a, float b)
 is a near b
static void on_change (int widget_id, int dragging, void *user_data)
 change callback
static int process_args (int argc, char **argv)
 read -V LOGLEVEL
static void right (N_GUI_CTX *gui, float cx, float cy)
 right press

Variables

static int background_drawn = 0
 did the background draw
static int changes = 0
 changes seen: all of them, and those that were drag steps
static int drag_changes = 0
static int failures = 0
static int log_level = 3

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 16 of file ex_gui_curve.c.

◆ AT_X

#define AT_X ( cx)
Value:
((int)(50.0f + (cx) * 200.0f + 0.5f))

the editor sits at 50,50 and is 200 by 100: display position of a curve coordinate

Definition at line 102 of file ex_gui_curve.c.

◆ AT_Y

#define AT_Y ( cy)
Value:
((int)(50.0f + (1.0f - (cy)) * 100.0f + 0.5f))

as AT_X, for y

Definition at line 104 of file ex_gui_curve.c.

Function Documentation

◆ background()

void background ( float x,
float y,
float w,
float h,
void * user_data )
static

a background

Examples
ex_gui_curve.c.

Definition at line 81 of file ex_gui_curve.c.

References background_drawn.

Referenced by main(), and n_gui_md_style_default().

Here is the caller graph for this function:

◆ drag()

void drag ( N_GUI_CTX * gui,
float fx,
float fy,
float tx,
float ty )
static

press, drag to, release

Definition at line 107 of file ex_gui_curve.c.

References AT_X, AT_Y, feed(), and gui.

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 39 of file ex_gui_curve.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ feed()

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

feed one mouse event at display coordinates

Definition at line 88 of file ex_gui_curve.c.

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

Here is the call graph for this function:

◆ flat()

float flat ( const float * xs,
const float * ys,
int count,
float x,
void * user_data )
static

a caller's own curve: flat

Examples
ex_gui_curve.c, and ex_gui_round.c.

Definition at line 71 of file ex_gui_curve.c.

Referenced by main(), and run().

Here is the caller graph for this function:

◆ main()

◆ near()

int near ( float a,
float b )
static

is a near b

Definition at line 122 of file ex_gui_curve.c.

◆ on_change()

void on_change ( int widget_id,
int dragging,
void * user_data )
static

change callback

Definition at line 63 of file ex_gui_curve.c.

References changes, and drag_changes.

◆ process_args()

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

read -V LOGLEVEL

Definition at line 49 of file ex_gui_curve.c.

References log_level.

◆ right()

void right ( N_GUI_CTX * gui,
float cx,
float cy )
static

right press

Examples
ex_gui_curve.c, and ex_gui_label_lines.c.

Definition at line 115 of file ex_gui_curve.c.

References AT_X, AT_Y, feed(), and gui.

Referenced by _datagrid_header_hit(), _set_clipping_rect_transformed(), heap_pop(), main(), n_gui_tree_draw_overlay(), parse_and(), parse_or(), and rule_align().

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

Variable Documentation

◆ background_drawn

int background_drawn = 0
static

did the background draw

Examples
ex_gui_curve.c.

Definition at line 36 of file ex_gui_curve.c.

Referenced by background(), and main().

◆ changes

int changes = 0
static

changes seen: all of them, and those that were drag steps

Definition at line 34 of file ex_gui_curve.c.

◆ drag_changes

int drag_changes = 0
static

Definition at line 34 of file ex_gui_curve.c.

◆ failures

int failures = 0
static

Definition at line 31 of file ex_gui_curve.c.

◆ log_level

int log_level = 3
static

Definition at line 30 of file ex_gui_curve.c.