瀏覽代碼

Started on a Raspberry Pi core

Ivan Safrin 10 年之前
父節點
當前提交
28904ffe28

+ 5 - 0
.gitignore

@@ -1,5 +1,10 @@
 # Created by https://www.gitignore.io
 
+*.o
+build/linux/TemplateApp/PolycodeTemplate
+build/linux/TemplateApp/default
+build/linux/TemplateApp/default.pak
+
 docs/cldoc
 
 ### Windows ###

File diff suppressed because it is too large
+ 3 - 0
build/linux/Makefile


+ 10 - 0
build/linux/TemplateApp/PolycodeTemplate.cpp

@@ -0,0 +1,10 @@
+#include "PolycodeTemplateApp.h"
+
+
+int main(int argc, char **argv) {
+	PolycodeView *view = new PolycodeView();
+	PolycodeTemplateApp *app = new PolycodeTemplateApp(view);
+	while(app->Update()) {
+	}
+	return 0;
+}

+ 72 - 0
build/linux/TemplateApp/PolycodeTemplateApp.cpp

@@ -0,0 +1,72 @@
+//
+// Polycode template. Write your code here.
+// 
+
+#include "PolycodeTemplateApp.h"
+
+
+PolycodeTemplateApp::PolycodeTemplateApp(PolycodeView *view) {
+    core = new POLYCODE_CORE(view, 800,480,false,false, 0,0,60);
+    
+  //  core->addFileSource("archive", "default.pak");
+    ResourcePool *globalPool = Services()->getResourceManager()->getGlobalPool();
+    globalPool->loadResourcesFromFolder("default", true);
+    
+	// 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", "main_icon.png");
+    scene->addChild(test);
+	test->setPositionY(0.2);
+    
+    SceneLabel *testLabel = new SceneLabel("Hello Polycode!", 32, "sans", Label::ANTIALIAS_FULL, 0.2);
+	testLabel->setPositionY(-0.2);
+    scene->addChild(testLabel);
+    
+/*
+    bgSound = new Sound("bedlayer_main.wav");
+    bgSound->Play();
+//    bgSound->setPitch(10.0);
+    
+    
+    sound1 = new Sound("marimba-lo.wav");
+    
+    sound1->setPitch(2.3);
+    
+    sound2 = new Sound("initial_touch_01.wav");
+    sound3 = new Sound("curve_02_c.wav");
+    
+    //sound2->Play(true);
+  */
+  
+    Services()->getInput()->addEventListener(this, InputEvent::EVENT_KEYDOWN);
+}
+
+void PolycodeTemplateApp::handleEvent(Event *event) {
+    InputEvent *inputEvent = (InputEvent*) event;
+    
+    switch(inputEvent->getKey()) {
+        case KEY_z:
+            sound1->Play(true);
+        break;
+        case KEY_x:
+            sound2->Play();
+        break;
+        case KEY_c:
+            sound3->Play();
+        break;
+            
+    }
+}
+
+PolycodeTemplateApp::~PolycodeTemplateApp() {
+    
+}
+
+bool PolycodeTemplateApp::Update() {
+    return core->updateAndRender();
+}

+ 27 - 0
build/linux/TemplateApp/PolycodeTemplateApp.h

@@ -0,0 +1,27 @@
+//
+// Polycode template. Write your code here.
+//
+
+#include "Polycode.h"
+
+using namespace Polycode;
+
+class PolycodeTemplateApp : public EventHandler {
+public:
+    PolycodeTemplateApp(PolycodeView *view);
+    ~PolycodeTemplateApp();
+    
+    void handleEvent(Event *event);
+    
+    bool Update();
+    
+private:
+    
+    Sound *bgSound;
+    
+    Sound *sound1;
+    Sound *sound2;
+    Sound *sound3;
+    
+    Core *core;
+};

二進制
build/linux/TemplateApp/main_icon.png


+ 6 - 2
include/Polycode.h

@@ -95,10 +95,14 @@
     #if defined(_WINDOWS) && !defined(_MINGW)
         #include "polycode/core/PolyWinCore.h"
     #else
-		#if (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+		#if defined(WINAPI_FAMILY)
 			#include "polycode/core/PolyUWPCore.h"
 		#else
