Skip to content

Instantly share code, notes, and snippets.

@jsimmons
Created May 15, 2012 02:01
Show Gist options
  • Select an option

  • Save jsimmons/2698514 to your computer and use it in GitHub Desktop.

Select an option

Save jsimmons/2698514 to your computer and use it in GitHub Desktop.
SGL Core headers
#ifndef SGL_EVENT_H
#define SGL_EVENT_H
#include <stdint.h>
#include "button.h"
struct _SWindow;
typedef enum
{
S_UNKNOWN_EVENT,
S_BUTTON_PRESS_EVENT,
S_BUTTON_RELEASE_EVENT,
S_MOUSE_EVENT,
S_RESIZE_EVENT,
S_CLOSE_EVENT,
} SEventType;
typedef struct
{
int x;
int y;
uint32_t character;
SButton button;
SModifier modifiers;
} SButtonEventData;
typedef struct
{
int x;
int y;
} SMouseEventData;
typedef struct
{
int x, y;
int width, height;
} SResizeEventData;
typedef struct
{
SEventType type;
union
{
SButtonEventData button;
SMouseEventData mouse;
SResizeEventData resize;
} data;
} SEvent;
int sgl_window_get_event(struct _SWindow *window, SEvent *event);
#endif
#ifndef SGL_CONTEXT_H
#define SGL_CONTEXT_H
#include <stdbool.h>
struct SWindowImpl;
typedef struct _SWindow
{
struct SWindowImpl *impl;
} SWindow;
typedef struct
{
int screen_width;
int screen_height;
int gl_version_major;
int gl_version_minor;
} SWindowOptions;
bool sgl_window(SWindow *window, SWindowOptions *options);
void sgl_window_swap(SWindow *window);
void sgl_window_destroy(SWindow *window);
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment