triangle_group_limit_set/initcairo.h

59 lines
1.2 KiB
C
Raw Normal View History

2018-08-08 14:24:03 +00:00
#ifndef INITCAIRO_H
#define INITCAIRO_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <cairo.h>
#include <cairo-xlib.h>
2018-08-18 16:27:33 +00:00
#define STATUS_NOTHING 0
#define STATUS_REDRAW 1
#define STATUS_QUIT 2
2018-08-08 14:24:03 +00:00
typedef struct {
2018-08-17 13:41:17 +00:00
cairo_matrix_t matrix;
unsigned int width;
unsigned int height;
// these things will be written by updateDimensions()
double scalefactor;
double center_x;
double center_y;
double radius;
2019-02-03 12:18:14 +00:00
} DimensionsInfo;
2018-08-17 13:41:17 +00:00
typedef struct {
2018-08-08 14:24:03 +00:00
Display *display;
Window win;
Colormap cmap;
Atom wm_protocols;
Atom wm_delete_window;
2018-08-17 13:41:17 +00:00
cairo_surface_t *surface;
2018-08-18 16:27:33 +00:00
cairo_t *front_context;
cairo_surface_t *buffer_surface;
2019-02-03 12:18:14 +00:00
cairo_t *buffer_context;
2018-08-18 16:27:33 +00:00
unsigned char *buffer;
2018-08-08 14:24:03 +00:00
struct timeval start_time;
unsigned long frames;
double elapsed, frametime;
2019-02-03 12:18:14 +00:00
DimensionsInfo *dim;
2018-08-08 14:24:03 +00:00
} GraphicsInfo;
2018-08-17 13:41:17 +00:00
GraphicsInfo *initCairo(int screen, int mask, int width, int height, const char *name);
2018-08-08 14:24:03 +00:00
void destroyCairo(GraphicsInfo *info);
void startTimer(GraphicsInfo *info);
void waitUpdateTimer(GraphicsInfo *info);
2019-02-03 12:18:14 +00:00
int checkEvents(GraphicsInfo *info, int (*process)(GraphicsInfo*, XEvent*), void (*draw)(void *));
void updateDimensions(DimensionsInfo *ctx);
2018-08-08 14:24:03 +00:00
#endif