From 4d95c5cdaa720c5207a5f5b0d97a884a7ed1a3ab Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 18 Apr 2005 01:01:56 +0000 Subject: Added core of group explode. Also fixed modal windows as well as can be done with MS. --- opengl/GNUmakefile | 10 ++++------ opengl/dialog.rc | 2 +- opengl/generate.cpp | 22 +++++++++++----------- opengl/generate.h | 7 ++++--- opengl/main.cpp | 10 +++++++--- 5 files changed, 27 insertions(+), 24 deletions(-) (limited to 'opengl') diff --git a/opengl/GNUmakefile b/opengl/GNUmakefile index bedb0b9..700fb6d 100644 --- a/opengl/GNUmakefile +++ b/opengl/GNUmakefile @@ -18,7 +18,7 @@ # # ------------------------------------------------------------------------- # -# $Id: GNUmakefile,v 1.2 2005-04-17 01:53:15 ianc Exp $ +# $Id: GNUmakefile,v 1.3 2005-04-18 01:01:56 ianc Exp $ # include ../make.conf @@ -40,8 +40,6 @@ OBJECTS = $(SOURCES:.cpp=.o) $(RES).o OUTDLL = $(TARGET).dll -OUTLIB = $(TARGET).a - WRAPPER = ../wrapper DLLLIBS = $(WRAPPER)/mingwms.lib $(MILKSHAPE)/lib/msModelLib.lib \ @@ -52,14 +50,14 @@ FLAGS = -I$(WRAPPER) -I$(MILKSHAPE) -Wall `w32dlib-config --cflags` \ $(OUTDLL): $(OBJECTS) - dllwrap --output-lib=$(OUTLIB) --dllname=$(OUTDLL) \ + dllwrap --dllname=$(OUTDLL) \ --driver-name=c++ $(OBJECTS) $(DLLLIBS) # Unfortunately the windres resource compiler doesn't like my RC, so you # need RC.EXE from the Platform SDK to compile it to a RES first. # $(RES).o: $(RES).res - windres -v -i $(RES).res -o $(RES).o + windres -i $(RES).res -o $(RES).o $(RES).res: $(RES).rc $(RES).h rc $(RES).rc @@ -70,7 +68,7 @@ $(RES).res: $(RES).rc $(RES).h -include depend.mak clean: - -rm -f $(OUTDLL) $(OUTLIB) $(OBJECTS) $(RES).res + -rm -f $(OUTDLL) $(OBJECTS) $(RES).res depend: @echo Dependencies updated.... diff --git a/opengl/dialog.rc b/opengl/dialog.rc index 9399f20..731a865 100644 --- a/opengl/dialog.rc +++ b/opengl/dialog.rc @@ -1,7 +1,7 @@ #include #include "dialog.h" -GL_DIALOG DIALOG 0, 0, 337, 181 +GL_DIALOG DIALOG 100, 100, 337, 181 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION CAPTION "OpenGL Export" LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US diff --git a/opengl/generate.cpp b/opengl/generate.cpp index 94403c8..33d2f13 100644 --- a/opengl/generate.cpp +++ b/opengl/generate.cpp @@ -81,15 +81,15 @@ std::string Generate::Info() return str.str(); } -void Generate::MakeFiles() +void Generate::MakeFiles(HWND parent) { if (m_blitzMax) { - GenerateBlitzMax(); + GenerateBlitzMax(parent); } else { - GenerateC(); + GenerateC(parent); } } @@ -211,7 +211,7 @@ void Generate::CalcModelBounds() } -void Generate::GenerateC() +void Generate::GenerateC(HWND parent) { std::FILE *fp; int len; @@ -236,7 +236,7 @@ void Generate::GenerateC() // if (!(fp=fopen(fname_h.c_str(),"w"))) { - W32DLib::Common::Error(0,0,"Couldn't create header file"); + W32DLib::Common::Error(parent,0,"Couldn't create header file"); return; } @@ -301,7 +301,7 @@ void Generate::GenerateC() // if (!(fp=fopen(fname_c.c_str(),"w"))) { - W32DLib::Common::Error(0,0,"Couldn't create source file"); + W32DLib::Common::Error(parent,0,"Couldn't create source file"); return; } @@ -413,12 +413,12 @@ void Generate::GenerateC() missing="The following meshes had no material:\n\n"+missing; missing+="\n\nThey were given the colour white."; - W32DLib::Common::Message(0,0,missing); + W32DLib::Common::Message(parent,0,missing); } } -void Generate::GenerateBlitzMax() +void Generate::GenerateBlitzMax(HWND parent) { std::FILE *fp; int len; @@ -443,7 +443,7 @@ void Generate::GenerateBlitzMax() // if (!(fp=fopen(fname_h.c_str(),"w"))) { - W32DLib::Common::Error(0,0,"Couldn't create header file"); + W32DLib::Common::Error(parent,0,"Couldn't create header file"); return; } @@ -508,7 +508,7 @@ void Generate::GenerateBlitzMax() // if (!(fp=fopen(fname_c.c_str(),"w"))) { - W32DLib::Common::Error(0,0,"Couldn't create source file"); + W32DLib::Common::Error(parent,0,"Couldn't create source file"); return; } @@ -620,7 +620,7 @@ void Generate::GenerateBlitzMax() missing="The following meshes had no material:\n\n"+missing; missing+="\n\nThey were given the colour white."; - W32DLib::Common::Message(0,0,missing); + W32DLib::Common::Message(parent,0,missing); } } diff --git a/opengl/generate.h b/opengl/generate.h index f7f07df..c8127a8 100644 --- a/opengl/generate.h +++ b/opengl/generate.h @@ -23,6 +23,7 @@ #ifndef GENERATE_H #define GENERATE_H +#include #include #include @@ -42,7 +43,7 @@ public: bool forceCOG, bool blitzMax); - void MakeFiles(); + void MakeFiles(HWND parent); std::string Info(); @@ -75,8 +76,8 @@ private: void CalcModelBounds(); - void GenerateC(); - void GenerateBlitzMax(); + void GenerateC(HWND parent); + void GenerateBlitzMax(HWND parent); }; #endif // GENERATE_H diff --git a/opengl/main.cpp b/opengl/main.cpp index 82bf991..7ded832 100644 --- a/opengl/main.cpp +++ b/opengl/main.cpp @@ -41,6 +41,10 @@ static int Execute(msModel* model) W32DLib::Common::Initialise(); W32DLib::Common::MessageTitle("Simple OpenGL"); + // Unfortunately this is the best you can hope for with Milkshape... + // + HWND parent=GetForegroundWindow(); + if (!model) { return -1; @@ -48,17 +52,17 @@ static int Execute(msModel* model) if (msModel_GetMeshCount(model)<1) { - W32DLib::Common::Error(NULL,NULL,"No meshes in the model!"); + W32DLib::Common::Error(parent,0,"No meshes in the model!"); return 0; } Generate gen(model); GLDialog dlg(gen); - if (dlg.ShowModal(W32DLib::Common::GetInstance(),NULL)==IDOK) + if (dlg.ShowModal(W32DLib::Common::GetInstance(),parent)==IDOK) { SetCursor(LoadCursor(NULL,IDC_WAIT)); - gen.MakeFiles(); + gen.MakeFiles(parent); SetCursor(LoadCursor(NULL,IDC_ARROW)); } -- cgit v1.2.3