Browse Source

Added a way to get resource path from Core, implemented in IOSCore

Ivan Safrin 10 năm trước cách đây
mục cha
commit
0258c6e655

BIN
assets/default/default.pak


+ 4 - 0
assets/default/default/BlurH.frag

@@ -1,3 +1,7 @@
+#ifdef GL_ES
+   precision mediump float;
+#endif
+
 uniform sampler2D screenTexture;
 uniform float blurSize;
 varying vec2 texCoordVar;

+ 4 - 0
assets/default/default/BlurV.frag

@@ -1,3 +1,7 @@
+#ifdef GL_ES
+   precision mediump float;
+#endif
+
 uniform sampler2D screenTexture;
 uniform float blurSize;
 varying vec2 texCoordVar;

+ 1 - 3
build/ios/TemplateApp/TemplateApp/PolycodeTemplateApp.mm

@@ -8,9 +8,7 @@
 PolycodeTemplateApp::PolycodeTemplateApp(PolycodeView *view) {
     core = new POLYCODE_CORE(view, 64,64,false,false, 0,0,60, 0, true);
     
-    NSString *str = [[NSBundle mainBundle] pathForResource: @"default" ofType: @"pak"];
-    
-    core->addFileSource("archive", [str UTF8String]);
+    core->addFileSource("archive", core->getResourcePathForFile("default.pak"));
     ResourcePool *globalPool = Services()->getResourceManager()->getGlobalPool();
     globalPool->loadResourcesFromFolder("default", true);
     

+ 1 - 0
include/polycode/core/PolyCore.h

@@ -311,6 +311,7 @@ namespace Polycode {
 
 		virtual bool systemParseFolder(const Polycode::String& pathString, bool showHidden, std::vector<OSFileEntry> &targetVector) = 0;
         
+        virtual String getResourcePathForFile(const String &fileName);
         
 		/**
 		* Sets a new video mode.

+ 2 - 0
include/polycode/core/PolyIOSCore.h

@@ -70,6 +70,8 @@ namespace Polycode {
 		unsigned int getTicks();
 		String executeExternalCommand(String command, String args, String inDirectory);
 		bool systemParseFolder(const Polycode::String& pathString, bool showHidden, std::vector<OSFileEntry> &targetVector);
+        
+        String getResourcePathForFile(const String &fileName);
 
 		void checkEvents();
 		void setDeviceSize(Number x, Number y);

+ 1 - 1
lib

@@ -1 +1 @@
-Subproject commit 1f45a39574ddda0b22c951c86b01612efda30a43
+Subproject commit cef1240e3359bc6be65a6b567c760ebe1b36937a

+ 4 - 0
src/core/PolyCore.cpp

@@ -365,6 +365,10 @@ namespace Polycode {
         }
     }
     
+    String Core::getResourcePathForFile(const String &fileName) {
+        return fileName;
+    }
+    
     void Core::removeFileSource(const String &type, const String &source) {
         for(int i=0; i < fileProviders.size(); i++) {
             if(fileProviders[i]->type == type) {

+ 8 - 1
src/core/PolyIOSCore.mm

@@ -164,7 +164,14 @@ void IOSCore::handleVideoModeChange(VideoModeChangeInfo *modeInfo) {
     
     [EAGLContext setCurrentContext:context];
     
-    
+}
+
+String IOSCore::getResourcePathForFile(const String &fileName) {    
+    NSString* fullFileName = [NSString stringWithUTF8String:fileName.c_str()];
+    NSString* fileNameNoExt = [[fullFileName lastPathComponent] stringByDeletingPathExtension];
+    NSString* extension = [fullFileName pathExtension];
+    NSString *str = [[NSBundle mainBundle] pathForResource: fileNameNoExt ofType: extension];
+    return String([str UTF8String]);
 }
 
 void IOSCore::flushRenderContext() {

+ 1 - 1
src/core/PolyOpenGLGraphicsInterface.cpp

@@ -436,7 +436,7 @@ void OpenGLGraphicsInterface::createTexture(Texture *texture) {
             break;
         case Image::IMAGE_FP16:
             glTextureType = GL_RGBA;
-            glTextureFormat = GL_RGBA16F_ARB;
+            glTextureFormat = GL_RGBA16F_EXT;
             pixelType = GL_FLOAT;
             break;
         default: