ic-explorer/window.h

48 lines
884 B
C
Raw Normal View History

2022-08-28 14:15:17 -07:00
#ifndef IC_EXPLORER_WINDOW_H
#define IC_EXPLORER_WINDOW_H
#include <SDL.h>
#define AUTOMATIC_SCALE 0.0f
#define MAX_ZOOM 2.0f
#define ZOOM_TIME 750
#define WINDOW_STATE_NORMAL 0
#define WINDOW_STATE_ZOOMING_IN 1
#define WINDOW_STATE_ZOOMING_OUT 2
#define WINDOW_STATE_ZOOMED 3
typedef struct {
float x;
float y;
} Point;
typedef struct {
SDL_Window *obj;
SDL_Renderer *render;
SDL_Texture *background;
Point focus;
Point targetFocus;
Point startFocus;
float zoom;
int state;
double nowTime;
double lastTime;
double delta;
} Window;
Window *windowNew(const char *title, int width, int height);
void windowDelete(Window *window);
void windowDraw(Window *window);
void windowUpdate(Window *window);
void windowZoomTo(Window *window, float x, float y);
void windowZoomOut(Window *window);
#endif /* IC_EXPLORER_WINDOW_H */