1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-02 22:49:22 +00:00
erc-c/include/vm_screen.h

41 lines
1.1 KiB
C
Raw Normal View History

2017-11-22 05:24:51 +00:00
#ifndef _VM_SCREEN_H_
#define _VM_SCREEN_H_
#include <stdbool.h>
#include <SDL.h>
2017-12-18 01:09:54 +00:00
#define VM_SCREEN_DEFWIDTH 800
#define VM_SCREEN_DEFHEIGHT 600
2017-12-07 03:37:14 +00:00
/*
* If you just want to plot a single pixel, you can use this macro to
* abstract away the need to indicate the x/y dimensions (as those must
* necessarily be 1x1).
*/
2017-12-17 22:42:05 +00:00
#define vm_screen_draw_pixel(screen, xpos, ypos) \
vm_screen_draw_rect(screen, xpos, ypos, 1, 1)
2017-12-07 03:37:14 +00:00
2017-11-22 05:24:51 +00:00
typedef struct {
SDL_Window *window;
SDL_Renderer *render;
SDL_Rect rect;
int xcoords;
int ycoords;
2017-12-17 22:42:05 +00:00
} vm_screen;
2017-11-22 05:24:51 +00:00
extern int vm_screen_add_window(vm_screen *, int, int);
extern void vm_screen_set_logical_coords(vm_screen *, int, int);
extern int vm_screen_xcoords(vm_screen *);
extern int vm_screen_ycoords(vm_screen *);
extern int vm_screen_init();
extern void vm_screen_finish();
2017-12-17 22:42:05 +00:00
extern void vm_screen_refresh(vm_screen *);
extern bool vm_screen_active(vm_screen *);
extern void vm_screen_draw_rect(vm_screen *, int, int, int, int);
extern void vm_screen_free(vm_screen *);
extern vm_screen *vm_screen_create();
extern void vm_screen_set_color(vm_screen *, uint8_t, uint8_t, uint8_t, uint8_t);
2017-11-22 05:24:51 +00:00
#endif