Started working on figuring out how to properly support full screen and
high DPI
This commit is contained in:
1 parent
dbc8c88b89
commit
ffaa6e5ae7
8 files changed
+53
-22
No files matched your search
@@ -4,6 +4,7 @@
|
||||
#include "AssetManager.h"
|
||||
#include "ObjectStore.h"
|
||||
#include "SDL_pixels.h"
|
||||
#include "Window.h"
|
||||
#include "reusable_ids.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@@ -12,10 +13,12 @@
|
||||
extern "C" {
|
||||
#endif // !__cplusplus
|
||||
|
||||
bool init_engine(const char *game_name, uint32_t window_width,
|
||||
uint32_t window_height, SDL_Color window_background_color,
|
||||
bool full_screen, uint8_t audio_tracks);
|
||||
bool init_engine(const char *game_name, WindowSize window_size,
|
||||
SDL_Color window_background_color, bool full_screen,
|
||||
uint8_t audio_tracks);
|
||||
bool game_running();
|
||||
WindowSize get_window_defined_size();
|
||||
WindowSize get_window_drawable_size();
|
||||
ObjectID add_object(void *object, EventHandlerPtr eh, UpdateFuncPtr uf,
|
||||
RenderFuncPtr rf);
|
||||
void remove_object(ObjectID *id);
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
#include "SDL_events.h"
|
||||
#include "engine_build_config.h"
|
||||
#include "reusable_ids.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // !__cplusplus
|
||||
|
||||
typedef void (*EventHandlerPtr)(const SDL_Event *event, void *object);
|
||||
typedef void (*UpdateFuncPtr)(float delta, void *object);
|
||||
typedef void (*EventHandlerPtr)(void *object, const SDL_Event *event);
|
||||
typedef void (*UpdateFuncPtr)(void *object, float delta);
|
||||
typedef void (*RenderFuncPtr)(void *object);
|
||||
|
||||
typedef struct object_store ObjectStore;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "SDL_surface.h"
|
||||
#include "SDL_video.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -15,6 +16,7 @@ typedef struct renderer Renderer;
|
||||
|
||||
Renderer *create_renderer();
|
||||
bool init_renderer(Renderer *renderer, SDL_Window *window);
|
||||
void get_drawable_size(Renderer *renderer, int32_t *w, int32_t *h);
|
||||
SDL_Texture *load_texture(const Renderer *renderer, const char *path);
|
||||
void render_clear(const Renderer *renderer, SDL_Color color);
|
||||
void render_surface(const Renderer *renderer, SDL_Surface *surface, float x,
|
||||
|
||||
+9
-3
@@ -5,20 +5,26 @@
|
||||
#include "SDL.h"
|
||||
#include "SDL_pixels.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // !__cplusplus
|
||||
|
||||
typedef struct window_size {
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
} WindowSize;
|
||||
|
||||
typedef struct window {
|
||||
int width;
|
||||
int height;
|
||||
WindowSize defined_size;
|
||||
WindowSize drawable_size;
|
||||
Renderer *renderer;
|
||||
SDL_Window *SDL_base_window;
|
||||
SDL_Color background_color;
|
||||
} Window;
|
||||
|
||||
bool init_window(Window *wnd, const char *title, int width, int height,
|
||||
bool init_window(Window *wnd, const char *title, WindowSize size,
|
||||
SDL_Color color, bool full_screen);
|
||||
void clear_window(const Window *wnd);
|
||||
void swap_render_buffers(const Window *wnd);
|
||||
|
||||
Reference in new issue
Block a user