-			#include "polycode/core/PolySDLCore.h"
+			#ifdef RPI_CORE
+				#include "polycode/core/PolyRPICore.h"
+			#else
+				#include "polycode/core/PolySDLCore.h"
+			#endif
 		#endif
     #endif
 #endif

+ 0 - 0
include/EGL/egl.h → include/angle/EGL/egl.h


+ 0 - 0
include/EGL/eglext.h → include/angle/EGL/eglext.h


+ 0 - 0
include/EGL/eglplatform.h → include/angle/EGL/eglplatform.h


+ 0 - 0
include/GL/glext.h → include/angle/GL/glext.h


+ 0 - 0
include/GL/wglext.h → include/angle/GL/wglext.h


+ 0 - 0
include/GLES2/gl2.h → include/angle/GLES2/gl2.h


+ 0 - 0
include/GLES2/gl2ext.h → include/angle/GLES2/gl2ext.h


+ 0 - 0
include/GLES2/gl2platform.h → include/angle/GLES2/gl2platform.h


+ 0 - 0
include/GLES3/gl3.h → include/angle/GLES3/gl3.h


+ 0 - 0
include/GLES3/gl3ext.h → include/angle/GLES3/gl3ext.h


+ 0 - 0
include/GLES3/gl3platform.h → include/angle/GLES3/gl3platform.h


+ 0 - 0
include/GLSLANG/ShaderLang.h → include/angle/GLSLANG/ShaderLang.h


+ 0 - 0
include/GLSLANG/ShaderVars.h → include/angle/GLSLANG/ShaderVars.h


+ 0 - 0
include/KHR/khrplatform.h → include/angle/KHR/khrplatform.h


+ 0 - 0
include/angle_gl.h → include/angle/angle_gl.h


+ 0 - 0
include/angle_windowsstore.h → include/angle/angle_windowsstore.h


+ 9 - 3
include/polycode/core/PolyOpenGLGraphicsInterface.h

@@ -45,9 +45,15 @@ THE SOFTWARE.
 		#include <angle_windowsstore.h>
 	#endif
 #else	
