Add aurora_get_backend and aurora_get_available_backends

This commit is contained in:
Luke Street 2022-08-09 18:26:44 -04:00
parent 5f06d873bc
commit 9fe0cff6e3
2 changed files with 12 additions and 1 deletions

View File

@ -2,12 +2,14 @@
#define AURORA_AURORA_H #define AURORA_AURORA_H
#ifdef __cplusplus #ifdef __cplusplus
#include <cstddef>
#include <cstdint> #include <cstdint>
extern "C" { extern "C" {
#else #else
#include "stdint.h"
#include "stdbool.h" #include "stdbool.h"
#include "stddef.h"
#include "stdint.h"
#endif #endif
typedef enum { typedef enum {
@ -72,6 +74,9 @@ const AuroraEvent* aurora_update();
bool aurora_begin_frame(); bool aurora_begin_frame();
void aurora_end_frame(); void aurora_end_frame();
AuroraBackend aurora_get_backend();
const AuroraBackend* aurora_get_available_backends(size_t* count);
#ifndef NDEBUG #ifndef NDEBUG
#define AURORA_GFX_DEBUG_GROUPS #define AURORA_GFX_DEBUG_GROUPS
#endif #endif

View File

@ -108,6 +108,7 @@ static AuroraInfo initialize(int argc, char* argv[], const AuroraConfig& config)
if (aurora_begin_frame()) { if (aurora_begin_frame()) {
g_initialFrame = true; g_initialFrame = true;
} }
g_config.desiredBackend = selectedBackend;
return { return {
.backend = selectedBackend, .backend = selectedBackend,
.configPath = g_config.configPath, .configPath = g_config.configPath,
@ -213,3 +214,8 @@ void aurora_shutdown() { aurora::shutdown(); }
const AuroraEvent* aurora_update() { return aurora::update(); } const AuroraEvent* aurora_update() { return aurora::update(); }
bool aurora_begin_frame() { return aurora::begin_frame(); } bool aurora_begin_frame() { return aurora::begin_frame(); }
void aurora_end_frame() { aurora::end_frame(); } void aurora_end_frame() { aurora::end_frame(); }
AuroraBackend aurora_get_backend() { return aurora::g_config.desiredBackend; }
const AuroraBackend* aurora_get_available_backends(size_t* count) {
*count = aurora::PreferredBackendOrder.size();
return aurora::PreferredBackendOrder.data();
}