Esempio n. 1
0
bool nuiInit(void* OSHandle = NULL, nuiKernel* pKernel)
{
  //printf("nuiInit(%d)\n", gNUIReferences);
  if (gNUIReferences == 0)
  {
#ifdef WIN32
    WSADATA wsaData;   // if this doesn't work
    //WSAData wsaData; // then try this instead
    // MAKEWORD(1,1) for Winsock 1.1, MAKEWORD(2,0) for Winsock 2.0:
    int res = WSAStartup(MAKEWORD(1,1), &wsaData);
#endif
    
    if (!App)
    {      
#ifdef _WIN32_
      App = new nuiManualKernel(OSHandle, pKernel);
#else
      App = new nuiManualKernel(pKernel);
#endif
      App->CallOnInit();
    }

    // On iOS, init an AutoReleasePool:
#if defined(_UIKIT_)
    nui_autoreleasepool = [[NSAutoreleasePool alloc] init];
#endif

    // Init the texture manager:
    nuiTexture::InitTextures();
    
    
    // Init the font manager:
    
#if (defined _UIKIT_) && (!TARGET_IPHONE_SIMULATOR)
    nglIMemory Memory(gpnuiPhoneFontDB, gnuiPhoneFontDBSize);
    nuiFontManager::LoadManager(Memory, nglTime());
#else
    
    nglPath fontdb(ePathUserAppSettings);
    fontdb += nglString(NUI_FONTDB_PATH);
    
    if (fontdb.Exists() && fontdb.IsLeaf())
    {
      nglIFile db(fontdb);
      nuiFontManager::LoadManager(db, fontdb.GetLastMod());
    }  
    else
    {
      nuiFontManager::GetManager();
    }
    //#endif
#endif
    
    nuiDecoration::InitDecorationEngine();
    
  }
Esempio n. 2
0
bool nuiInit(void* OSHandle = NULL, nuiKernel* pKernel)
{
  if (gNUIReferences == 0)
  {
#ifdef WIN32
    WSADATA wsaData;   // if this doesn't work
    //WSAData wsaData; // then try this instead
    // MAKEWORD(1,1) for Winsock 1.1, MAKEWORD(2,0) for Winsock 2.0:
    int res = WSAStartup(MAKEWORD(1,1), &wsaData);
#endif

    if (!App)
    {
#ifdef _WIN32_
      App = new nuiManualKernel(OSHandle, pKernel);
#elif defined(_ANDROID_)
      App = new nuiManualKernel(OSHandle, pKernel);
#else
      App = new nuiManualKernel(pKernel);
#endif
      App->CallOnInit();
    }
    
    // On iOS, init an AutoReleasePool:
#if defined(_UIKIT_)
    nui_autoreleasepool = [[NSAutoreleasePool alloc] init];
#endif

#ifndef _MINUI3_
    // Init the texture manager:
    nuiTexture::InitTextures();

    // Init the font manager:


    nglPath fontdb(ePathUserAppSettings);
    fontdb += nglString(NUI_FONTDB_PATH);

    nuiFontManager::InitManager(fontdb);
    if (fontdb.Exists() && fontdb.IsLeaf())
    {
      nglIFile db(fontdb);
      nuiFontManager::LoadManager(db, fontdb.GetLastMod());
    }
#if !defined(_UIKIT_)
    else
    {
      nuiFontManager::GetManager();
    }
    
    nuiFontManager& rManager(nuiFontManager::GetManager(false));
    if (rManager.GetFontCount())
    {
      nglOFile db(fontdb, eOFileCreate);
      if (db.IsOpen())
        rManager.Save(db);
    }
#endif
    
    nuiDecoration::InitDecorationEngine();
    nuiDefaultDecoration::Init();
    nuiBuilder::Init();
#endif
  }