diff --git a/Blocks3D.vcproj b/Blocks3D.vcproj index 9aa5681..dd4dfb1 100644 --- a/Blocks3D.vcproj +++ b/Blocks3D.vcproj @@ -79,7 +79,6 @@ OutputFile="./Blocks3D.exe" LinkIncremental="1" SuppressStartupBanner="true" - AdditionalManifestDependencies="" ProgramDatabaseFile=".\Release/Blocks3D.pdb" SubSystem="2" TargetMachine="1" @@ -146,7 +145,7 @@ + + + + - - @@ -882,21 +885,25 @@ > + + + + - - #include "propertyGrid.h" #include "map" - -#ifdef NO_SPRINTF -#define sprintf_s sprintf -#endif //#include "Properties/BoolProperty.h" class Instance diff --git a/src/include/DataModelV2/PVInstance.h b/src/include/DataModelV2/PVInstance.h index 67aa4b1..79ac705 100644 --- a/src/include/DataModelV2/PVInstance.h +++ b/src/include/DataModelV2/PVInstance.h @@ -1,6 +1,7 @@ #pragma once #include "instance.h" #include "enum.h" +#include class PVInstance : public Instance diff --git a/src/include/DataModelV2/PartInstance.h b/src/include/DataModelV2/PartInstance.h index 40a345f..4179c83 100644 --- a/src/include/DataModelV2/PartInstance.h +++ b/src/include/DataModelV2/PartInstance.h @@ -30,6 +30,8 @@ public: Color3 color; bool canCollide; bool anchored; + dBodyID physBody; + dGeomID physGeom[3]; //Getters Vector3 getPosition(); diff --git a/src/include/DataModelV2/WorkspaceInstance.h b/src/include/DataModelV2/WorkspaceInstance.h index 9a62304..459f144 100644 --- a/src/include/DataModelV2/WorkspaceInstance.h +++ b/src/include/DataModelV2/WorkspaceInstance.h @@ -9,5 +9,6 @@ public: WorkspaceInstance(void); ~WorkspaceInstance(void); void clearChildren(); + void zoomToExtents(); std::vector partObjects; }; diff --git a/src/include/Globals.h b/src/include/Globals.h index 76f10d9..1bb249b 100644 --- a/src/include/Globals.h +++ b/src/include/Globals.h @@ -1,6 +1,6 @@ #pragma once #include "DataModelV2/DataModelInstance.h" - +#include "XplicitNgine/XplicitNgine.h" class Application; @@ -28,6 +28,7 @@ extern std::vector postRenderStack; extern std::vector g_selectedInstances; extern bool running; extern DataModelInstance* g_dataModel; +extern XplicitNgine* g_xplicitNgine; extern Application* g_usableApp; extern GFontRef g_fntdominant; diff --git a/src/include/XplicitNgine/XplicitNgine.h b/src/include/XplicitNgine/XplicitNgine.h new file mode 100644 index 0000000..ae23224 --- /dev/null +++ b/src/include/XplicitNgine/XplicitNgine.h @@ -0,0 +1,15 @@ +#pragma once +#include +#include "DatamodelV2/PartInstance.h" + +class XplicitNgine +{ +public: + XplicitNgine(); + ~XplicitNgine(); + dWorldID physWorld; + dSpaceID physSpace; + dJointGroupID contactgroup; + + void createBody(PartInstance* partInstance); +}; \ No newline at end of file diff --git a/src/include/resource.h b/src/include/resource.h new file mode 100644 index 0000000..1673d3d --- /dev/null +++ b/src/include/resource.h @@ -0,0 +1,7 @@ +#define IDC_PROPERTYGRID 2000 +#define IDC_STATIC 2 + +#define IDE_EDIT 105 +#define IDI_ICON1 102 +#define IDB_BITMAP1 103 +#define IDD_DIALOG1 104 diff --git a/src/include/winver.h b/src/include/winver.h deleted file mode 100644 index e72f685..0000000 --- a/src/include/winver.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef WINVER -#define _WIN32_WINNT 0x0400 -#define _WIN32_WINDOWS 0x0400 -#define WINVER 0x0400 -#endif \ No newline at end of file diff --git a/src/source/Application.cpp b/src/source/Application.cpp index 104de26..fb8ec39 100644 --- a/src/source/Application.cpp +++ b/src/source/Application.cpp @@ -1,13 +1,14 @@ #include #include #include -#include "../../resource.h" +#include "resource.h" #include "DataModelV2/Instance.h" #include "DataModelV2/PartInstance.h" #include "DataModelV2/TextButtonInstance.h" #include "DataModelV2/ImageButtonInstance.h" #include "DataModelV2/DataModelInstance.h" #include "DataModelV2/GuiRootInstance.h" +#include "XplicitNgine/XplicitNgine.h" #include "CameraController.h" #include "AudioPlayer.h" #include "Globals.h" @@ -188,9 +189,11 @@ void Application::onInit() { _dataModel->font = g_fntdominant; g_dataModel = _dataModel; - //initGUI(); + _xplicitNgine = new XplicitNgine(); + g_xplicitNgine = _xplicitNgine; #ifdef LEGACY_LOAD_G3DFUN_LEVEL + // Anchored this baseplate for XplicitNgine tests PartInstance* test = makePart(); test->setParent(_dataModel->getWorkspace()); test->color = Color3(0.2F,0.3F,1); @@ -198,7 +201,8 @@ void Application::onInit() { test->setPosition(Vector3(0,0,0)); test->setCFrame(test->getCFrame() * Matrix3::fromEulerAnglesXYZ(0,toRadians(0),toRadians(0))); test->setSurface(TOP, Enum::SurfaceType::Bumps); - + test->anchored = true; + test = makePart(); test->setParent(_dataModel->getWorkspace()); test->color = Color3(.5F,1,.5F); @@ -262,9 +266,6 @@ void Application::onInit() { test->setPosition(Vector3(-2,5,0)); test->setSurface(TOP, Enum::SurfaceType::Bumps); - - - test = makePart(); test->setParent(_dataModel->getWorkspace()); test->color = Color3::gray(); @@ -294,86 +295,20 @@ void Application::onInit() { } - - - - - void Application::onCleanup() { clearInstances(); sky->~Sky(); } - - -/* - -Class HyperSnapSolver - -function getCollisionDepth(Part colliding, part collider); -function getFaceCollision(Part colliding, part collider); - -function eject(Part colliding, Part collider) -{ - if(!colliding.canCollide || !collider.canCollide) - return; - if(getCollisionDepth(colliding, collider) != 0) { - int ejectMultiplier, ejectMultipliery = 1-(collider.Friction+colliding.Friction), ejectMultiplierz = 1-(collider.Friction/2+colliding.Friction/2); - if(colliding.Anchored) - ejectMultiplier = collider.elasticity; - int faceCollided = getFaceCollision(colliding, collider); - if(faceCollided % 3 == 1) - { - ejectMultipliery = ejectMultiplier; - ejectMultiplier = 1-(collider.Friction+colliding.Friction/2); - } - else if(faceCollided % 3 == 2) - { - ejectMultiplierz = ejectMultiplier; - ejectMultiplier = 1-(collider.Friction+colliding.Friction/2); - } - - collider.Velocity *= Vector3.new(colliding.Velocity.x*ejectMultiplier,colliding.Velocity.y*ejectMultipliery,colliding.Velocity.z) - } -} - -*/ - -double grav = 0.32666666666666666666666666666667; -void simGrav(PartInstance * collider) -{ - if(!collider->anchored) - { - collider->setPosition(collider->getPosition()+collider->getVelocity()); - collider->setVelocity(collider->getVelocity()-Vector3(0,grav,0)); - } -} - -void eject(PartInstance * colliding, PartInstance * collider) -{ - if(colliding == collider || !colliding->canCollide || !collider->canCollide) - return; - if(G3D::CollisionDetection::fixedSolidBoxIntersectsFixedSolidBox(collider->getBox(), colliding->getBox())) - collider->setVelocity(collider->getVelocity().reflectionDirection(colliding->getCFrame().upVector())/1.3F); - -} - - - -void Application::onLogic() { - //PhysicsStart - for_each (_dataModel->getWorkspace()->partObjects.begin(), _dataModel->getWorkspace()->partObjects.end(), simGrav); +void Application::onLogic() { + // XplicitNgine Start for(size_t i = 0; i < _dataModel->getWorkspace()->partObjects.size(); i++) { - for(size_t j = 0; j < _dataModel->getWorkspace()->partObjects.size(); j++) - { - eject(_dataModel->getWorkspace()->partObjects[i], _dataModel->getWorkspace()->partObjects[j]); - } - } + PartInstance* partInstance = _dataModel->getWorkspace()->partObjects[i]; + _xplicitNgine->createBody(partInstance); + } } - - void Application::onNetwork() { // Poll net messages here } @@ -407,95 +342,29 @@ void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) { } -/*double getOSVersion() { - OSVERSIONINFO osvi; - - ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - GetVersionEx(&osvi); - std::string version = Convert(osvi.dwMajorVersion) + "." + Convert(osvi.dwMinorVersion); - return ::atof(version.c_str()); -}*/ -/* -bool IsHolding(int button) -{ - return (GetKeyState(button) >> 1)>0; -} - -*/ - void Application::onUserInput(UserInput* ui) { if(mouseMoveState) { mouseMoveState = false; tool->onMouseMoved(mouse); } - /* - if(GetHoldKeyState(VK_LCONTROL)) - { - if(GetHoldKeyState('D')) - { - _messageTime = System::time(); - if(debugMode()) - _message = "Debug Mode Disabled"; - else - _message = "Debug Mode Enabled"; - setDebugMode(!debugMode()); - } - } - */ + if(GetHoldKeyState(VK_F8)) { _dataModel->getGuiRoot()->setDebugMessage("FOV Set to 10", System::time()); } - //} - //_dataModel->mousex = ui->getMouseX(); - //_dataModel->mousey = ui->getMouseY(); mouse.setMouseDown((GetKeyState(VK_LBUTTON) & 0x100) != 0); - if (GetHoldKeyState(VK_LBUTTON)) { - /* if (_dragging) { - PartInstance* part = NULL; - if(g_selectedInstances.size() > 0) - part = (PartInstance*) g_selectedInstances.at(0); - Ray dragRay = cameraController.getCamera()->worldRay(mouse.x, mouse.y, renderDevice->getViewport()); - std::vector instances = _dataModel->getWorkspace()->getAllChildren(); - for(size_t i = 0; i < instances.size(); i++) - { - if(PartInstance* moveTo = dynamic_cast(instances.at(i))) - { - float __time = testRay.intersectionTime(moveTo->getBox()); - float __nearest=std::numeric_limits::infinity(); - if (__time != inf()) - { - if (__nearest>__time) - { - // BROKEN - //Vector3 closest = (dragRay.closestPoint(moveTo->getPosition()) * 2); - //part->setPosition(closest); - //part->setPosition(Vector3(floor(closest.x),part->getPosition().y,floor(closest.z))); - } - } - } - } - Sleep(10); - }*/ - } - // Camera KB Handling { - if (GetKPBool(VK_OEM_COMMA)) //Left - g_usableApp->cameraController.panLeft(); - else if (GetKPBool(VK_OEM_PERIOD)) // Right - g_usableApp->cameraController.panRight(); - else if (GetKPBool(0x49)) // Zoom In (I) - g_usableApp->cameraController.Zoom(1); - else if (GetKPBool(0x4F)) // Zoom Out (O) - g_usableApp->cameraController.Zoom(-1); - // } - - //readMouseGUIInput(); - // Add other key handling here + // Camera KB Handling + if (GetKPBool(VK_OEM_COMMA)) //Left + g_usableApp->cameraController.panLeft(); + else if (GetKPBool(VK_OEM_PERIOD)) // Right + g_usableApp->cameraController.panRight(); + else if (GetKPBool(0x49)) // Zoom In (I) + g_usableApp->cameraController.Zoom(1); + else if (GetKPBool(0x4F)) // Zoom Out (O) + g_usableApp->cameraController.Zoom(-1); } void Application::changeTool(Tool * newTool) @@ -793,11 +662,6 @@ void Application::onKeyPressed(int key) { _dataModel->getOpen(); } - if ((GetHoldKeyState(VK_LCONTROL) || GetHoldKeyState(VK_RCONTROL)) && key=='A') - { - std::vector vec = _dataModel->getWorkspace()->getAllChildren(); - g_selectedInstances.insert(g_selectedInstances.end(), vec.begin(), vec.end()); - } tool->onKeyDown(key); } void Application::onKeyUp(int key) @@ -948,6 +812,8 @@ void Application::run() { RealTime rdt = timeStep; SimTime sdt = timeStep * rate; SimTime idt = desiredFrameDuration * rate; + + onSimulation(rdt,sdt,idt); m_simulationWatch.tock(); diff --git a/src/source/CameraController.cpp b/src/source/CameraController.cpp index dc47011..30654e0 100644 --- a/src/source/CameraController.cpp +++ b/src/source/CameraController.cpp @@ -159,6 +159,11 @@ void CameraController::tiltDown() setFrame(frame); } +void CameraController::zoomExtents() +{ + // do some weird jank math +} + void CameraController::centerCamera(Instance* selection) { CoordinateFrame frame = CoordinateFrame(g3dCamera.getCoordinateFrame().translation); diff --git a/src/source/DataModelV2/DataModelInstance.cpp b/src/source/DataModelV2/DataModelInstance.cpp index 07e4db5..989bc9c 100644 --- a/src/source/DataModelV2/DataModelInstance.cpp +++ b/src/source/DataModelV2/DataModelInstance.cpp @@ -13,7 +13,6 @@ using namespace std; using namespace rapidxml; - DataModelInstance::DataModelInstance(void) { Instance::Instance(); @@ -519,6 +518,7 @@ bool DataModelInstance::getOpen() of.lpstrFile[0]='\0'; of.nMaxFile=500; of.lpstrTitle="Hello"; + of.Flags = OFN_FILEMUSTEXIST; ShowCursor(TRUE); BOOL file = GetOpenFileName(&of); if (file) @@ -526,7 +526,6 @@ bool DataModelInstance::getOpen() _loadedFileName = of.lpstrFile; load(of.lpstrFile,true); } - //else MessageBox(NULL, "Failed to open dialog", "Failure", MB_ICONHAND | MB_OK); return true; } void DataModelInstance::setMessage(std::string msg) diff --git a/src/source/DataModelV2/Instance.cpp b/src/source/DataModelV2/Instance.cpp index 1f51b50..4cb1279 100644 --- a/src/source/DataModelV2/Instance.cpp +++ b/src/source/DataModelV2/Instance.cpp @@ -1,3 +1,4 @@ +#define WINVER 0x0400 #include #include "DataModelV2/Instance.h" diff --git a/src/source/DataModelV2/PartInstance.cpp b/src/source/DataModelV2/PartInstance.cpp index 9a04254..d001057 100644 --- a/src/source/DataModelV2/PartInstance.cpp +++ b/src/source/DataModelV2/PartInstance.cpp @@ -25,6 +25,7 @@ PartInstance::PartInstance(void) left = Enum::SurfaceType::Smooth; bottom = Enum::SurfaceType::Smooth; shape = Enum::Shape::Block; + physBody = NULL; } @@ -279,7 +280,6 @@ void PartInstance::render(RenderDevice* rd) { changed=false; Vector3 renderSize = size/2; glNewList(glList, GL_COMPILE); - //glScalef(0.5f,0.5f,0.5f); renderShape(this->shape, renderSize, color); renderSurface(TOP, this->top, renderSize, this->controller, color); renderSurface(FRONT, this->front, renderSize, this->controller, color); @@ -297,6 +297,16 @@ void PartInstance::render(RenderDevice* rd) { PartInstance::~PartInstance(void) { glDeleteLists(glList, 1); + /* + // Causes some weird ODE error + // Someone, please look into this + + dBodyDestroy(physBody); + for (int i = 0; i < 3; i++) { + if (physGeom[i] != NULL) + dGeomDestroy(physGeom[i]); + } + */ } char pto[512]; diff --git a/src/source/DataModelV2/WorkspaceInstance.cpp b/src/source/DataModelV2/WorkspaceInstance.cpp index cf36ffb..ff64068 100644 --- a/src/source/DataModelV2/WorkspaceInstance.cpp +++ b/src/source/DataModelV2/WorkspaceInstance.cpp @@ -1,5 +1,6 @@ #include "DataModelV2/WorkspaceInstance.h" - +#include "Globals.h" +#include "Application.h" WorkspaceInstance::WorkspaceInstance(void) { @@ -15,6 +16,11 @@ void WorkspaceInstance::clearChildren() Instance::clearChildren(); } +void WorkspaceInstance::zoomToExtents() +{ + g_usableApp->cameraController.zoomExtents(); +} + WorkspaceInstance::~WorkspaceInstance(void) { } diff --git a/src/source/Globals.cpp b/src/source/Globals.cpp index fc67cba..d24c61b 100644 --- a/src/source/Globals.cpp +++ b/src/source/Globals.cpp @@ -12,6 +12,7 @@ std::vector postRenderStack = std::vector(); std::vector g_selectedInstances = std::vector(); DataModelInstance* g_dataModel = NULL; +XplicitNgine* g_xplicitNgine = NULL; bool running = false; G3D::TextureRef Globals::surface; diff --git a/src/source/PropertyWindow.cpp b/src/source/PropertyWindow.cpp index 1be5656..d32641b 100644 --- a/src/source/PropertyWindow.cpp +++ b/src/source/PropertyWindow.cpp @@ -1,7 +1,7 @@ #define _WINSOCKAPI_ #include #include "WindowFunctions.h" -#include "../../resource.h" +#include "resource.h" #include "PropertyWindow.h" #include "Globals.h" #include "strsafe.h" diff --git a/src/source/Tool/ArrowTool.cpp b/src/source/Tool/ArrowTool.cpp index f6f9c7a..9bbd1b4 100644 --- a/src/source/Tool/ArrowTool.cpp +++ b/src/source/Tool/ArrowTool.cpp @@ -69,30 +69,6 @@ void ArrowTool::onKeyDown(int key) { lctrlDown = true; } - else if(key == 'R') - { - if(g_selectedInstances.size() > 0) - { - Instance* selectedInstance = g_selectedInstances.at(0); - AudioPlayer::playSound(clickSound); - if(PartInstance* part = dynamic_cast(selectedInstance)) - { - part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,toRadians(90),0)); - } - } - } - else if(key == 'T') - { - if(g_selectedInstances.size() > 0) - { - Instance* selectedInstance = g_selectedInstances.at(0); - AudioPlayer::playSound(clickSound); - if(PartInstance* part = dynamic_cast(selectedInstance)) - { - part->setCFrame(part->getCFrame()*Matrix3::fromEulerAnglesXYZ(0,0,toRadians(90))); - } - } - } } void ArrowTool::onKeyUp(int key) diff --git a/src/source/XplicitNgine/XplicitNgine.cpp b/src/source/XplicitNgine/XplicitNgine.cpp new file mode 100644 index 0000000..afe5e1d --- /dev/null +++ b/src/source/XplicitNgine/XplicitNgine.cpp @@ -0,0 +1,117 @@ +#include "XplicitNgine/XplicitNgine.h" +#include "Globals.h" + +#define SIDE (0.5f) +#define MASS (1.0) + +// constraints +#define MAX_BODIES 65535 +#define OBJ_DENSITY (5.0) +#define MAX_CONTACT_PER_BODY 4 + +XplicitNgine::XplicitNgine() +{ + physWorld = dWorldCreate(); + physSpace = dHashSpaceCreate(0); + contactgroup = dJointGroupCreate(0); + + dWorldSetGravity(physWorld, 0, -0.5, 0); + dGeomID ground_geom = dCreatePlane(physSpace, 0, 1, 0, 0); +} + +XplicitNgine::~XplicitNgine() +{ + dJointGroupDestroy (contactgroup); + dSpaceDestroy (physSpace); + dWorldDestroy (physWorld); + dCloseODE(); +} + +void collisionCallback(void *data, dGeomID o1, dGeomID o2) +{ + int i,n; + + dBodyID b1 = dGeomGetBody(o1); + dBodyID b2 = dGeomGetBody(o2); + if (b1 && b2 && dAreConnected(b1, b2)) + return; + + const int N = 4; + dContact contact[N]; + n = dCollide (o1,o2,N,&contact[0].geom,sizeof(dContact)); + if (n > 0) { + for (i=0; iphysWorld,g_xplicitNgine->contactgroup,contact+i); + dJointAttach (c,dGeomGetBody(o1),dGeomGetBody(o2)); + } + } +} + +void XplicitNgine::createBody(PartInstance* partInstance) +{ + // calculate collisions + dSpaceCollide (physSpace,0,&collisionCallback); + + if(partInstance->physBody == NULL) + { + // init body + partInstance->physBody = dBodyCreate(physWorld); + + // init geom + partInstance->physGeom[0] = dCreateBox(physSpace, + partInstance->getSize()[0], + partInstance->getSize()[1], + partInstance->getSize()[2] + ); + + dVector3 result; + dGeomBoxGetLengths(partInstance->physGeom[0], result); + printf("[XplicitNgine] Part Geom Size: %.1f, %.1f, %.1f\n", + result[0], + result[1], + result[2] + ); + + printf("[XplicitNgine] Created Geom for PartInstance\n"); + + dBodySetPosition(partInstance->physBody, + partInstance->getPosition()[0], + partInstance->getPosition()[1], + partInstance->getPosition()[2] + ); + + printf("[XplicitNgine] Created Body for PartInstance\n"); + + dGeomSetBody(partInstance->physGeom[0], partInstance->physBody); + } else { + // There is 100% a better way of doing this, but for now, anchored parts can be like this? + if(partInstance->anchored) { + dBodySetPosition(partInstance->physBody, + partInstance->getPosition()[0], + partInstance->getPosition()[1], + partInstance->getPosition()[2] + ); + + dBodySetLinearVel(partInstance->physBody, 0, 0, 0); + } + + const dReal* physPosition = dBodyGetPosition(partInstance->physBody); + + // I hate matricies + const dReal* physRotation = dGeomGetRotation(partInstance->physGeom[0]); + partInstance->setPosition(Vector3(physPosition[0], physPosition[1], physPosition[2])); + + } + + dWorldQuickStep(physWorld,0.05); + dJointGroupEmpty(contactgroup); +} \ No newline at end of file diff --git a/src/source/main.cpp b/src/source/main.cpp index 40ec0d4..541355c 100644 --- a/src/source/main.cpp +++ b/src/source/main.cpp @@ -1,6 +1,10 @@ // TODO: Move toolbar buttons with resized window. -#include "winver.h" -#include "../../resource.h" +#define _WIN32_WINNT 0x0400 +#define _WIN32_WINDOWS 0x0400 +#define WINVER 0x0400 +#define _CRTBLD + +#include "resource.h" #include "Application.h" #include "WindowFunctions.h" #include "ax.h" @@ -144,12 +148,7 @@ LRESULT CALLBACK G3DProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int main(int argc, char** argv) { - - long double a = 1; - -#ifndef IGNORE_CATCH try{ -#endif hresult = OleInitialize(NULL); /* IInternetSecurityManager *pSecurityMgr; @@ -174,7 +173,7 @@ int main(int argc, char** argv) { icc.dwSize = sizeof(icc); icc.dwICC = ICC_WIN95_CLASSES/*|ICC_COOL_CLASSES|ICC_DATE_CLASSES| - // ICC_PAGESCROLLER_CLASS|ICC_USEREX_CLASSES*/; + ICC_PAGESCROLLER_CLASS|ICC_USEREX_CLASSES*/; InitCommonControlsEx(&icc); AudioPlayer::init(); @@ -215,12 +214,10 @@ int main(int argc, char** argv) { Globals::mainHwnd = hwndMain; Application app = Application(hwndMain); app.run(); - #ifndef IGNORE_CATCH } catch(...) { OnError(-1); } - #endif return 0; } diff --git a/src/source/propertyGrid.cpp b/src/source/propertyGrid.cpp index 8f27aab..2de3fae 100644 --- a/src/source/propertyGrid.cpp +++ b/src/source/propertyGrid.cpp @@ -31,12 +31,13 @@ //DWM 1.9: Suppress POCC Warning "Argument x to 'sscanf' does not match the format string; // expected 'unsigned char *' but found 'unsigned long'" -#include "winver.h" - #ifdef __POCC__ #pragma warn(disable:2234) #endif +#ifndef _WIN32_WINNT // Necessary for WM_MOUSEWHEEL support +#define _WIN32_WINNT 0x0400 +#endif // MSVC++ Support #ifndef _CRT_SECURE_NO_WARNINGS