#include "DeerStudio/StudioAPI/FrameBuffer.h"
#include "DeerStudio/AngelScriptEngine/AngelScriptRegisters.h"

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

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

		scriptEngine->SetDefaultNamespace("Resource");
		REGISTER_GLOBAL_FUNC("FrameBuffer createLoadRGBA8FrameBuffer(const string&in, int width, int height, int samples = 4)", StudioAPI::createLoadRGBA8FrameBuffer);
		scriptEngine->SetDefaultNamespace("");
	}
} // namespace Deer