//
// Polycode template. Write your code here.
// 

#include "PolycodeTemplateApp.h"


PolycodeTemplateApp::PolycodeTemplateApp(PolycodeView *view) {
    core = new POLYCODE_CORE(view, 1280,720,false,false, 0,0,60);
    
    //core->addFileSource("archive", "default.pak");
    ResourcePool *globalPool = Services()->getResourceManager()->getGlobalPool();
    globalPool->loadResourcesFromFolder("default", true);
    
	SceneLabel::createMipmapsForLabels = false;

	MaterialManager *materialManager = Services()->getMaterialManager();

	// Write your code here!
    
    Scene *scene = new Scene(Scene::SCENE_2D);
    scene->useClearColor = true;
    
    ScenePrimitive *test = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 0.5, 0.5);
    test->setMaterialByName("Unlit");
	test->getShaderPass(0).shaderBinding->loadTextureForParam("diffuse", "white.png");
    scene->addChild(test);

	Sound *bgSound = new Sound("bedlayer_main.wav");

	bgSound->Play(true);
}

PolycodeTemplateApp::~PolycodeTemplateApp() {
    
}

bool PolycodeTemplateApp::Update() {
    return core->updateAndRender();
}