Bläddra i källkod

Winsock and GLSL fixes for Windows

Ivan Safrin 14 år sedan
förälder
incheckning
e39113166b

+ 1 - 0
Core/Contents/Include/PolyWinCore.h

@@ -27,6 +27,7 @@
 #include "PolyInputKeys.h"
 #include "PolyInputKeys.h"
 #include "PolyRectangle.h"
 #include "PolyRectangle.h"
 
 
+#include <winsock2.h>
 #include <windows.h>
 #include <windows.h>
 #include <windowsx.h>
 #include <windowsx.h>
 #include <WinUser.h>
 #include <WinUser.h>

+ 1 - 0
Core/Contents/PolycodeView/MSVC/PolycodeView.h

@@ -1,5 +1,6 @@
 #pragma once
 #pragma once
 
 
+#include <winsock2.h>
 #include <windows.h>
 #include <windows.h>
 #include "PolyCore.h"
 #include "PolyCore.h"
 
 

+ 2 - 0
Core/Contents/Source/PolyGLSLShaderModule.cpp

@@ -76,6 +76,8 @@ GLSLShaderModule::GLSLShaderModule() : PolycodeShaderModule() {
 #ifdef _WINDOWS
 #ifdef _WINDOWS
 	glUseProgram   = (PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram");
 	glUseProgram   = (PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram");
 	glUniform1i = (PFNGLUNIFORM1IPROC)wglGetProcAddress("glUniform1i");
 	glUniform1i = (PFNGLUNIFORM1IPROC)wglGetProcAddress("glUniform1i");
+	glUniform1f = (PFNGLUNIFORM1FPROC)wglGetProcAddress("glUniform1f");	
+	glUniform3f = (PFNGLUNIFORM3FPROC)wglGetProcAddress("glUniform3f");
 	glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONARBPROC)wglGetProcAddress("glGetUniformLocation");
 	glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONARBPROC)wglGetProcAddress("glGetUniformLocation");
 	glCreateShader = (PFNGLCREATESHADERPROC)wglGetProcAddress("glCreateShader");
 	glCreateShader = (PFNGLCREATESHADERPROC)wglGetProcAddress("glCreateShader");
 	glShaderSource = (PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource");
 	glShaderSource = (PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource");

+ 4 - 4
Core/Contents/Source/PolyWinCore.cpp

@@ -75,10 +75,10 @@ Win32Core::Win32Core(PolycodeViewBase *view, int xRes, int yRes, bool fullScreen
 
 
 	setVideoMode(xRes, yRes, fullScreen, vSync, aaLevel, anisotropyLevel);
 	setVideoMode(xRes, yRes, fullScreen, vSync, aaLevel, anisotropyLevel);
 		
 		
-//	WSADATA WsaData;
-///	if(WSAStartup( MAKEWORD(2,2), &WsaData ) != NO_ERROR ){
-//		Logger::log("Error initializing sockets!\n");
-//	}
+	WSADATA WsaData;
+	if(WSAStartup( MAKEWORD(2,2), &WsaData ) != NO_ERROR ){
+		Logger::log("Error initializing sockets!\n");
+	}
 
 
 	((OpenGLRenderer*)renderer)->initOSSpecific();
 	((OpenGLRenderer*)renderer)->initOSSpecific();
 
 

+ 37 - 26
Player/Contents/CMakeLists.txt

@@ -10,32 +10,52 @@ INCLUDE_DIRECTORIES(
 SET(CMAKE_DEBUG_POSTFIX "_d")
 SET(CMAKE_DEBUG_POSTFIX "_d")
 
 
 IF(MSVC)
 IF(MSVC)
-    SET(polycodeplayer_SRCS
-        ../Build/MSVC/PolycodePlayer/player_icon.ico
-        ../Build/MSVC/PolycodePlayer/main.cpp
-        ../Build/MSVC/PolycodePlayer/PolycodePlayerView.cpp
+
+SET(polycodeplayer_SRCS 
         Source/PolycodePlayer.cpp
         Source/PolycodePlayer.cpp
         Source/PolycodeWindowsPlayer.cpp
         Source/PolycodeWindowsPlayer.cpp
+        Platform/Windows/main.cpp
     )
     )
-    SET(polycodeplayer_HDRS
-        ../Build/MSVC/PolycodePlayer/resource.h
-        ../Build/MSVC/PolycodePlayer/PolycodePlayerView.h
-        Include/PolycodePlayer.h 
+
+    SET(polycodeplayer_HDRS 
+        Include/PolycodePlayer.h
         Include/PolycodeWindowsPlayer.h
         Include/PolycodeWindowsPlayer.h
     )
     )
+  
+    SET(polycodeplayerstandalone_SRCS 
+        Source/PolycodePlayer.cpp
+        Source/PolycodeWindowsPlayer.cpp
+        Platform/Windows/Standalone/main.cpp
+    )
+    SET(polycodeplayerstandalone_HDRS 
+        Include/PolycodePlayer.h
+        Include/PolycodeWindowsPlayer.h
+    )
+ 
+    INCLUDE_DIRECTORIES(Include)
+ 
+    ADD_EXECUTABLE(PolycodePlayer ${polycodeplayer_SRCS} ${polycodeplayer_HDRS})
+    ADD_EXECUTABLE(StandalonePlayer ${polycodeplayerstandalone_SRCS} ${polycodeplayerstandalone_HDRS})
     
     
-    INCLUDE_DIRECTORIES(../Build/MSVC/PolycodePlayer Include)
-    
- #   IF(POLYCODE_BUILD_SHARED)
- #       ADD_EXECUTABLE(PolycodePlayer_dynamic WIN32 ${polycodeplayer_SRCS} ${polycodeplayer_HDRS})
- #       TARGET_LINK_LIBRARIES(PolycodePlayer Polycore_dynamic PolycodeLua ${LUA_LIBRARY})
- #   ENDIF(POLYCODE_BUILD_SHARED)
 
 
- #   IF(POLYCODE_BUILD_STATIC)
-    ADD_EXECUTABLE(PolycodePlayer WIN32 ${polycodeplayer_SRCS} ${polycodeplayer_HDRS})
     TARGET_LINK_LIBRARIES(PolycodePlayer 
     TARGET_LINK_LIBRARIES(PolycodePlayer 
+        PolycodeLua 
         Polycore 
         Polycore 
+        ${LUA_LIBRARY}
+        ${OPENGL_LIBRARIES}
+        ${OPENAL_LIBRARY}
+        ${PNG_LIBRARIES}
+        ${FREETYPE_LIBRARIES}
+        ${PHYSFS_LIBRARY}
+        ${OGG_LIBRARY}
+        ${VORBIS_LIBRARY}
+        ${VORBISFILE_LIBRARY}
+        ${SDL_LIBRARY}
+     )
+
+    TARGET_LINK_LIBRARIES(StandalonePlayer 
         PolycodeLua 
         PolycodeLua 
+        Polycore 
         ${LUA_LIBRARY}
         ${LUA_LIBRARY}
         ${OPENGL_LIBRARIES}
         ${OPENGL_LIBRARIES}
         ${OPENAL_LIBRARY}
         ${OPENAL_LIBRARY}
@@ -45,10 +65,9 @@ IF(MSVC)
         ${OGG_LIBRARY}
         ${OGG_LIBRARY}
         ${VORBIS_LIBRARY}
         ${VORBIS_LIBRARY}
         ${VORBISFILE_LIBRARY}
         ${VORBISFILE_LIBRARY}
+        ${SDL_LIBRARY}
      )
      )
 
 
- #   ENDIF(POLYCODE_BUILD_STATIC)
-    
 ELSEIF(APPLE)
 ELSEIF(APPLE)
     SET(polycodeplayer_SRCS 
     SET(polycodeplayer_SRCS 
         Source/PolycodePlayer.cpp
         Source/PolycodePlayer.cpp
@@ -245,13 +264,6 @@ ELSE(MSVC)
 
 
 ENDIF(MSVC)
 ENDIF(MSVC)
 
 
-IF(POLYCODE_INSTALL_PLAYER)
-#    IF(POLYCODE_BUILD_SHARED)
-#        # install player
-#        INSTALL(TARGETS PolycodePlayer_dynamic
-#            DESTINATION ${POLYCODE_RELEASE_DIR}/Player)
-#    ENDIF()
-#    IF(POLYCODE_BUILD_STATIC)
     INSTALL(TARGETS PolycodePlayer 
     INSTALL(TARGETS PolycodePlayer 
         DESTINATION Player)
         DESTINATION Player)
 
 
@@ -271,5 +283,4 @@ ELSE(MSVC)
     INSTALL(FILES "${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/API/api.pak" DESTINATION Player)
     INSTALL(FILES "${Polycode_SOURCE_DIR}/Bindings/Contents/LUA/API/api.pak" DESTINATION Player)
 ENDIF(MSVC)
 ENDIF(MSVC)
 
 
-#    ENDIF()
 ENDIF(POLYCODE_INSTALL_PLAYER)
 ENDIF(POLYCODE_INSTALL_PLAYER)

+ 11 - 0
Player/Contents/Platform/Windows/Standalone/main.cpp

@@ -0,0 +1,11 @@
+#include "Polycode.h"
+#include "PolycodeView.h"
+#include "PolycodeLinuxPlayer.h"
+
+int main(int argc, char *argv[]) {
+	PolycodeView *view = new PolycodeView("Polycode Player");
+	PolycodeLinuxPlayer *player = new PolycodeLinuxPlayer(view, "main.polyapp", false);
+	player->runPlayer();
+	while(player->Update()) {}
+	return 0;
+}

+ 15 - 0
Player/Contents/Platform/Windows/main.cpp

@@ -0,0 +1,15 @@
+#include "Polycode.h"
+#include "PolycodeView.h"
+#include "PolycodeLinuxPlayer.h"
+
+int main(int argc, char *argv[]) {
+	PolycodeView *view = new PolycodeView("Polycode Player");
+	if(argc < 2) {
+		printf("Filename required!\n");
+		return 1;
+	}
+	PolycodeLinuxPlayer *player = new PolycodeLinuxPlayer(view, argv[1], false);
+	player->runPlayer();
+	while(player->Update()) {}
+	return 0;
+}

+ 1 - 1
Player/Contents/Source/PolycodeWindowsPlayer.cpp

@@ -31,5 +31,5 @@ PolycodeWindowsPlayer::~PolycodeWindowsPlayer() {
 }
 }
 
 
 void PolycodeWindowsPlayer::createCore() {
 void PolycodeWindowsPlayer::createCore() {
-	core =  new Win32Core(view, xRes, yRes,  fullScreen, aaLevel, frameRate);	
+	core =  new Win32Core(view, xRes, yRes,  fullScreen, true, aaLevel, 16, frameRate);	
 }
 }