Esempio n. 1
0
    void run()
    {
        initialiseJuce_GUI();
        initialised = true;

        MessageManager::getInstance()->setCurrentThreadAsMessageThread();

        while ((! threadShouldExit()) && MessageManager::getInstance()->runDispatchLoopUntil (250))
        {}
    }
Esempio n. 2
0
void PLUGINHOST_init(void){
#if TEST_GET_MAX_VAL
  testing();
  exit(0);
#endif
  
#if JUCE_LINUX // Seems like a separate thread is only necessary on linux.

  JuceThread *juce_thread = new JuceThread;
  juce_thread->startThread();

  while(juce_thread->isInited.get()==0)
    Thread::sleep(20);
  
#else
  
  initialiseJuce_GUI();

#endif
}
Esempio n. 3
0
LUCE_API int luaopen_luce_core_d (lua_State *L) {
#else
LUCE_API int luaopen_luce_core (lua_State *L) {
#endif
    LUA::Set(L);
    DBG("LUCE " JUCE_STRINGIFY(LUCE_VERSION_MAJOR) "." JUCE_STRINGIFY(LUCE_VERSION_MINOR));
    juce::JUCEApplicationBase::createInstance = &juce_CreateApplication;
    initialiseJuce_GUI();

    lua_newtable(L);
    int i = lua_gettop(L);
    for (int f = 0; luce_lib[f].name ; ++f ) {
        DBG(String("adding ") +luce_lib[f].name );
        lua_pushstring(L,luce_lib[f].name);
        lua_pushcfunction(L, luce_lib[f].func);
        lua_settable(L, i);
    }
    register_enums(L);
    return 1;
}
Esempio n. 4
0
int start_controlled( lua_State *L ) {
    LUA::Set(L);
    #if JUCE_IOS
    return 0;
    #else
    LJUCEApplication *mc = Luna<LJUCEApplication>::check(L, 2); // luaL_ref pop'ed the cb function
    mainClass = mc;
    juce::JUCEApplicationBase::createInstance = &juce_CreateApplication;
    initialiseJuce_GUI();
    LApp = juce::JUCEApplicationBase::createInstance();
    if (LApp==nullptr || !LApp->initialiseApp()) {
        if(LApp!=nullptr)LApp->shutdown();
        lua_pushstring(L,"LUCE ERROR: Couldn't initialise app");
        lua_error(L);
        return 0;
    }
    lua_pushcclosure(L, tick, 0);
    return 1;
    #endif
}
Esempio n. 5
0
LUCE_API int luaopen_core(lua_State *L) {
    LUA::Set(L);
    DBG("LUCE " JUCE_STRINGIFY(LUCE_VERSION_MAJOR) "." JUCE_STRINGIFY(LUCE_VERSION_MINOR));
    juce::JUCEApplicationBase::createInstance = &juce_CreateApplication;

    // X11 requires this at this point, but OS X can't stand it this soon
    #if ! JUCE_MAC && ! JUCE_IOS && ! JUCE_ANDROID
    initialiseJuce_GUI();
    #endif

    #if LUA_VERSION_NUM > 501
    #ifdef DEBUG
    luaL_requiref(L, "luce.core", luaopen_luce_core_d, 1);
    #else
    luaL_requiref(L, "luce.core", luaopen_luce_core, 1);
    #endif
    #else
    luaL_register(L, "luce.core", luce_lib);
    register_enums(L);
    #endif

    return 0;
}
Esempio n. 6
0
int main (int argc, char* argv[])
{
    // This object makes sure that Juce is initialised and shut down correctly
    // for the scope of this function call. Make sure this declaration is the
    // first statement of this function.
    const ScopedJuceInitialiser_NonGUI juceSystemInitialiser;
   
    printf ("\n\n--------------------------------\n Font Serialiser by Niall Moody\n--------------------------------\n\n");
   
    if (argc != 3)
    {
        printf (" Usage: FontSerialiser <filename> <fontname>\n\n");
        printf (" FontSerialiser will turn a font into a compressed binary file.\n\n\n");
       
        return 1;
    }
   
    // because we're not using the proper application startup procedure, we need to call
    // this explicitly here to initialise some of the time-related stuff..
    initialiseJuce_GUI();
   
    // get file and font name from command line arguments
    const File destFile (File::getCurrentWorkingDirectory().getChildFile (argv[1]));
    String fontName(argv[2]);
   
    // make sure the destination file can be written to
    OutputStream *destStream = destFile.createOutputStream();

    if (destStream == 0)
    {
        String error;
        error << "\nError : Couldn't open " << destFile.getFullPathName() << " for writing.\n\n";
        std::cout << error;
        destFile.deleteFile();
        shutdownSequence(destStream);
        return 2;
    }
   
    // make sure the font is installed on the current system
    StringArray fontNames = Font::findAllTypefaceNames();

    // for (int n = 0; n < fontNames.size(); n++)
    // {
    //     std::cout << fontNames[n] << std::endl;
    // }

    if(!fontNames.contains(fontName))
    {
        String error ("\nError: The font " + fontName + " does not exist in the system\n");
        std::cout << error;
         destFile.deleteFile();
        shutdownSequence(destStream);
        return 3;
    }
   
    // load the font as a system-Typeface
    Font font(fontName, 10, 0);
    if(!Typeface::createSystemTypefaceFor  (font))
    {
        String error ("\nError : Where's the font?\n\n");
        std::cout << error;
         destFile.deleteFile();
        shutdownSequence(destStream);
        return 4;
    }
   
   
    // copy the font-properties to a CustomTypeface
    CustomTypeface customTypeface;
    customTypeface.setCharacteristics(font.getTypefaceName(), font.getAscent(),
                                      font.isBold(), font.isItalic(), ' ');
    // Here's the important part: copy all glyphs to a new instance of CustomTypeface
    customTypeface.addGlyphsFromOtherTypeface( *font.getTypeface(), 0, 256);
   
   
    // finally write the typeface into the destination file
    customTypeface.writeToStream(*destStream);
   
    String op;
    op << "\nWrote font " << fontName << " to file " << destFile.getFullPathName() << " successfully.\n\n";
    std::cout << op;
   
    std::cout << "\n(You might want to use Binary Builder to turn this file into a c++ file now)\n\n ";
   
    shutdownSequence(destStream);

    return 0;
}