#include "DeerStudio/EditorEngine/API/FrameBuffer.h"
#include "DeerStudio/EditorEngine/ErrorHandle.h"
#include "DeerStudio/EditorEngine/API_Registration.h"
#include "DeerStudio/EditorEngine.h"
#include "angelscript.h"

namespace Deer {
    namespace EditorEngine {
        void registerFrameBufferStructs() {
            AS_CHECK(scriptEngine->RegisterObjectType("FrameBuffer", sizeof(FrameBufferStruct), 
                asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<FrameBufferStruct>() | asOBJ_APP_CLASS_ALLINTS));

        }

        void registerFrameBufferFunctions() {
            REGISTER_OBJECT_METHOD("FrameBuffer", "void clearRGBA(int, int, int, int)", FrameBufferStruct, clearRGBA);
            REGISTER_OBJECT_METHOD("FrameBuffer", "int get_height() const property", FrameBufferStruct, getHeight);
            REGISTER_OBJECT_METHOD("FrameBuffer", "void resize(int, int)", FrameBufferStruct, resize);
            REGISTER_OBJECT_METHOD("FrameBuffer", "string get_name() const property", FrameBufferStruct, getName);
            REGISTER_OBJECT_METHOD("FrameBuffer", "bool isValid()", FrameBufferStruct, isValid);
            REGISTER_EXT_OBJECT_CONSTRUCTOR("FrameBuffer", "void f()", frameBuffer_constructor);

            scriptEngine->SetDefaultNamespace("Engine");
            REGISTER_GLOBAL_FUNC("FrameBuffer createRGBA8FrameBuffer(const string&in, int, int)", createRGBA8FrameBuffer);
            REGISTER_GLOBAL_FUNC("FrameBuffer getFrameBuffer(const string&in)", getFrameBuffer);
            scriptEngine->SetDefaultNamespace("");
        }
    }
}