Example #1
0
///////////////////////////////////////////////////////////////////////////////
//
// Main.
//
///////////////////////////////////////////////////////////////////////////////
int main(int arg, char **argc)
{
   glutInitWindowSize(WIDTH, HEIGHT);
   glutInitWindowPosition(100, 100);
   glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
   glutInit(&arg, argc);
   trackball(_gCurQuat, 0.0, 0.0, 0.0, 0.0);
   glutCreateWindow("OpenGL Deferred Shading");

   glutDisplayFunc(RenderScene);
   glutReshapeFunc(Resize);
   glutKeyboardFunc(KeyDown);
   glutMouseFunc(Mouse);
   glutMotionFunc(Motion);
   glutSpecialFunc(KeyDownSpecial);

   if(InitializeApp() == true)
      glutMainLoop();
   else
      printf("Error in InitializeApp()!\n\n");

   ShutdownApp();

   return 1;
}
Example #2
0
int SampleApp::Run()
{
    int retcode = -1;
    if (InitializeApp())
    {
        retcode = MainLoop();
    }
    TerminateApp();
    return retcode;
}
Example #3
0
static INT_PTR CALLBACK DialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg)
	{
	case WM_INITDIALOG:
		InitializeApp(hwndDlg,wParam,lParam);
		return TRUE;
	case WM_CLOSE:
		KillTimer (hwndDlg,Timer);
		EndDialog(hwndDlg,0);
		return TRUE;
	}
	return FALSE;
}
INT WINAPI wWinMain(HINSTANCE,HINSTANCE,LPWSTR,INT)
{
    (void)HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

    HWND hwnd = 0;

    if (InitializeApp() && InitializeWindow(&hwnd))
    {
        MessageLoop(hwnd);
    }

    CleanUp();

    return 0;
}
/*
	WinMain
*/
int CALLBACK WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    MSG    msg;
    HANDLE hAccel;

	// Store our module handle
    ghModule = GetModuleHandle(NULL);

	// Initialize QuickTime Media Layer
	InitializeQTML(0);

	// Initialize QuickTime
	EnterMovies();

	// Initialize the app
    if (!InitializeApp()) 
    {
        MessageBox(ghwndMain, "MDI: InitializeApp failure!", "Error", MB_OK);
        return 0;
    }

	// Load our accelerator keys
    if (!(hAccel = LoadAccelerators (ghModule, MAKEINTRESOURCE(ACCEL_ID))))
        MessageBox(ghwndMain, "MDI: Load Accel failure!", "Error", MB_OK);

	// Parse the command line for drag and drop
	ParseCmdLinePriv(NULL);

	// Loop for messages
    while (GetMessage(&msg, NULL, 0, 0)) {
        if (!TranslateAccelerator( ghwndMain, hAccel, &msg) &&
            !TranslateMDISysAccel(  ghwndClient, &msg)          ) {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

	// Deinitialize QuickTime
	ExitMovies();

	// Deinitialize QTML
	TerminateQTML();

    return TRUE;
}
Example #6
0
// Entry Point
int main(int argc, char *argv[])
{
	// Init SDL
	InitializeApp();

	// Init Window
	Display display = {};
	Display_Initialize(&display, 
		FIXED_WIDTH, 
		FIXED_HEIGHT, 
		"Tècniques Intel·ligència Artificial per a Videojocs");

	// Init Gamepad Input
	InputSingleton::Instance()->Init();

	// Init StateManager
	StateManager manager = {};
	manager.display = &display;
	manager.switcherCallback = &SwitcherCallbackFunction;

	// Init State
	MenuState* menuState = new MenuState();
	menuState->display = &display;
	StateManager_ChangeState(&manager, menuState);

	// Loop
	StateManager_RunCurrentState(&manager);

	// Finish StateManager
	StateManager_Free(&manager);

	// Finish Gamepad Input
	InputSingleton::Instance()->Deinit();

	// Finish Window
	Display_Free(&display);

	// Finish SDL
	CloseApp();

	return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
	//This comes from the LicenseUtilities.h, not included with this code.
	if (!InitializeApp())
	{
		AoExit(0);
	}

	try{
		//These are the fields I am updating in addition to the location of the feature and the feature itself.
		const CComBSTR dataPath = "C:\\Users\\alex7370\\Documents\\CPPSample.gdb";
		const CComBSTR featureClassName = "PointFeature";
		const CComBSTR helloField = "Hello";

		std::cerr << "Environmental Systems Reasearch Institute" << std::endl << std::endl;

		std::cerr << "Creating the workspace..." << std::endl;
		IWorkspaceFactory2Ptr workspacePtr(CLSID_FileGDBWorkspaceFactory);
		IWorkspacePtr workspace;
		HRESULT hr = workspacePtr->OpenFromFile(dataPath, 0, &workspace);
		if (FAILED(hr) || workspace == 0)
		{
			std::cerr << "Could not open the workspace." << std::endl;
			return E_FAIL;
		}
		std::cerr << "Casting to a feature workspace..." << std::endl;
		IFeatureWorkspacePtr featureWorkspace = workspace;
		IFeatureClassPtr featureClass;
		std::cerr << "Opening the feature class..." << std::endl;
		hr = featureWorkspace->OpenFeatureClass(featureClassName, &featureClass);
		if (FAILED(hr) || featureClass == 0)
		{
			std::cerr << "Could not open the feature class." << std::endl;
			return E_FAIL;
		}
		IFeatureBufferPtr featureBuffer;
		std::cerr << "Creating the feature buffer..." << std::endl;
		hr = featureClass->CreateFeatureBuffer(&featureBuffer);
		if (FAILED(hr) || featureClass == 0)
		{
			std::cerr << "Could not create the feature class." << std::endl;
			return E_FAIL;
		}

		IFeatureCursorPtr cursor;
		std::cerr << "Opening the feature Cursor..." << std::endl;
		hr = featureClass->Insert(VARIANT_TRUE, &cursor);
		if (FAILED(hr) || cursor == 0)
		{
			std::cerr << "Could not create the feature cursor." << std::endl;
			return E_FAIL;
		}
		IFieldsPtr fields;
		long index;
		CComVariant helloFieldMessage("Hello World");

		std::cerr << "Finding Hello Field and placing value..." << std::endl;
		 featureBuffer->get_Fields(&fields);
		fields->FindField(helloField, &index);
		featureBuffer->put_Value(index, helloFieldMessage);

		std::cerr << "Creating the point geometry to place in my feature class..." << std::endl;
		IPointPtr point(CLSID_Point);
		point->put_X(0);
		point->put_Y(0);
		IGeometryPtr geometry = point;

		std::cerr << "Placing the point in the buffer..." << std::endl;
		featureBuffer->putref_Shape(geometry);
		VARIANT id;
		std::cerr << "Inserting buffer into the table..." << std::endl;
		cursor->InsertFeature(featureBuffer, &id);
		std::cerr << "Feature " << id.intVal << " inserted..." << std::endl;
		cursor->Flush();


		std::cerr << "Done." << std::endl;
	}
	catch (_com_error e)
	{
		TCHAR str[255];
		BSTR bstr = BSTR(e.Description());
		if (bstr)
			wsprintf(str, _T("Known Error : \n %ls"), bstr);
		else
			wsprintf(str, _T("Unknown Error..\n"));
		return E_FAIL;
	}
	AoExit(0);

	return 0;



}
Example #8
0
int PASCAL WinMain(HANDLE hInstance,
                   HANDLE hPrevInstance, LPSTR lpszCmdLine, int iCmd)

{
    int i;
    MSG msg;
    LPSTR pch,pch1;
    WORD    ret;
    WOWINFO wowinfo;
    char aszWOWDEB[CCHMAX];
    LPSTR pchWOWDEB;
    HANDLE hMMDriver;


    char        szBuffer[150];
    BOOL        bFinished;
    int         iStart;
    int         iEnd;


    hAppInstance = hInstance ;

    // Only Want One WOWExec
    if (hPrevInstance != NULL) {
        return(FALSE);
    }

    if (!InitializeApp(lpszCmdLine)) {
        OutputDebugString("WOWEXEC: InitializeApp failure!\n");
        return 0;
    }

/*
 * Look for a drivers= line in the [boot] section of SYSTEM.INI
 * If present it is the 16 bit MultiMedia interface, so load it
 */

#ifdef OLD_MMSYSTEM_LOAD
    if (GetPrivateProfileString((LPSTR)"boot", (LPSTR)"drivers",(LPSTR)"", aszMMDriver, sizeof(aszMMDriver), (LPSTR)"SYSTEM.INI")) {
/*
 * We have now discovered an app that rewrites the "drivers" entry with
 * multiple drivers - so the existing load method fails. As a temporary fix
 * while we decide what the "proper" fix is I will always load MMSYSTEM and
 * ONLY MMSYSTEM.
 *
 *       aszMMDriver[sizeof(aszMMDriver)-1] = '\0';
 *       hMMDriver = LoadLibrary((LPSTR)aszMMDriver);
 * #ifdef DEBUG
 *       if (hMMDriver < 32) {
 *           OutputDebugString("WOWEXEC: Load of MultiMedia driver failed\n");
 *       }
 * #endif
 */
        LoadLibrary("MMSYSTEM.DLL");
    }
#else
    /* Load DDL's from DRIVERS section in system.ini
     */
    GetPrivateProfileString( (LPSTR)"boot",      /* [Boot] section */
                            (LPSTR)"drivers",   /* Drivers= */
                            (LPSTR)"",          /* Default if no match */
                            szBuffer,    /* Return buffer */
                            sizeof(szBuffer),
                            (LPSTR)"system.ini" );

    if (!*szBuffer) {
        goto Done;
    }

    bFinished = FALSE;
    iStart    = 0;

    while (!bFinished) {
        iEnd = iStart;

        while (szBuffer[iEnd] && (szBuffer[iEnd] != ' ') &&
               (szBuffer[iEnd] != ',')) {
            iEnd++;
        }

        if (szBuffer[iEnd] == NULL) {
            bFinished = TRUE;
        }
        else {
            szBuffer[iEnd] = NULL;
        }

        /* Load and enable the driver.
         */
        OpenDriver( &(szBuffer[iStart]), NULL, NULL );
        iStart = iEnd + 1;
    }

Done:

#endif

/*
 * Look for a debug= line in the [boot] section of SYSTEM.INI
 * If present it is the 16 bit MultiMedia interface, so load it
 */

    if ( WOWQueryDebug() & 0x0001 ) {
        pchWOWDEB = "WOWDEB.EXE";
    } else {
        pchWOWDEB = "";
    }

    GetPrivateProfileString((LPSTR)"boot", (LPSTR)"debug",pchWOWDEB, aszWOWDEB, sizeof(aszWOWDEB), (LPSTR)"SYSTEM.INI");
    aszWOWDEB[sizeof(aszWOWDEB)-1] = '\0';

    if ( lstrlen(pchWOWDEB) != 0 ) {
        WinExec((LPSTR)aszWOWDEB,SW_SHOW);
    }

#if 0
/*  Preload winspool.exe.   Apps will keep loading and freeing it
 *  which is slow.   We might as well load it now so the reference
 *  count is 1 so it will never be loaded or freed
 */
    //
    // Disabled load of winspool.exe to save 8k.  Size vs. speed,
    // which one do we care about?  Right now, size!
    //
    LoadLibrary("WINSPOOL.EXE");
#endif

    // Always load SHELL.DLL, FileMaker Pro and Lotus Install require it.

    LoadLibrary("SHELL.DLL");

    //
    // Start any apps pending in basesrv queue
    //

    while (StartRequestedApp() && gfSharedWOW) {
        /* null stmt */ ;
    }


    while (1)  {
        if (!WowWaitForMsgAndEvent(ghwndMain) &&
            PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) &&
            msg.message != WM_WOWEXECHEARTBEAT )
           {
            if (msg.message != WM_QUIT) {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }
    }

    return 1;
}