40 lines
904 B
C
40 lines
904 B
C
#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>
|
|
|
|
typedef struct {
|
|
Display *display;
|
|
Window win;
|
|
Colormap cmap;
|
|
Atom wm_protocols;
|
|
Atom wm_delete_window;
|
|
cairo_surface_t *sfc;
|
|
cairo_t *ctx;
|
|
struct timeval start_time;
|
|
unsigned long frames;
|
|
double elapsed, frametime;
|
|
unsigned int width;
|
|
unsigned int height;
|
|
cairo_matrix_t matrix;
|
|
double scalefactor;
|
|
} GraphicsInfo;
|
|
|
|
int initCairo(int screen, int mask, int width, int height, const char *name, GraphicsInfo *info);
|
|
void destroyCairo(GraphicsInfo *info);
|
|
|
|
void startTimer(GraphicsInfo *info);
|
|
void waitUpdateTimer(GraphicsInfo *info);
|
|
int checkEvents(GraphicsInfo *info, int (*process)(GraphicsInfo*, XEvent*, void*), void (*draw)(void*), void *data);
|
|
|
|
#endif
|