Add CMake scripts for collecting assets, switch to Vulkan inspired public api
This commit is contained in:
@@ -3,7 +3,7 @@ add_subdirectory(public)
|
||||
set(KRAKEN_PUBLIC_HEADERS "${KRAKEN_PUBLIC_HEADERS}" PARENT_SCOPE)
|
||||
|
||||
# Private Implementation
|
||||
add_sources(context.cpp)
|
||||
add_sources(kraken.cpp)
|
||||
add_sources(KRAmbientZone.cpp)
|
||||
add_sources(KRAnimation.cpp)
|
||||
add_sources(KRAnimationAttribute.cpp)
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
#include "public/context.h"
|
||||
|
||||
#include "KRContext.h"
|
||||
|
||||
namespace kraken {
|
||||
|
||||
Context* sContext = nullptr;
|
||||
|
||||
class Context::impl
|
||||
{
|
||||
public:
|
||||
impl();
|
||||
~impl();
|
||||
bool loadResource(const char* szPath);
|
||||
|
||||
private:
|
||||
KRContext mContext;
|
||||
};
|
||||
|
||||
/* static */
|
||||
Context* Context::Get()
|
||||
{
|
||||
if (!sContext) {
|
||||
sContext = new Context();
|
||||
}
|
||||
return sContext;
|
||||
}
|
||||
|
||||
Context::Context()
|
||||
{
|
||||
mImpl = new impl();
|
||||
}
|
||||
|
||||
Context::~Context()
|
||||
{
|
||||
delete mImpl;
|
||||
}
|
||||
|
||||
bool Context::loadResource(const char* szPath)
|
||||
{
|
||||
return mImpl->loadResource(szPath);
|
||||
}
|
||||
|
||||
bool Context::impl::loadResource(const char* szPath)
|
||||
{
|
||||
mContext.loadResource(szPath);
|
||||
// TODO: update KRContext::loadResource to return success/fail boolean
|
||||
return true;
|
||||
}
|
||||
|
||||
Context::impl::impl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Context::impl::~impl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}; // namespace kraken
|
||||
35
kraken/kraken.cpp
Normal file
35
kraken/kraken.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "public/kraken.h"
|
||||
|
||||
#include "KRContext.h"
|
||||
|
||||
namespace {
|
||||
|
||||
KRContext* sContext = nullptr;
|
||||
|
||||
}; // anonysmous namespace
|
||||
|
||||
KrResult KrInitialize(const KrInitializeInfo* pInitializeInfo)
|
||||
{
|
||||
if (!sContext) {
|
||||
sContext = new KRContext();
|
||||
}
|
||||
return KR_SUCCESS;
|
||||
}
|
||||
|
||||
KrResult KrShutdown()
|
||||
{
|
||||
if (sContext) {
|
||||
delete sContext;
|
||||
sContext = nullptr;
|
||||
}
|
||||
return KR_SUCCESS;
|
||||
}
|
||||
|
||||
KrResult KrLoadResource(const KrLoadResourceInfo* pLoadResourceInfo)
|
||||
{
|
||||
if (!sContext) {
|
||||
return KR_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
sContext->loadResource(pLoadResourceInfo->pResourcePath);
|
||||
return KR_SUCCESS;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// kraken.h
|
||||
// kraken
|
||||
//
|
||||
// Created by Kearwood Gilbert on 2015-11-06.
|
||||
// Copyright © 2015 Kearwood Software. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for kraken.
|
||||
FOUNDATION_EXPORT double krakenVersionNumber;
|
||||
|
||||
//! Project version string for kraken.
|
||||
FOUNDATION_EXPORT const unsigned char krakenVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <kraken/PublicHeader.h>
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
add_public_header(kraken.h)
|
||||
add_public_header(context.h)
|
||||
set(KRAKEN_PUBLIC_HEADERS "${KRAKEN_PUBLIC_HEADERS}" PARENT_SCOPE)
|
||||
|
||||
@@ -33,4 +33,34 @@
|
||||
|
||||
#include "context.h"
|
||||
|
||||
#define KR_NULL_HANDLE 0
|
||||
|
||||
typedef enum {
|
||||
KR_SUCCESS = 0,
|
||||
KR_ERROR_NOT_INITIALIZED = 1,
|
||||
KR_ERROR_WRONG_THREAD = 2,
|
||||
KR_RESULT_MAX_ENUM = 0x7FFFFFFF
|
||||
} KrResult;
|
||||
|
||||
typedef enum {
|
||||
KR_STRUCTURE_TYPE_INITIALIZE = 0,
|
||||
KR_STRUCTURE_TYPE_SHUTDOWN = 1,
|
||||
KR_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} KrStructureType;
|
||||
|
||||
typedef struct {
|
||||
KrStructureType sType;
|
||||
void* pNext;
|
||||
} KrInitializeInfo;
|
||||
|
||||
typedef struct {
|
||||
KrStructureType sType;
|
||||
void* pNext;
|
||||
const char* pResourcePath;
|
||||
} KrLoadResourceInfo;
|
||||
|
||||
KrResult KrInitialize(const KrInitializeInfo* pInitializeInfo);
|
||||
KrResult KrShutdown();
|
||||
KrResult KrLoadResource(const KrLoadResourceInfo* pLoadResourceInfo);
|
||||
|
||||
#endif // KRAKEN_H
|
||||
|
||||
Reference in New Issue
Block a user