Files
Gryphn/projects/core/src/instance/gryphn_instance.c
2025-06-26 14:13:24 -04:00

28 lines
976 B
C

#include "gryphn_instance.h"
#include "instance/gryphn_instance.h"
#include <loader/src/gryphn_instance_functions.h>
#include "loader/src/gryphn_loader.h"
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
*instance = malloc(sizeof(struct gnInstance_t));
(*instance)->layers = loaderLayerArrayListCreate();
// load the API layers (this will)
loaderInfo loadInfo = {
.api = info.renderingAPI,
.layerToLoad = api_layer
};
loaderLayerArrayListAdd(&(*instance)->layers, loadLayer(loadInfo));
// i hate this line of code but im not fixing it
(*instance)->callingLayer = &(*instance)->layers.data[(*instance)->layers.count - 1];
(*instance)->debugger = info.debugger;
return (*instance)->callingLayer->instanceFunctions._gnCreateInstance((*instance), info);
}
void gnDestroyInstance(gnInstanceHandle instance) {
instance->callingLayer->instanceFunctions._gnDestroyInstance(instance);
}