![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
#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_colorwheel.h"Go to the source code of this file.
Macros | |
| #define | ALLEGRO_UNSTABLE 1 |
| #define | AT_X(u) |
| the wheel sits at 50,50 and is 200 by 200, its disc of radius 98 centred at 150,150: display position of a wheel coordinate | |
| #define | AT_Y(v) |
| as AT_X, for v, which goes up | |
Functions | |
| static void | drag (N_GUI_CTX *gui, float fu, float fv, float tu, float tv) |
| press at one point, drag to another, release | |
| static void | expect_true (const char *what, int ok) |
| count a failed check | |
| static void | feed (N_GUI_CTX *gui, int type, int x, int y, int button) |
| feed one mouse event at display coordinates | |
| static ALLEGRO_COLOR | grey (float u, float v, void *user_data) |
| a caller's colour: grey everywhere | |
| int | main (int argc, char **argv) |
| run the checks | |
| 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 | |
Variables | |
| static int | changes = 0 |
| changes seen, and those while dragging | |
| static int | colour_asked = 0 |
| set when the caller's colour was asked for | |
| static int | drag_changes = 0 |
| static int | failures = 0 |
| failed checks | |
| static int | log_level = 3 |
| log level from -V | |
| #define ALLEGRO_UNSTABLE 1 |
Definition at line 29 of file ex_gui_colorwheel.c.
| #define AT_X | ( | u | ) |
the wheel sits at 50,50 and is 200 by 200, its disc of radius 98 centred at 150,150: display position of a wheel coordinate
Definition at line 125 of file ex_gui_colorwheel.c.
| #define AT_Y | ( | v | ) |
as AT_X, for v, which goes up
Definition at line 127 of file ex_gui_colorwheel.c.
|
static |
press at one point, drag to another, release
| gui | the GUI |
| fu | from, across |
| fv | from, up |
| tu | to, across |
| tv | to, up |
Definition at line 135 of file ex_gui_colorwheel.c.
References AT_X, AT_Y, feed(), and gui.
Referenced by main().
|
static |
|
static |
feed one mouse event at display coordinates
| gui | the GUI |
| type | the Allegro event type |
| x | display x |
| y | display y |
| button | the button |
Definition at line 111 of file ex_gui_colorwheel.c.
References gui, n_gui_process_event(), and type().
Referenced by drag(), drag(), main(), and right().
|
static |
a caller's colour: grey everywhere
| u | across |
| v | up |
| user_data | unused |
Definition at line 97 of file ex_gui_colorwheel.c.
References colour_asked.
Referenced by main(), and n_gui_draw_color_swatch().
| int main | ( | int | argc, |
| char ** | argv ) |
run the checks
| argc | argument count |
| argv | arguments |
Definition at line 154 of file ex_gui_colorwheel.c.
References AT_X, AT_Y, changes, colour_asked, drag(), drag_changes, expect_true(), failures, feed(), font, grey(), gui, LOG_ERR, log_level, n_gui_add_label(), n_gui_add_window(), N_GUI_ALIGN_LEFT, n_gui_colorwheel_get(), n_gui_colorwheel_hue(), n_gui_colorwheel_new(), n_gui_colorwheel_set(), n_gui_colorwheel_set_colour(), n_gui_destroy_ctx(), n_gui_draw(), n_gui_new_ctx(), n_gui_open_window(), n_gui_set_display_size(), n_gui_set_double_click_time(), N_GUI_WIN_FRAMELESS, n_gui_window_set_flags(), n_log, near(), on_change(), process_args(), set_log_level(), and wheel().
|
static |
is a near b
| a | one |
| b | the other |
Definition at line 146 of file ex_gui_colorwheel.c.
Referenced by main().
|
static |
change callback
| widget_id | the wheel |
| dragging | set while the button is held |
| user_data | unused |
Definition at line 85 of file ex_gui_colorwheel.c.
References changes, and drag_changes.
|
static |
read -V
| argc | argument count |
| argv | arguments |
Definition at line 68 of file ex_gui_colorwheel.c.
References log_level.
|
static |
changes seen, and those while dragging
Definition at line 48 of file ex_gui_colorwheel.c.
|
static |
set when the caller's colour was asked for
Definition at line 50 of file ex_gui_colorwheel.c.
|
static |
Definition at line 48 of file ex_gui_colorwheel.c.
Referenced by main(), on_change(), and on_change().
|
static |
failed checks
Definition at line 46 of file ex_gui_colorwheel.c.
|
static |
log level from -V
Definition at line 44 of file ex_gui_colorwheel.c.