Esempio n. 1
0
void Video::play_until_end( char *fileName, HINSTANCE hInstance, DWORD t)
{
	HANDLE  ahObjects[1];       // Handles that need to be waited on
	const int cObjects = 1;     // Number of objects that we have
	
	if(!init_success)
		return;

	hwnd = NULL;
#ifdef CREATE_DUMMY_WINDOW
	create_dummy_window(hInstance);
#endif

	play(fileName, t);

	while( state == PLAYING )
	{
		if( (ahObjects[ 0 ] = hGraphNotifyEvent) == NULL)
		{
			state = STOPPED;
			break;
		}
		DWORD Result = MsgWaitForMultipleObjects( cObjects, ahObjects,
			FALSE, INFINITE, QS_ALLINPUT);
		
		// Have we received an event notification
		if( Result >= WAIT_OBJECT_0 && Result < (WAIT_OBJECT_0 + cObjects) )
		{
			if( Result == WAIT_OBJECT_0 )
				on_graph_notify();
		}
		else if( Result == WAIT_OBJECT_0 + cObjects )
		{
			if( hwnd )
			{
				while (ProcessNextEvent() == 1) {};  // process everything we can
			}
		}
		else
		{
			// other event to wait ...
		}
	}

	if( hwnd )
	{
		DestroyWindow(hwnd);
	}
	hwnd = NULL;

	// after video end, go back to the game
	if( sys.init_flag )
	{
          ShowMainWindow();
	  FocusMainWindow();
	}
}
Esempio n. 2
0
/*!
 * \brief the main routine
 *
 * Sets up the windows and starts the simulation
 * \param argc count of arguments on the command line
 * \param argv array of the arguments
 */
int
main(int argc, char **argv)
{
	gint timerID;
	char *px, *ax, *py;

	max_path = (size_t)pathconf("/", _PC_PATH_MAX) + 1;
	exec_dir = strdup(argv[0]);
	px = strrchr(exec_dir, '/');
	if (px != NULL) {
		*px = '\0';
	} else {
		/* Trouble at't mine */
		char *cwd = getcwd(NULL, 0);
		free(exec_dir);
		exec_dir = cwd;
	}

	srand(time(NULL));
	/* fill in all the $'s in the pathsearch variable */
	py = calloc(1, 1024);
	px = pathsearch;
	while (NULL != (ax = strchr(px, '$'))) {
		strncat(py, px, ax - px);
		strncat(py, exec_dir, strlen(exec_dir));
		px = ax + 1;
	}
	strncat(py, px, strlen(px));
	pathsearch = py;

	gtk_init(&argc, &argv);

	bindtextdomain(PACKAGE, "../po");
	textdomain(PACKAGE);

	ResetViewable();
	SetUpMainWindow();

	PCityStartup();
	ConfigureNewGame();

	ShowMainWindow();

	/* start the timer */
	timerID = g_timeout_add(MILLISECS / TICKPERSEC,
	  (mainloop_callback), 0);

	gtk_main();
	WriteLog("Cleaning up\n");
	g_source_remove(timerID);
	free(exec_dir);
	free(pathsearch);
	PCityShutdown();
	cleanupMap();

	return (0);
}
Esempio n. 3
0
void LightUIOnTriggerOn(void* arg)
{
    FcitxLightUI* lightui = (FcitxLightUI*) arg;
    FcitxInstance *instance = lightui->owner;
    if (FcitxInstanceGetCurrentState(instance) == IS_ACTIVE)
    {
        DrawMainWindow(lightui->mainWindow);
        ShowMainWindow(lightui->mainWindow);
    }
    DrawTrayWindow(lightui->trayWindow);
}
Esempio n. 4
0
static void LightUIOnInputFocus(void *arg)
{
    FcitxLightUI* lightui = (FcitxLightUI*) arg;
    FcitxInstance *instance = lightui->owner;
    DrawMainWindow(lightui->mainWindow);
    if (FcitxInstanceGetCurrentStatev2(instance) == IS_ACTIVE)
    {
        ShowMainWindow(lightui->mainWindow);
    }
    DrawTrayWindow(lightui->trayWindow);
}
// Initialization for the application window, devices and
// DComp resources before entering the message loop
HRESULT Application::BeforeEnteringMessageLoop()
{
    HRESULT hr = S_OK;

    if (SUCCEEDED(hr))
    {
        hr = CreateMainWindow();
    }

    if (SUCCEEDED(hr))
    {
        hr = CreateD3DDevice();
    }

    if (SUCCEEDED(hr))
    {
        hr = CreateD2DDevice();
    }

    if (SUCCEEDED(hr))
    {
        hr = CreateDWriteFactory();
    }

    if (SUCCEEDED(hr))
    {
        hr = CreateDCompDevice();
    }

    if (SUCCEEDED(hr))
    {
        hr = CreateDCompVisualTree();
    }

    if (SUCCEEDED(hr))
    {
        hr = ShowMainWindow();
    }

    if (SUCCEEDED(hr))
    {
        hr = EnableMouseAsPointerDevice();
    }

    return hr;
}