-	#include <GL/gl.h>
-	#include <GL/glu.h>
-	#include <GL/glext.h>
+	#if defined(USE_EGL)
+		#include <EGL/egl.h>
+		#include <EGL/eglext.h>
+		#include <GLES2/gl2.h>
+	#else
+		#include <GL/gl.h>
+		#include <GL/glu.h>
+		#include <GL/glext.h>
+	#endif
 #endif
 
 namespace Polycode {

+ 133 - 0
include/polycode/core/PolyRPICore.h

@@ -0,0 +1,133 @@
+
+/*
+Copyright (C) 2015 by Ivan Safrin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#pragma once
+
+#include <stdio.h>
+#include <assert.h>
+#include <math.h>
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <GLES2/gl2.h>
+
+#include <bcm_host.h>
+
+#include "polycode/core/PolyGlobals.h"
+#include "polycode/core/PolyCore.h"
+#include "polycode/core/PolyInputEvent.h"
+
+
+#define POLYCODE_CORE RPICore
+
+namespace Polycode {
+
+	class PolycodeView {
+	public:
+	};
+
+	class RPIEvent {
+	public:
+		int eventGroup;
+		int eventCode;
+
+		int mouseX;
+		int mouseY;
+
+		std::vector<TouchInfo> touches;
+		TouchInfo touch;
+
+		PolyKEY keyCode;
+		wchar_t unicodeChar;
+
+		char mouseButton;
+
+		static const int EVENTBASE_PLATFORMEVENT = 0x300;
+		static const int INPUT_EVENT = EVENTBASE_PLATFORMEVENT + 0;
+		static const int SYSTEM_FOCUS_EVENT = EVENTBASE_PLATFORMEVENT + 1;
+	};
+
+
+	class RPICoreMutex : public CoreMutex {
+	public:
+		void lock();
+		void unlock();
+		pthread_mutex_t pMutex;
+	};
+
+	class OpenGLGraphicsInterface;
+
+	class _PolyExport RPICore : public Core {
+	public:
+
+		RPICore(PolycodeView *view, int xRes, int yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, int frameRate, int monitorIndex = -1, bool retinaSupport = false);
+		~RPICore();
+
+		void Render();
+		bool systemUpdate();
+		void setCursor(int cursorType);
+		void createThread(Threaded *target);
+		CoreMutex *createMutex();
+		void copyStringToClipboard(const String& str);
+		String getClipboardString();
+		void createFolder(const String& folderPath);
+		void copyDiskItem(const String& itemPath, const String& destItemPath);
+		void moveDiskItem(const String& itemPath, const String& destItemPath);
+		void removeDiskItem(const String& itemPath);
+		String openFolderPicker();
+		std::vector<String> openFilePicker(std::vector<CoreFileExtension> extensions, bool allowMultiple);
+		String saveFilePicker(std::vector<CoreFileExtension> extensions);
+		void handleVideoModeChange(VideoModeChangeInfo *modeInfo);
+		void flushRenderContext();
+		void openURL(String url);
+		unsigned int getTicks();
+		String executeExternalCommand(String command, String args, String inDirectory);
+		bool systemParseFolder(const Polycode::String& pathString, bool showHidden, std::vector<OSFileEntry> &targetVector);
+
+		void handleSystemEvent(RPIEvent systemEvent);
+		void checkEvents();
+		void setDeviceSize(Number x, Number y);
+
+		Number getBackingXRes();
+		Number getBackingYRes();
+
+	private:
+
+		Number deviceWidth;
+		Number deviceHeight;
+
+		int lastMouseY;
+		int lastMouseX;
+
+		EGLDisplay display;
+		EGLSurface surface;
+		EGLContext context;
+
+		std::vector<RPIEvent> systemInputEvents;
+
+		double pcFreq;
+
+		OpenGLGraphicsInterface *graphicsInterface;
+
+	};
+}

+ 3 - 1
src/core/PolyOpenGLGraphicsInterface.cpp

@@ -390,7 +390,9 @@ void OpenGLGraphicsInterface::createTexture(Texture *texture) {
         case Texture::FILTERING_LINEAR:
             
             if(texture->anisotropy > 0) {
+#ifndef STRICT_OPENGLES2
                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, texture->anisotropy);
+#endif
             }
             
             glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -738,4 +740,4 @@ int OpenGLGraphicsInterface::getPolycodeParamType(int glType) {
             return ProgramParam::PARAM_UNKNOWN;
         break;
     }
-}
+}

+ 366 - 0
src/core/PolyRPICore.cpp

@@ -0,0 +1,366 @@
+
+/*
+Copyright (C) 2015 by Ivan Safrin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#include "polycode/core/PolyRPICore.h"
+#include "polycode/core/PolyBasicFileProvider.h"
+#include "polycode/core/PolyOpenGLGraphicsInterface.h"
+
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+using namespace Polycode;
+
+void RPICoreMutex::lock() {
+    pthread_mutex_lock(&pMutex);    
+}
+
+void RPICoreMutex::unlock() {
+    pthread_mutex_unlock(&pMutex);
+}
+
+
+RPICore::RPICore(PolycodeView *view, int xRes, int yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, int frameRate, int monitorIndex, bool retinaSupport) 
+	: Core(xRes, yRes, fullScreen, vSync, aaLevel, anisotropyLevel, frameRate, monitorIndex) {
+
+	bcm_host_init();
+
+	fileProviders.push_back(new BasicFileProvider());
+	renderer = new Renderer();
+	renderer->setBackingResolutionScale(1.0, 1.0);
+	graphicsInterface = new OpenGLGraphicsInterface();
+	renderer->setGraphicsInterface(this, graphicsInterface);
+	services->setRenderer(renderer);
+	setVideoMode(xRes, yRes, fullScreen, vSync, aaLevel, anisotropyLevel, retinaSupport);
+	//services->getSoundManager()->setAudioInterface(new XAudio2AudioInterface());
+	eventMutex = createMutex();
+}
+
+RPICore::~RPICore() {
+
+}
+
+void RPICore::Render() {
+	renderer->beginFrame();
+	services->Render(Polycode::Rectangle(0, 0, xRes, yRes));
+	renderer->endFrame();
+}
+
+
+void RPICore::checkEvents() {
+
+	eventMutex->lock();
+
+	RPIEvent event;
+	for (int i = 0; i < systemInputEvents.size(); i++) {
+		event = systemInputEvents[i];
+		switch (event.eventGroup) {
+		case RPIEvent::INPUT_EVENT:
+			switch (event.eventCode) {
+			case InputEvent::EVENT_MOUSEMOVE:
+				input->setDeltaPosition(lastMouseX - event.mouseX, lastMouseY - event.mouseY);
+				lastMouseX = event.mouseX;
+				lastMouseY = event.mouseY;
+				input->setMousePosition(event.mouseX, event.mouseY, getTicks());
+				break;
+			case InputEvent::EVENT_MOUSEDOWN:
+				input->mousePosition.x = event.mouseX;
+				input->mousePosition.y = event.mouseY;
+				input->setMouseButtonState(event.mouseButton, true, getTicks());
+				break;
+			case InputEvent::EVENT_MOUSEWHEEL_UP:
+				input->mouseWheelUp(getTicks());
+				break;
+			case InputEvent::EVENT_MOUSEWHEEL_DOWN:
+				input->mouseWheelDown(getTicks());
+				break;
+			case InputEvent::EVENT_MOUSEUP:
+				input->setMouseButtonState(event.mouseButton, false, getTicks());
+				break;
+			case InputEvent::EVENT_KEYDOWN:
+				if (!checkSpecialKeyEvents(event.keyCode))
+					input->setKeyState(event.keyCode, event.unicodeChar, true, getTicks());
+				break;
+			case InputEvent::EVENT_KEYUP:
+				input->setKeyState(event.keyCode, event.unicodeChar, false, getTicks());
+				break;
+			case InputEvent::EVENT_TOUCHES_BEGAN:
+				input->touchesBegan(event.touch, event.touches, getTicks());
+				break;
+			case InputEvent::EVENT_TOUCHES_ENDED:
+				input->touchesEnded(event.touch, event.touches, getTicks());
+				break;
+			case InputEvent::EVENT_TOUCHES_MOVED:
+				input->touchesMoved(event.touch, event.touches, getTicks());
+				break;
+			}
+			break;
+		case RPIEvent::SYSTEM_FOCUS_EVENT:
+			switch (event.eventCode) {
+			case Core::EVENT_LOST_FOCUS:
+				loseFocus();
+				break;
+			case Core::EVENT_GAINED_FOCUS:
+				gainFocus();
+				break;
+			}
+			break;
+		}
+	}
+
+	systemInputEvents.clear();
+	eventMutex->unlock();
+
+}
+
+bool RPICore::systemUpdate() {
+	if (!running) {
+		return false;
+	}
+	doSleep();
+	updateCore();
+
+	checkEvents();
+	return running;
+}
+
+void RPICore::setCursor(int cursorType) {
+
+}
+
+void launchThread(Threaded *target) {
+	target->runThread();
+	target->scheduledForRemoval = true;
+}
+
+void *ManagedThreadFunc(void *data) {
+	Threaded *target = static_cast<Threaded*>(data);
+	target->runThread();
+	target->scheduledForRemoval = true;
+	return NULL;
+}
+
+
+void RPICore::createThread(Threaded * target) {
+	Core::createThread(target);
+	pthread_t thread;
+	pthread_create( &thread, NULL, ManagedThreadFunc, (void*)target);
+}
+
+CoreMutex *RPICore::createMutex() {
+	RPICoreMutex *mutex = new RPICoreMutex();
+	pthread_mutex_init(&mutex->pMutex, NULL);
+	return mutex;
+}
+
+void RPICore::copyStringToClipboard(const String& str) {
+
+}
+
+String RPICore::getClipboardString() {
+	return "";
+}
+
+void RPICore::createFolder(const String& folderPath) {
+
+}
+
+void RPICore::copyDiskItem(const String& itemPath, const String& destItemPath) {
+
+}
+
+void RPICore::moveDiskItem(const String& itemPath, const String& destItemPath) {
+
+}
+
+void RPICore::removeDiskItem(const String& itemPath) {
+
+}
+
+String RPICore::openFolderPicker() {
+	return "";
+}
+
+std::vector<String> RPICore::openFilePicker(std::vector<CoreFileExtension> extensions, bool allowMultiple) {
+	std::vector<String> ret;
+	return ret;
+}
+
+String RPICore::saveFilePicker(std::vector<CoreFileExtension> extensions) {
+	return "";
+}
+
+void RPICore::handleVideoModeChange(VideoModeChangeInfo *modeInfo) {
+
+	int32_t success = 0;
+	EGLBoolean result;
+	EGLint num_config;
+
+	this->xRes = modeInfo->xRes;
+	this->yRes = modeInfo->yRes;
+	this->fullScreen = modeInfo->fullScreen;
+	this->aaLevel = modeInfo->aaLevel;
+	this->vSync = modeInfo->vSync;
+
+	static EGL_DISPMANX_WINDOW_T nativewindow;
+
+	DISPMANX_ELEMENT_HANDLE_T dispman_element;
+	DISPMANX_DISPLAY_HANDLE_T dispman_display;
+	DISPMANX_UPDATE_HANDLE_T dispman_update;
+	VC_RECT_T dst_rect;
+	VC_RECT_T src_rect;
+
+	static const EGLint attribute_list[] =
+	{
+		EGL_RED_SIZE, 8,
+		EGL_GREEN_SIZE, 8,
+		EGL_BLUE_SIZE, 8,
+		EGL_ALPHA_SIZE, 8,
+		EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+		EGL_NONE
+	};
+
+	static const EGLint context_attributes[] =
+	{
+		EGL_CONTEXT_CLIENT_VERSION, 2,
+		EGL_NONE
+	};
+
+	EGLConfig config;
+
+	display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+	result = eglInitialize(display, NULL, NULL);
+	result = eglChooseConfig(display, attribute_list, &config, 1, &num_config);
+	assert(EGL_FALSE != result);
+	result = eglBindAPI(EGL_OPENGL_ES_API);
+	assert(EGL_FALSE != result);
+
+	context = eglCreateContext(display, config, EGL_NO_CONTEXT, context_attributes);
+	assert(context!=EGL_NO_CONTEXT);
+
+	uint32_t xr;
+	uint32_t yr;
+	success = graphics_get_display_size(0 /* LCD */, &xr, &yr);
+
+	xRes = xr;
+	yRes = yr;
+	
+	assert( success >= 0 );
+
+
+	dst_rect.x = 0;
+	dst_rect.y = 0;
+	dst_rect.width = xRes;
+	dst_rect.height = yRes;
+
+	src_rect.x = 0;
+	src_rect.y = 0;
+	src_rect.width = xRes << 16;
+	src_rect.height = yRes << 16;		
+
+	dispman_display = vc_dispmanx_display_open( 0 /* LCD */);
+	dispman_update = vc_dispmanx_update_start( 0 );
+
+	dispman_element = 
+	vc_dispmanx_element_add(dispman_update, dispman_display,
+				0/*layer*/, &dst_rect, 0/*src*/,
+				&src_rect, DISPMANX_PROTECTION_NONE, 
+				0 /*alpha*/, 0/*clamp*/, (DISPMANX_TRANSFORM_T)0/*transform*/);
+
+	nativewindow.element = dispman_element;
+	nativewindow.width = xRes;
+	nativewindow.height = yRes;
+	vc_dispmanx_update_submit_sync( dispman_update );
+
+	surface = eglCreateWindowSurface( display, config, &nativewindow, NULL );
+	assert(surface != EGL_NO_SURFACE);
+
+	// connect the context to the surface
+	result = eglMakeCurrent(display, surface, surface, context);
+	assert(EGL_FALSE != result);
+
+}
+
+void RPICore::flushRenderContext() {
+	glFlush();
+	eglSwapBuffers(display, surface);
+}
+
+void RPICore::openURL(String url) {
+
+}
+
+unsigned int RPICore::getTicks() {
+	return 0;
+}
+
+String RPICore::executeExternalCommand(String command, String args, String inDirectory) {
+	return "";
+}
+
+bool RPICore::systemParseFolder(const Polycode::String& pathString, bool showHidden, std::vector<OSFileEntry> &targetVector) {
+	
+    DIR           *d;
+    struct dirent *dir;
+    
+    d = opendir(pathString.c_str());
+    if(d) {
+        while ((dir = readdir(d)) != NULL) {
+            if(dir->d_name[0] != '.' || (dir->d_name[0] == '.'  && showHidden)) {
+                if(dir->d_type == DT_DIR) {
+                    targetVector.push_back(OSFileEntry(pathString, dir->d_name, OSFileEntry::TYPE_FOLDER));
+                } else {
+                    targetVector.push_back(OSFileEntry(pathString, dir->d_name, OSFileEntry::TYPE_FILE));
+                }
+            }
+        }
+        closedir(d);
+    }
+    return true;
+}
+
+void RPICore::handleSystemEvent(RPIEvent systemEvent) {
+	eventMutex->lock();
+	systemInputEvents.push_back(systemEvent);
+	eventMutex->unlock();
+}
+
+void Core::getScreenInfo(int *width, int *height, int *hz) {
+
+}
+
+void RPICore::setDeviceSize(Number x, Number y) {
+	deviceWidth = x;
+	deviceHeight = y;
+
+	renderer->setBackingResolutionScale(xRes/deviceWidth, yRes/deviceHeight);
+}
+
+Number RPICore::getBackingXRes() {
+	return deviceWidth;
+}
+
+Number RPICore::getBackingYRes() {
+	return deviceHeight;
+}

