Added logging and X11 Keymap translation. Also various bugfixes.

This commit is contained in:
Patrick 2025-10-04 16:38:45 +02:00
commit 54a0f5eb4e
16 changed files with 181 additions and 57 deletions

View file

@ -2,7 +2,9 @@
#define PGPL_H
#include <pgpl/gui.h>
#include <pgpl/log.h>
#include <pgpl/render.h>
#include <pgpl/string.h>
#include <pgpl/thread.h>
#include <pgpl/timer.h>
#include <pgpl/vector.h>

27
include/pgpl/log.h Normal file
View file

@ -0,0 +1,27 @@
#ifndef PGPL_LOG_H
#define PGPL_LOG_H
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum PGPL_LogLevel {
PGPL_LOG_LEVEL_DEBUG,
PGPL_LOG_LEVEL_INFO,
PGPL_LOG_LEVEL_WARN,
PGPL_LOG_LEVEL_ERROR,
} PGPL_LogLevel;
void pgpl_log_set_minimum_level(PGPL_LogLevel level);
void pgpl_log_output_file(FILE *file);
void pgpl_log_message(PGPL_LogLevel level, const char *message, ...);
#ifdef __cplusplus
}
#endif
#endif

18
include/pgpl/string.h Normal file
View file

@ -0,0 +1,18 @@
#ifndef PGPL_STRING_H
#define PGPL_STRING_H
#include <wchar.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Converts a string to a wide string, don't forget to call free() on the
* returned pointer. */
wchar_t *pgpl_string_to_wide_string(const char *str);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -18,7 +18,7 @@ typedef struct PGPL_Window PGPL_Window;
/* This is an input event which is returned on PGPL_WINDOW_EVENT_KEY_* and
* PGPL_WINDOW_EVENT_MOUSE_* events. */
typedef struct PGPL_WindowInputEvent {
uint32_t key;
int32_t key;
int32_t x;
int32_t y;
} PGPL_WindowInputEvent;