Exemplo n.º 1
0
bool courtEntity::initializeStateMachine()  // initializes the court entity object
{
    
    std::string func = "courtEntity::initializeStateMachine()";

    logMsg(func +" begin");
    
    if (!objectsInitialized)
    {
        logMsg(func +" Initializing objects!");
        objectsInitialized = initializeObjects();
    }
    else
    {
        logMsg(func +" Objects already initialized!");
    }
    
    courtSMData *initSMData(new courtSMData);
    
    initSMData->component = component;
    initSMData->cData = data;
    initSMData->flag = flag;
    
    stateMachine->pInitialize(initSMData);
    
    courtSMData *initCSMData(new courtSMData);
    
    initCSMData->component = component;
    stateMachine->pInitializeComponents(initCSMData);

    return (true);
}
Exemplo n.º 2
0
void Window::initializeGL() {
  if (!glfwInit()) {
    std::cout << "Failed to initialize GLFW." << std::endl;
    return;
  }

  glfwWindowHint(GLFW_SAMPLES, 4);
  glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, FLEXT_MAJOR_VERSION);
  glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, FLEXT_MINOR_VERSION);
  glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
  glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

  // Create window from parameters
  std::cout << "Creating GLFW window for OpenGL version " << FLEXT_MAJOR_VERSION
            << ", " << FLEXT_MINOR_VERSION << std::endl;
  auto window = glfwCreateWindow(1024, 768, "JungleIN", NULL, NULL);
  if (window == nullptr) {
    std::cout << "Failed to create GLFW window." << std::endl;
    glfwTerminate();
    return;
  }

  glfwMakeContextCurrent(window);
  glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_FALSE);

  // Load OpenGL extensions
  if (flextInit() != GL_TRUE) {
    glfwTerminate();
    std::cout << "Failed to initialize flextGL." << std::endl;
    return;
  }

  PRINT_GL_ERROR();
  glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
  PRINT_GL_ERROR();
  glDebugMessageCallback(&errorCallback, nullptr);
  PRINT_GL_ERROR();

  Utils::window = window;
  glfwShowWindow(window);

  //
  //  if (!strstr((char *)glGetString(GL_EXTENSIONS),
  //              "GL_EXT_texture_filter_anisotropic")) {
  Utils::USE_ANISO = false;
  Utils::MAX_ANISO = 0x0000;
  //  } else {
  //    Utils::USE_ANISO = true;
  //    float maxAniso;
  //    glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAniso);
  //    Utils::MAX_ANISO = maxAniso;
  //  }

  initializeObjects();
  PRINT_GL_ERROR();
}
Exemplo n.º 3
0
int mainSubASync(int argc, char* argv[])
{

	initializeObjects();
	readFile();
	printf("\n Broker URL is := %s \n",brokerUrl);

	initiliazeMQTT(argc,argv);

    MQTTClient client;
    MQTTClient_connectOptions conn_opts = MQTTClient_connectOptions_initializer;
    int rc;
    int ch;

    MQTTClient_create(&client, ADDRESS, CLIENTID,
        MQTTCLIENT_PERSISTENCE_NONE, NULL);
    conn_opts.keepAliveInterval = 20;
    conn_opts.cleansession = 1;

    MQTTClient_setCallbacks(client, NULL, connlost, msgarrvd, delivered);

    if ((rc = MQTTClient_connect(client, &conn_opts)) != MQTTCLIENT_SUCCESS)
    {
        printf("Failed to connect, return code %d\n", rc);
        exit(-1);
    }
    printf("Subscribing to topic %s\nfor client %s using QoS%d\n\n"
           "Press Q<Enter> to quit\n\n", TOPIC, CLIENTID, QOS);
    MQTTClient_subscribe(client, TOPIC, QOS);

//    do
//    {
//        ch = getchar();
//    } while(ch!='Q' && ch != 'q');

    while(1){
    	ch = getchar();
    	if(ch=='Q'){
    		printf("\n Quit! \n");
    	} else {
    		if(ch != '\n'){
    		ch=='0';
    		printf("\n Sending Message to publish \n");
    			publishMessage(userid);
    		}
    	}
    }

    MQTTClient_disconnect(client, 10000);
    MQTTClient_destroy(&client);
    return rc;
}
Exemplo n.º 4
0
void CScenePlay::initializeScene()
{
	// シーケンスを関数ポインタで管理
	Sequence[SEQ_BEGIN] = &CScenePlay::SequenceBegin;
	Sequence[SEQ_MAIN] = &CScenePlay::SequenceMain;
	Sequence[SEQ_PAUSE] = &CScenePlay::SequencePause;
	Sequence[SEQ_END] = &CScenePlay::SequenceEnd;
	
	// 最初のシーケンス
	SequenceState = SEQ_BEGIN;

	// 各パラメーター初期化
	initializeObjects();
	
	// ユーザーインターフェース初期化
	initializeUI();
}
Exemplo n.º 5
0
int main(int argc, char* argv[])
//int mainSubasync(int argc, char* argv[])
{

	initializeObjects();
	readFile();
	initiliazeMQTT(argc,argv);

    MQTTClient client;
    MQTTClient_connectOptions conn_opts_sub = MQTTClient_connectOptions_initializer;
    int rc;
    int ch;
    //ADDRESS =	brokerUrl;
    MQTTClient_create(&client, brokerUrl, CLIENTID,
        MQTTCLIENT_PERSISTENCE_NONE, NULL);
    conn_opts_sub.keepAliveInterval = 20;
    conn_opts_sub.cleansession = 1;

    MQTTClient_setCallbacks(client, NULL, connlost, msgarrvd, delivered);

    if ((rc = MQTTClient_connect(client, &conn_opts_sub)) != MQTTCLIENT_SUCCESS)
    {
        if(SUBASYNCLOGGER){
        	printf("Failed to connect, return code %d\n", rc);
        }
        exit(-1);
    }
//    if(SUBASYNCLOGGER){
//		printf("Subscribing to topic %s\nfor client %s using QoS%d\n\n"
//			   "Press Q<Enter> to quit\n\n", TOPIC, CLIENTID, QOS);
//    }
    MQTTClient_subscribe(client, TOPIC, QOS);

//    if(SUBASYNCLOGGER){
//    	printf("In Main pthread_create getpid: %d getpthread_self: %lu \n",getpid(), pthread_self());
//    }
    argv[1]	=	serialPort;
    argv[2]	=	"mon";
    mainGW(argc,argv);
    //mainGWMyHub(argc,argv);
    MQTTClient_disconnect(client, 10000);
    MQTTClient_destroy(&client);
    return rc;
}
void
GlFramework::initializeGL()
{
    glewExperimental = GL_TRUE;

    GLenum error = glewInit();
    if(error != GLEW_OK)
    {
        QMessageBox::critical(this, trUtf8("Erreur"), trUtf8("Echec de l'initialization de GLEW: %1").arg(reinterpret_cast<const char *>(glewGetErrorString(error))));
        exit(-1);
    }

    //glEnable(GL_CULL_FACE);
    glEnable( GL_DEPTH_TEST );
    glEnable(GL_LIGHTING); 	// Active l'éclairage
    glEnable(GL_LIGHT0);

    initializeObjects();
}
Exemplo n.º 7
0
int
newGame (const char *name)
{
    shProfession *profession;

    I->pageLog ();
    Clock = 0;

    randomizeIlkNames ();
    randomizeServiceNames ();
    initializeObjects ();
    addLizardBreaths ();

    shMapLevel::buildMaze ();
    Level = Maze.get (1);
    Hero.mLevel = Level;

    profession = chooseProfession ();
	Hero.init (name, profession);

    return 0;
}
Exemplo n.º 8
0
void
GlWindow::initializeGL()
{
    init();
    initializeObjects();
}