libelec
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
|
Go to the source code of this file.
Functions | |
void | libelec_draw_layout (const elec_sys_t *sys, cairo_t *cr, double pos_scale, double font_sz) |
void | libelec_draw_comp_info (const elec_comp_t *comp, cairo_t *cr, double pos_scale, double font_sz, vect2_t pos) |
This file contains drawing routines utilizing the cairo graphics API, which let you draw a picture of the network layout into a cairo_surface_t
. If you are using X-Plane, see libelec_vis.h
for a fully functional visualizer, with mouse dragging & zoom support, as well as X-Plane window system integration. If you want to use the library outside of X-Plane, the functions contained in this file will give you the same visual style as libelec_vis.h
, but you will need to supply your own windowing, compositing and mouse interaction implementations.
Definition in file libelec_drawing.h.
void libelec_draw_comp_info | ( | const elec_comp_t * | comp, |
cairo_t * | cr, | ||
double | pos_scale, | ||
double | font_sz, | ||
vect2_t | pos | ||
) |
Draws a "component info" overlay window for a particular component. This should be called if you want to draw a popup showing additional information about a particular component.
Definition at line 1523 of file libelec_drawing.c.
void libelec_draw_layout | ( | const elec_sys_t * | sys, |
cairo_t * | cr, | ||
double | pos_scale, | ||
double | font_sz | ||
) |
Draws the network base image into a cairo_t
instance. You should use this before drawing any overlays (such as an open component info screen drawn using libelec_draw_comp_info()).
sys | The network to be drawn. |
cr | The cairo_t instance into which the drawing will be performed. |
pos_scale | A scaling multiplier applied to all GUI_POS stanzas in the network layout configuration file. This lets you use abstract size units in the config file and then scale them up as you see fit. |
font_sz | Default font size to be used for all drawing. These functions never reset the font face, so whatever you set using cairo_set_font_face() will be used. The font size is only needed in order to draw suffixes and smaller font information correctly scaled to the default text size (which is used for headers, etc.) |
Definition at line 898 of file libelec_drawing.c.