+ 14 - 4
src/core/PolySound.cpp

@@ -21,8 +21,12 @@
 */
 
 #include "polycode/core/PolySound.h"
-#define OV_EXCLUDE_STATIC_CALLBACKS
-#include <vorbis/vorbisfile.h>
+
+#ifndef NO_OGG
+	#define OV_EXCLUDE_STATIC_CALLBACKS
+	#include <vorbis/vorbisfile.h>
+#endif
+
 #undef OV_EXCLUDE_STATIC_CALLBACKS
 #include "polycode/core/PolyString.h"
 #include "polycode/core/PolyLogger.h"
@@ -42,6 +46,10 @@
 	#define INT32_MAX (std::numeric_limits<int32_t>::max())
 #endif
 
+#ifndef INT16_MAX
+	#define INT16_MAX (std::numeric_limits<int16_t>::max())
+#endif
+
 using namespace std;
 using namespace Polycode;
 
@@ -60,7 +68,7 @@ unsigned int AudioStreamingSource::streamData(int16_t *buffer, unsigned int size
     return 0;
 }
 
-
+#ifndef NO_OGG
 size_t custom_readfunc(void *ptr, size_t size, size_t nmemb, void *datasource) {
     Polycode::CoreFile *file = (Polycode::CoreFile*) datasource;
 	return file->read(ptr, size, nmemb);
@@ -81,6 +89,7 @@ long custom_tellfunc(void *datasource) {
 	CoreFile *file = (CoreFile*) datasource;
 	return file->tell();
 }
+#endif
 
 Sound::Sound(const String& fileName) :  referenceDistance(1), maxDistance(MAX_FLOAT), pitch(1), volume(1), numSamples(-1), streamingSound(false), playing(false), playbackOffset(0), streamingSource(NULL) {
 	soundLoaded = false;
@@ -421,6 +430,7 @@ unsigned int Sound::getFrequency() {
 
 
 bool Sound::loadOGG(const String& fileName) {
+#ifndef NO_OGG
     /*
 //	floatBuffer.clear();
 	vector<char> data;
@@ -483,7 +493,7 @@ bool Sound::loadOGG(const String& fileName) {
 	}
      */
 	return false;
-
+#endif
 }
 
 bool Sound::loadWAV(const String& fileName) {

+ 5 - 0
src/core/PolySoundManager.cpp

@@ -23,9 +23,14 @@
 #include "polycode/core/PolySoundManager.h"
 #include "polycode/core/PolyCore.h"
 #include "polycode/core/PolyLogger.h"
+#include <stdint.h>
+#include <limits>
 
 using namespace Polycode;
 
+#ifndef INT16_MAX
+	#define INT16_MAX (std::numeric_limits<int16_t>::max())
+#endif
 
 SoundManager::SoundManager() {
     audioInterface = NULL;

Some files were not shown because too many files changed in this diff