Ver código fonte

Added accessors to get desktop width and height from the Core (now usable from Lua). Removed deprecated screen info methods.

Ivan Safrin 12 anos atrás
pai
commit
8263af95a8

+ 1 - 3
Core/Contents/Include/PolyCocoaCore.h

@@ -155,9 +155,7 @@ namespace Polycode {
 		void unlockMutex(CoreMutex *mutex);
 		CoreMutex *createMutex();		
 		
-		void checkEvents();
-		
-		vector<Rectangle> getVideoModes();
+		void checkEvents();		
 		
 		int lastMouseY;
 		int lastMouseX;				

+ 15 - 16
Core/Contents/Include/PolyCore.h

@@ -206,16 +206,7 @@ namespace Polycode {
 		* @return Current vertical resolution.
 		*/													
 		Number getYRes();
-		
-		// deprecated
-		int getNumVideoModes();
-		
-		/**
-		* Returns the available system video modes. 
-		* @return An STL vector of video modes.
-		*/															
-		virtual std::vector<Rectangle> getVideoModes() = 0;
-		
+				
 		/**
 		* Provides the current width, height, and refresh rate of the screen.
 		* @param width If non-NULL, current screen width will be written here (or 0 if unknown).
@@ -223,7 +214,7 @@ namespace Polycode {
 		* @param hz If non-NULL, current screen refresh rate will be written here (or 0 if unknown).
 		*/
 		static void getScreenInfo(int *width, int *height, int *hz);
-								
+
 		/**
 		* Creates a folder on disk with the specified path.
 		* @param folderPath Path to create the folder in.
@@ -265,9 +256,7 @@ namespace Polycode {
 		* @return An STL vector of the selected file paths.
 		*/																							
 		virtual std::vector<String> openFilePicker(std::vector<CoreFileExtension> extensions, bool allowMultiple) = 0;
-		
-		void setVideoModeIndex(int index, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel);
-		
+				
 		/**
 		* Sets a new video mode.
 		* @param xRes New horizontal resolution of the renderer.
@@ -357,6 +346,16 @@ namespace Polycode {
 		
 		bool paused;
 		bool pauseOnLoseFocus;
+		
+		/**
+		* Default width of the desktop screen
+		*/
+		int defaultScreenWidth;
+		
+		/**
+		* Default height of the desktop screen
+		*/		
+		int defaultScreenHeight;		
 				
 	protected:	
 	
@@ -397,8 +396,8 @@ namespace Polycode {
 		CoreMutex *threadedEventMutex;
 		
 		int xRes;
-		int yRes;	
-		
+		int yRes;
+				
 		int monitorIndex;
 		
 		int frames;

+ 0 - 5
Core/Contents/Source/PolyCocoaCore.mm

@@ -298,11 +298,6 @@ void CocoaCore::resizeTo(int xRes, int yRes) {
 	dispatchEvent(new Event(), EVENT_CORE_RESIZE);	
 }
 
-vector<Polycode::Rectangle> CocoaCore::getVideoModes() {
-	vector<Polycode::Rectangle> retVector;
-	return retVector;
-}
-
 CocoaCore::~CocoaCore() {
 	printf("Shutting down cocoa core\n");
 	[glView setCore:nil];	

+ 5 - 13
Core/Contents/Source/PolyCore.cpp

@@ -52,6 +52,10 @@ namespace Polycode {
 	}
 	
 	Core::Core(int _xRes, int _yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, int frameRate, int monitorIndex) : EventDispatcher() {
+	
+		int _hz;
+		getScreenInfo(&defaultScreenWidth, &defaultScreenHeight, &_hz);
+	
 		services = CoreServices::getInstance();
 		input = new CoreInput();
 		services->setCore(this);
@@ -91,11 +95,7 @@ namespace Polycode {
 	void Core::captureMouse(bool newval) {
 		mouseCaptured = newval;
 	}
-	
-	int Core::getNumVideoModes() {
-		return numVideoModes;
-	}
-	
+		
 	Number Core::getXRes() {
 		return xRes;
 	}
@@ -132,15 +132,7 @@ namespace Polycode {
 	Number Core::getTicksFloat() {
 		return ((Number)getTicks())/1000.0f;		
 	}
-	
-	void Core::setVideoModeIndex(int index, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel) {
-		std::vector<Rectangle> resList = getVideoModes();
-		if(index >= resList.size())
-			return;
 		
-		setVideoMode(resList[index].w, resList[index].h, fullScreen, vSync, aaLevel, anisotropyLevel);
-	}
-	
 	void Core::createThread(Threaded *target) {
 		if(!threadedEventMutex) {
 			threadedEventMutex = createMutex();