Beispiel #1
0
	value lime_application_create (value callback) {
		
		Application* application = CreateApplication ();
		Application::callback = new AutoGCRoot (callback);
		return CFFIPointer (application, gc_application);
		
	}
Beispiel #2
0
	value lime_application_create (value callback) {
		
		Application* app = CreateApplication ();
		Application::callback = new AutoGCRoot (callback);
		return alloc_float ((intptr_t)app);
		
	}
Beispiel #3
0
void android_main(android_app* const aApplication)
{
   app_dummy(); // Make sure glue isn't stripped
   Client::TAppPtr app = CreateApplication();
   native = std::make_shared<Client::CNativeAndroid>(aApplication->activity);
   LOG_INFO("MAIN START");
   engine = Client::IEngine::CreateEngine(native, app);

   // Init callbacks for the event loop
   android_poll_source* pSource;
   aApplication->onAppCmd = HandleCommand;
   aApplication->onInputEvent = HandleInput;

   // Main activity loop
   if (!engine->OnCreate(aApplication->savedState)) {
      ANativeActivity_finish(aApplication->activity);
   } else {
      while (!aApplication->destroyRequested)
      {
         // Process all pending events
         int result;
         int fileDescriptors;
         int events;
         android_poll_source* pSource;
         while ((result = ALooper_pollAll(0, &fileDescriptors, &events, (void**)&pSource)) >= 0)
         {
            if (pSource != NULL) { // Lifecycle or input event
               // Launch event app processing via aApplication->onAppCmd or aApplication->onInputEvent
               pSource->process(aApplication, pSource); 
            }

            // ... (check other data like sensors)

            // Check if we are exiting.
            if (aApplication->destroyRequested) {
               break;
            }
         }

         // Input handler is idle - so the app can draw a frame or do some stuff
         if (!aApplication->destroyRequested && native->IsReady()) {
            engine->OnIdle();
            engine->OnDrawFrame();
            native->Swap();
         }
      }
   }
   LOG_INFO("MAIN EXIT");
   engine.reset();
   native.reset();
   NLogging::FinishLogger();
}
Beispiel #4
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
{
	Application* pApp;

	globalInstance = hInstance;

	pApp = CreateApplication();

	pApp->Init();
	pApp->SceneInit();
	pApp->Run();

	delete pApp;
	return 0;
}
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
void Java_com_chilliworks_chillisource_core_CoreNativeInterface_initApplication(JNIEnv* in_env, jobject in_this)
{
	//get the java VM and init the Java Interface Manager
	JavaVM* javaVM;
	in_env->GetJavaVM(&javaVM);

	//create the MainThread
	CSBackend::Android::MainThreadId::Create();

	//create the application
	CSCore::Application* pApplication = CreateApplication();
	CSBackend::Android::JavaInterfaceManager::GetSingletonPtr()->GetJavaInterface<CSBackend::Android::CoreJavaInterface>()->SetApplication(pApplication);

	//setup other interfaces
	CSBackend::Android::TouchInputJavaInterface::SetupJavaInterface(javaVM);
	CSBackend::Android::WebViewJavaInterface::SetupJavaInterface(javaVM);
    
	//run the application
    pApplication->Init();
}
MainWindow::MainWindow(const std::string &simulationName)
{
  this->m_dw = NULL;
  this->m_gen = new Generator(simulationName);

  //
  // Menu
  //
  QMenu *menuFichier = menuBar()->addMenu("&File");
  /*
  QAction *menuOpen = menuFichier->addAction("Open");
  menuOpen->setDisabled(true);
  
  QAction *menuNew = menuFichier->addAction("New");
  menuNew->setDisabled(true);
  
  QAction *menuSave = menuFichier->addAction("Save");
  menuSave->setDisabled(true);
  
  QAction *menuSaveAs = menuFichier->addAction("Save as");
  menuSaveAs->setDisabled(true);
  */
  QAction *menuSavePix = menuFichier->addAction("Save as picture");
  connect(menuSavePix, SIGNAL(triggered()), this, SLOT(SavePicture()));
  
  QAction *menuXml = menuFichier->addAction("Save as XML");
  connect(menuXml, SIGNAL(triggered()), this, SLOT(SaveXml()));
  
  QAction *menuXmlLoad = menuFichier->addAction("Load XML file");
  connect(menuXmlLoad, SIGNAL(triggered()), this, SLOT(LoadXml()));

  QAction *actionQuit = menuFichier->addAction("Quit");
  connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));

  QMenu *menuEdit = menuBar()->addMenu("&Edit");
  QAction *actionConfig = menuEdit->addAction("Configuration");
  actionConfig->setDisabled(true);
  //connect(actionConfig, SIGNAL(triggered()), this, SLOT(ConfigurationMenu())); 

  QMenu *menuView = menuBar()->addMenu("&Generate");
  QAction *actionCpp = menuView->addAction("&C++");
  connect(actionCpp, SIGNAL(triggered()), this, SLOT(GenerateCpp())); 
  QAction *actionPython = menuView->addAction("&Python");
  connect(actionPython, SIGNAL(triggered()), this, SLOT(GeneratePython()));

  QMenu *menuHelp = menuBar()->addMenu("&Help");
  QAction *menuOnlineHelp = menuHelp->addAction("Online Help");
  menuOnlineHelp->setDisabled(true);
  //connect(menuOnlineHelp, SIGNAL(triggered()), this, SLOT(Help()));
  QAction *menuAbout = menuHelp->addAction("About");
  connect(menuAbout, SIGNAL(triggered()), this, SLOT(About())); 

  menuAbout = menuAbout;
  menuHelp = menuHelp;
  //
  // toolbar for add equipements.
  //
  QToolBar *toolBarFichier = addToolBar("");
  //PC
  QIcon pcIcon(":/Ico/Pc.png");
  QString pcString("Terminal");  
  QAction *pcAction = toolBarFichier->addAction(pcIcon, pcString);
  connect(pcAction, SIGNAL(triggered()), this, SLOT(CreatePc()));
  //Pc-group
  QIcon pcgIcon(":/Ico/Pc-group.png");
  QString pcgString("Terminal Group");  
  QAction *pcgAction = toolBarFichier->addAction(pcgIcon, pcgString);
  connect(pcgAction, SIGNAL(triggered()), this, SLOT(CreatePcGroup()));
  //PC-Emu
  QIcon emuIcon(":/Ico/Emu.png");
  QString emuString("PC with emu");  
  QAction *emuAction = toolBarFichier->addAction(emuIcon, emuString);
  connect(emuAction, SIGNAL(triggered()), this, SLOT(CreateEmu()));
  //PC-Tap
  QIcon tapIcon(":/Ico/Tap.png");
  QString tapString("PC with tap");  
  QAction *tapAction = toolBarFichier->addAction(tapIcon, tapString);
  connect(tapAction, SIGNAL(triggered()), this, SLOT(CreateTap()));
  //AP-Wifi
  QIcon apIcon(":/Ico/Ap-Wifi.png");
  QString apString("AP Wifi");  
  QAction *apAction = toolBarFichier->addAction(apIcon, apString);
  connect(apAction, SIGNAL(triggered()), this, SLOT(CreateAp()));
  //StationWifi
  QIcon stasIcon(":/Ico/StationWifi.png");
  QString stasString("Station Wifi");  
  QAction *stasAction = toolBarFichier->addAction(stasIcon, stasString);
  connect(stasAction, SIGNAL(triggered()), this, SLOT(CreateStation()));
  //Hub
  QIcon hubIcon(":/Ico/Hub.png");
  QString hubString("Hub");  
  QAction *hubAction = toolBarFichier->addAction(hubIcon, hubString);
  connect(hubAction, SIGNAL(triggered()), this, SLOT(CreateHub()));
  //Switch
  QIcon switchIcon(":/Ico/Switch.png");
  QString switchString("Switch");  
  QAction *switchAction = toolBarFichier->addAction(switchIcon, switchString);
  connect(switchAction, SIGNAL(triggered()), this, SLOT(CreateSwitch()));
  //Router
  QIcon routerIcon(":/Ico/Router.png");
  QString routerString("Router");  
  QAction *routerAction = toolBarFichier->addAction(routerIcon, routerString);
  connect(routerAction, SIGNAL(triggered()), this, SLOT(CreateRouter()));
  //separator
  toolBarFichier->addSeparator();
  // Wired Link
  QIcon linkIcon(":/Ico/WiredLink.png");
  QString linkString("Wired Link");  
  QAction *linkAction = toolBarFichier->addAction(linkIcon, linkString);
  connect(linkAction, SIGNAL(triggered()), this, SLOT(CreateWiredLink()));
  // Station link
  QIcon stasLinkIcon(":/Ico/Link.png");
  QString stasLinkString("Station Link");  
  QAction *stasLinkAction = toolBarFichier->addAction(stasLinkIcon, stasLinkString);
  connect(stasLinkAction, SIGNAL(triggered()), this, SLOT(CreateWifiLink()));
  //P2P link
  QIcon p2pLinkIcon(":/Ico/P2pLink.png");
  QString p2pLinkString("P2P Link");  
  QAction *p2pLinkAction = toolBarFichier->addAction(p2pLinkIcon, p2pLinkString);
  connect(p2pLinkAction, SIGNAL(triggered()), this, SLOT(CreateP2pLink()));
  //separator
  toolBarFichier->addSeparator();
  QIcon appsLinkIcon("");
  QString appsLinkString("Application");  
  QAction *appsLinkAction = toolBarFichier->addAction(appsLinkIcon, appsLinkString);
  connect(appsLinkAction, SIGNAL(triggered()), this, SLOT(CreateApplication()));
  //separator
  toolBarFichier->addSeparator();
  //Delete button
  QIcon delIcon(":/Ico/Del.png");
  QString delString("Delete");
  this->m_delAction = toolBarFichier->addAction(delIcon, delString);
  this->m_delAction->setDisabled (true);  
  connect(this->m_delAction, SIGNAL(triggered()), this, SLOT(DeleteObject()));

  //
  // Creation of Drag N Drop Area.
  //
  QHBoxLayout *dragLayout = new QHBoxLayout;
  this->m_dw = new DragWidget();

  dragLayout->addWidget(this->m_dw);

  QWidget *zoneCentral = new QWidget; 
  zoneCentral->setLayout(dragLayout);

  this->setCentralWidget(zoneCentral);

  //
  // 
  //
  this->m_dw->SetMainWindow(this);
}
Beispiel #7
0
#include <Xm/Xm.h>
#include <Xm/MainW.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/CascadeB.h>
#include <Xm/ScrolledW.h>
#include <Xm/Frame.h>
#include <Xm/MessageB.h>
#include <Xm/PushBG.h>


