sgl

changeset 27:25de96fb1526

compiles on windows
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 27 Jun 2011 12:31:09 +0300
parents e4c79d2c7f78
children 6242b03e7191
files sgl.vcxproj src/wsys_w32.c tests/simple/simple.c tests/simple/simple.vcxproj
diffstat 4 files changed, 22 insertions(+), 7 deletions(-) [+]
line diff
     1.1 --- a/sgl.vcxproj	Mon Jun 27 12:19:14 2011 +0300
     1.2 +++ b/sgl.vcxproj	Mon Jun 27 12:31:09 2011 +0300
     1.3 @@ -18,6 +18,7 @@
     1.4      <ClCompile Include="src\wsys.c" />
     1.5      <ClCompile Include="src\wsys_glut.c" />
     1.6      <ClCompile Include="src\wsys_sdl.c" />
     1.7 +    <ClCompile Include="src\wsys_w32.c" />
     1.8    </ItemGroup>
     1.9    <ItemGroup>
    1.10      <ClInclude Include="src\config.h" />
    1.11 @@ -60,6 +61,7 @@
    1.12        <Optimization>Disabled</Optimization>
    1.13        <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.14        <DisableSpecificWarnings>4996</DisableSpecificWarnings>
    1.15 +      <AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
    1.16      </ClCompile>
    1.17      <Link>
    1.18        <SubSystem>Windows</SubSystem>
    1.19 @@ -76,6 +78,7 @@
    1.20        <IntrinsicFunctions>true</IntrinsicFunctions>
    1.21        <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    1.22        <DisableSpecificWarnings>4996</DisableSpecificWarnings>
    1.23 +      <AdditionalIncludeDirectories>include</AdditionalIncludeDirectories>
    1.24      </ClCompile>
    1.25      <Link>
    1.26        <SubSystem>Windows</SubSystem>
     2.1 --- a/src/wsys_w32.c	Mon Jun 27 12:19:14 2011 +0300
     2.2 +++ b/src/wsys_w32.c	Mon Jun 27 12:31:09 2011 +0300
     2.3 @@ -8,6 +8,9 @@
     2.4  #include <stdlib.h>
     2.5  #include <assert.h>
     2.6  #include <windows.h>
     2.7 +#include "sgl.h"
     2.8 +#include "wsys.h"
     2.9 +#include "log.h"
    2.10  
    2.11  struct window {
    2.12  	int id;
    2.13 @@ -21,7 +24,7 @@
    2.14  };
    2.15  
    2.16  static int init(void);
    2.17 -static void shutdown(void);
    2.18 +static void shut_down(void);
    2.19  
    2.20  /* video mode switching */
    2.21  static int set_vidmode(int xsz, int ysz);
    2.22 @@ -48,7 +51,7 @@
    2.23  static void set_event(int idx, int enable);
    2.24  static int process_events(void);
    2.25  
    2.26 -static LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
    2.27 +static LRESULT CALLBACK handle_events(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
    2.28  static int mouse_button(unsigned int msg);
    2.29  static void calc_win_size(int w, int h, int *width, int *height, int *posx, int *posy);
    2.30  
    2.31 @@ -56,7 +59,7 @@
    2.32  static struct wsys_module ws = {
    2.33  	"win32", 0,
    2.34  	init,
    2.35 -	shutdown,
    2.36 +	shut_down,
    2.37  	set_vidmode,
    2.38  	get_vidmode,
    2.39  	create_window,
    2.40 @@ -89,7 +92,7 @@
    2.41  	return 0;
    2.42  }
    2.43  
    2.44 -static void shutdown(void)
    2.45 +static void shut_down(void)
    2.46  {
    2.47  	/* TODO */
    2.48  }
    2.49 @@ -294,6 +297,7 @@
    2.50  static int set_title(const char *str)
    2.51  {
    2.52  	SetWindowText(active_win->win, str);
    2.53 +	return 0;
    2.54  }
    2.55  
    2.56  static void redisplay(void)
    2.57 @@ -318,10 +322,9 @@
    2.58  
    2.59  static int process_events(void)
    2.60  {
    2.61 -	int ret;
    2.62 +	int ret = 0;
    2.63  	MSG msg;
    2.64  	sgl_idle_callback_t idle;
    2.65 -	sgl_display_callback_t disp;
    2.66  
    2.67  	idle = sgl_get_callback(SGL_IDLE);
    2.68  
    2.69 @@ -356,7 +359,7 @@
    2.70  	return ret;
    2.71  }
    2.72  
    2.73 -static LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
    2.74 +static LRESULT CALLBACK handle_events(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
    2.75  {
    2.76  	static int state;
    2.77  	struct window *win;
     3.1 --- a/tests/simple/simple.c	Mon Jun 27 12:19:14 2011 +0300
     3.2 +++ b/tests/simple/simple.c	Mon Jun 27 12:31:09 2011 +0300
     3.3 @@ -1,5 +1,8 @@
     3.4  #include <stdio.h>
     3.5  #include <ctype.h>
     3.6 +#ifdef WIN32
     3.7 +#include <windows.h>
     3.8 +#endif	/* WIN32 */
     3.9  #ifndef __APPLE__
    3.10  #include <GL/gl.h>
    3.11  #else
     4.1 --- a/tests/simple/simple.vcxproj	Mon Jun 27 12:19:14 2011 +0300
     4.2 +++ b/tests/simple/simple.vcxproj	Mon Jun 27 12:31:09 2011 +0300
     4.3 @@ -50,10 +50,13 @@
     4.4        <WarningLevel>Level3</WarningLevel>
     4.5        <Optimization>Disabled</Optimization>
     4.6        <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     4.7 +      <AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     4.8      </ClCompile>
     4.9      <Link>
    4.10        <SubSystem>Console</SubSystem>
    4.11        <GenerateDebugInformation>true</GenerateDebugInformation>
    4.12 +      <AdditionalLibraryDirectories>$(SolutionDir)\Debug</AdditionalLibraryDirectories>
    4.13 +      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;sgl.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
    4.14      </Link>
    4.15    </ItemDefinitionGroup>
    4.16    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    4.17 @@ -65,12 +68,15 @@
    4.18        <FunctionLevelLinking>true</FunctionLevelLinking>
    4.19        <IntrinsicFunctions>true</IntrinsicFunctions>
    4.20        <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    4.21 +      <AdditionalIncludeDirectories>..\..\sgl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    4.22      </ClCompile>
    4.23      <Link>
    4.24        <SubSystem>Console</SubSystem>
    4.25        <GenerateDebugInformation>true</GenerateDebugInformation>
    4.26        <EnableCOMDATFolding>true</EnableCOMDATFolding>
    4.27        <OptimizeReferences>true</OptimizeReferences>
    4.28 +      <AdditionalLibraryDirectories>$(SolutionDir)\Release</AdditionalLibraryDirectories>
    4.29 +      <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;sgl.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
    4.30      </Link>
    4.31    </ItemDefinitionGroup>
    4.32    <ItemGroup>