/*-------------------------------------------------------------
**	Forward Declarations
*/

Widget CreateApplication ();	/*  create main window		*/
Widget CreateFontSample ();	/*  create font display window	*/
Widget CreateHelp ();		/*  create help window		*/

void SelectFontCB ();		/*  callback for font buttons	*/
void CloseCB ();		/*  callback for close button	*/
void HelpCB ();			/*  callback for help button	*/
void QuitCB ();			/*  callback for quit button	*/



/*-------------------------------------------------------------
**	Global Variables
*/

#define MAX_ARGS 20
Beispiel #8
0
HRESULT CpiConfigureApplications(
    LPWSTR* ppwzData,
    HANDLE hRollbackFile
)
{
    HRESULT hr = S_OK;

    CPI_APPLICATION_ATTRIBUTES attrs;
    ::ZeroMemory(&attrs, sizeof(attrs));

    // read action text
    hr = CpiActionStartMessage(ppwzData, FALSE);
    ExitOnFailure(hr, "Failed to send action start message");

    // get count
    int iCnt = 0;
    hr = WcaReadIntegerFromCaData(ppwzData, &iCnt);
    ExitOnFailure(hr, "Failed to read count");

    // write count to rollback file
    hr = CpiWriteIntegerToRollbackFile(hRollbackFile, iCnt);
    ExitOnFailure(hr, "Failed to write count to rollback file");

    for (int i = 0; i < iCnt; i++)
    {
        // read attributes from CustomActionData
        hr = ReadApplicationAttributes(ppwzData, &attrs);
        ExitOnFailure(hr, "Failed to read attributes");

        // progress message
        hr = CpiActionDataMessage(1, attrs.pwzName);
        ExitOnFailure(hr, "Failed to send progress messages");

        if (S_FALSE == hr)
            ExitFunction();

        // write key to rollback file
        hr = CpiWriteKeyToRollbackFile(hRollbackFile, attrs.pwzKey);
        ExitOnFailure(hr, "Failed to write key to rollback file");

        // action
        switch (attrs.iActionType)
        {
        case atCreate:
            hr = CreateApplication(&attrs);
            ExitOnFailure1(hr, "Failed to create application, key: %S", attrs.pwzKey);
            break;
        case atRemove:
            hr = RemoveApplication(&attrs);
            ExitOnFailure1(hr, "Failed to remove application, key: %S", attrs.pwzKey);
            break;
        }

        // write completion status to rollback file
        hr = CpiWriteIntegerToRollbackFile(hRollbackFile, 1);
        ExitOnFailure(hr, "Failed to write completion status to rollback file");

        // progress
        hr = WcaProgressMessage(attrs.iActionCost, FALSE);
        ExitOnFailure(hr, "Failed to update progress");
    }

    hr = S_OK;

LExit:
    // clean up
    FreeApplicationAttributes(&attrs);

    return hr;
}
Beispiel #9
0
HRESULT CpiRollbackConfigureApplications(
    LPWSTR* ppwzData,
    CPI_ROLLBACK_DATA* pRollbackDataList
)
{
    HRESULT hr = S_OK;

    int iRollbackStatus;

    CPI_APPLICATION_ATTRIBUTES attrs;
    ::ZeroMemory(&attrs, sizeof(attrs));

    // read action text
    hr = CpiActionStartMessage(ppwzData, NULL == pRollbackDataList);
    ExitOnFailure(hr, "Failed to send action start message");

    // get count
    int iCnt = 0;
    hr = WcaReadIntegerFromCaData(ppwzData, &iCnt);
    ExitOnFailure(hr, "Failed to read count");

    for (int i = 0; i < iCnt; i++)
    {
        // read attributes from CustomActionData
        hr = ReadApplicationAttributes(ppwzData, &attrs);
        ExitOnFailure(hr, "Failed to read attributes");

        // rollback status
        hr = CpiFindRollbackStatus(pRollbackDataList, attrs.pwzKey, &iRollbackStatus);

        if (S_FALSE == hr)
            continue; // not found, nothing to rollback

        // progress message
        hr = CpiActionDataMessage(1, attrs.pwzName);
        ExitOnFailure(hr, "Failed to send progress messages");

        if (S_FALSE == hr)
            ExitFunction();

        // action
        switch (attrs.iActionType)
        {
        case atCreate:
            hr = CreateApplication(&attrs);
            if (FAILED(hr))
                WcaLog(LOGMSG_STANDARD, "Failed to create application, hr: 0x%x, key: %S", hr, attrs.pwzKey);
            break;
        case atRemove:
            hr = RemoveApplication(&attrs);
            if (FAILED(hr))
                WcaLog(LOGMSG_STANDARD, "Failed to remove application, hr: 0x%x, key: %S", hr, attrs.pwzKey);
            break;
        }

        // check rollback status
        if (0 == iRollbackStatus)
            continue; // operation did not complete, skip progress

        // progress
        hr = WcaProgressMessage(attrs.iActionCost, FALSE);
        ExitOnFailure(hr, "Failed to update progress");
    }

    hr = S_OK;

LExit:
    // clean up
    FreeApplicationAttributes(&attrs);

    return hr;
}
Beispiel #10
0
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF));

	OleInitialize(NULL);

	WNDCLASS wc;
	wc.cbClsExtra = 0; 
	wc.cbWndExtra = 0; 
	wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
	wc.hCursor= NULL; 
	wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION); 
	wc.hInstance = hInstance; 
	wc.lpfnWndProc = WndProc;
	wc.lpszClassName = WIN32_CLASS_NAME; 
	wc.lpszMenuName = NULL;
	wc.style = CS_HREDRAW | CS_VREDRAW;

	DWORD style = WS_OVERLAPPEDWINDOW;
	POINT pt = { CW_USEDEFAULT, CW_USEDEFAULT };
	SIZE sz = { CW_USEDEFAULT, CW_USEDEFAULT };

	RegisterClass(&wc);

#ifndef IN_EDITOR
	sz.cx = 1280;
	sz.cy = 720;
#endif

	HWND hWnd = CreateWindow(WIN32_CLASS_NAME, "Window", style, 
		pt.x, pt.y, sz.cx, sz.cy,
		NULL, NULL, hInstance, NULL);

	Util_SetDragFileCallback(hWnd, _OnOleDragFile);

	ShowWindow(hWnd, SW_SHOW);

	RECT rc;
	GetClientRect(hWnd, &rc);
	int width = rc.right - rc.left;
	int height = rc.bottom - rc.top;

	CharSet::SetCharSet("gbk");

	gCursor = new MGUI::Cursor;

	CreateApplication(&gApp);
	d_assert (gApp != NULL);

	gApp->Init(hInstance, hWnd, width, height);

	MSG msg;
	memset(&msg,0,sizeof(msg));
	while(msg.message != WM_QUIT)
	{
		if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else
		{
			gApp->Update();
		}
	}

	gApp->Shutdown();
	delete gApp;

	delete gCursor;

	UnregisterClass(WIN32_CLASS_NAME, hInstance);

	OleUninitialize();

	return 0;
}