コード例 #1
0
ファイル: Window.cpp プロジェクト: carriercomm/Phobetor
void Window::SetMinimised(const bool minimised) {
	if (minimised) {
		glfwIconifyWindow(window);
	} else {
		glfwRestoreWindow(window);
	}
}
コード例 #2
0
JNIEXPORT void JNICALL Java_com_badlogic_jglfw_Glfw_glfwRestoreWindow(JNIEnv* env, jclass clazz, jlong window) {


//@line:780

		glfwRestoreWindow((GLFWwindow*)window);
	

}
コード例 #3
0
ファイル: Window.cpp プロジェクト: maxaction/RepriseMySponza
void Window::
setFullscreen(bool yes)
{
    if (yes) {
        glfwRestoreWindow(glfw_handle_);
    } else {
        glfwIconifyWindow(glfw_handle_);
    }
}
コード例 #4
0
ファイル: iconify.c プロジェクト: 2php/glfw
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    printf("%0.2f Key %s\n",
           glfwGetTime(),
           action == GLFW_PRESS ? "pressed" : "released");

    if (action != GLFW_PRESS)
        return;

    switch (key)
    {
        case GLFW_KEY_I:
            glfwIconifyWindow(window);
            break;
        case GLFW_KEY_M:
            glfwMaximizeWindow(window);
            break;
        case GLFW_KEY_R:
            glfwRestoreWindow(window);
            break;
        case GLFW_KEY_ESCAPE:
            glfwSetWindowShouldClose(window, GLFW_TRUE);
            break;
        case GLFW_KEY_F11:
        case GLFW_KEY_ENTER:
        {
            if (mods != GLFW_MOD_ALT)
                return;

            if (glfwGetWindowMonitor(window))
            {
                glfwSetWindowMonitor(window, NULL,
                                     windowed_xpos, windowed_ypos,
                                     windowed_width, windowed_height,
                                     0);
            }
            else
            {
                GLFWmonitor* monitor = glfwGetPrimaryMonitor();
                if (monitor)
                {
                    const GLFWvidmode* mode = glfwGetVideoMode(monitor);
                    glfwGetWindowPos(window, &windowed_xpos, &windowed_ypos);
                    glfwGetWindowSize(window, &windowed_width, &windowed_height);
                    glfwSetWindowMonitor(window, monitor,
                                         0, 0, mode->width, mode->height,
                                         mode->refreshRate);
                }
            }

            break;
        }
    }
}
コード例 #5
0
ファイル: Window.cpp プロジェクト: Skweek/Old-Projects
void Windows::UpdateWindows()
{
	std::vector<Window*>::iterator pIter = WindowList.begin();
	for( ; pIter != WindowList.end(); ++pIter)
	{
		Window* pWindow = (*pIter);	
		int h, w;
		glfwGetWindowSize( pWindow->windowHandle, &w, &h );
		pWindow->pWindowSize = Vec2( (float)w, (float)h );
		pWindow->pProjection.Ortho( 0.f, pWindow->pWindowSize[0], 0.f, pWindow->pWindowSize[1], 0.f, 100.f );
		glfwSwapBuffers( pWindow->windowHandle );
		glfwRestoreWindow( pWindow->windowHandle );
	}
}
コード例 #6
0
ファイル: window.cpp プロジェクト: hkbruvold/x2D-Game-Engine
void Window::restore()
{
	glfwRestoreWindow(s_window);
}
コード例 #7
0
ファイル: main.cpp プロジェクト: alexgeek/CmakeCppTemplate
int main(void)
{
    GLFWwindow* window;


    int width = 1024;
    int height = 768;

    glfwSetErrorCallback (glfw_error_callback);
    if(!glfwInit ()) {
        fprintf (stderr, "ERROR: could not start GLFW3\n");
        return 1;
    }

	glfwWindowHint(GLFW_SAMPLES, 4);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
    glfwWindowHint (GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    // to use this: http://stackoverflow.com/questions/17923782/simple-opengl-image-library-soil-uses-deprecated-functionality
//	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); 
	glfwWindowHint(GLFW_OPENGL_PROFILE,	GLFW_OPENGL_COMPAT_PROFILE);

    /*glfwWindowHint(GLFW_SAMPLES, 1); // 2x antialiasing
    int stencil_bits = 8;

    glfwWindowHint(GLFW_STENCIL_BITS, 8); // request a stencil buffer for object selection*/
    glfwWindowHint(GLFW_ALPHA_BITS, 8);
    
    /* Create a windowed mode window and its OpenGL context */
    window = glfwCreateWindow(width, height, "Game", NULL, NULL);
    glfwRestoreWindow(window);
    if (!window)
    {
        glfwTerminate();
        return -1; 
    }
    /* Make the window's context current */
    glfwMakeContextCurrent(window);
    
  
    // start GLEW extension handler
    glewExperimental = GL_TRUE;
    
    GLenum err = glewInit();
    if(err != GLEW_OK)
    {
        cout << "GLEW error: " << glewGetErrorString(err);
        exit(1); // or handle the error in a nicer way
    }
    GLenum glErr = glGetError();
    if (glErr != GL_NO_ERROR)
    {
        cout << "Caught GLEW init error in GL" << endl;
    }

    printOpenGLError();
            
    // get version info
    const GLubyte* gl_renderer = glGetString (GL_RENDERER); // get renderer string
    const GLubyte* gl_version = glGetString (GL_VERSION); // version as a string
    int gl_alpha;
    glGetIntegerv(GL_ALPHA_BITS, &gl_alpha);
    printf ("Renderer: %s\n", gl_renderer);
    printf ("OpenGL version supported %s\n", gl_version);
    printf ("Alphabits: %d", gl_alpha);
    
    glfwSwapInterval(1);
    
    printOpenGLError();
    cout << "Setting GL" << endl;
        
    //glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
    glClearColor(0.9f, 0.9f, 0.99f, 1.0f);
    glEnable(GL_DEPTH_TEST);
    glClearDepth(1.0f);
    glDepthFunc(GL_LESS);
	glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_CULL_FACE);

    glfwSetCharCallback(window, &Input::glfw_character_callback);
    glfwSetKeyCallback(window, &Input::glfw_key_callback);
    
    // create new Lua state
    lua_State *lua_state;
    lua_state = luaL_newstate();
    luaL_openlibs(lua_state);
 
    // load Lua libraries
    /*static const luaL_Reg lualibs[] =
    {
        { "base", luaopen_base },
        { "io", luaopen_io },
        { "string", luaopen_string },
        { NULL, NULL}
    };
 
    const luaL_Reg *lib = lualibs;
    for(; lib->func != NULL; lib++)
    {
        lib->func(lua_state);
        lua_settop(lua_state, 0);
    }*/
    
    lua_pushcfunction(lua_state, lua_set_camera);
    lua_setglobal(lua_state, "camera");
        
    lua_pushcfunction(lua_state, lua_drawcube);
    lua_setglobal(lua_state, "drawblock");
    
    lua_pushcfunction(lua_state, lua_load_renderer);
    lua_setglobal(lua_state, "load_renderer");
    
    lua_pushcfunction(lua_state, lua_drawbatch);
    lua_setglobal(lua_state, "drawbatch");
    
    lua_pushcfunction(lua_state, lua_time);
    lua_setglobal(lua_state, "time");
    
    run(lua_state, "class.lua");
    run(lua_state, "entity.lua");
    run(lua_state, "world.lua");
    run(lua_state, "component.lua");
    run(lua_state, "block.lua");
    run(lua_state, "physics.lua");
    run(lua_state, "load.lua");
    
    //camera = new CameraArcBall(glm::vec3(5,5,5), glm::vec3(0,0,0));
    
    //renderer.push_back(new RenderCube("assets/textures/grass.jpg", "assets/textures/dirt.jpg")); // default renderer?
        
    cout << "Starting main loop:" << endl;
    
    glm::vec3 size = glm::vec3(2);
    
    RenderQuad quad("assets/textures/jap.png", "inversion");
    RenderRect rect("assets/textures/tex16.png", "inversion2");
    
    BatchedRenderCube batch("assets/textures/dirt.jpg");
    
    cout << "[initmain]" << endl;
    printOpenGLError();
    
    /* Loop until the user closes the window */
    while (!glfwWindowShouldClose(window) && !glfwGetKey(window, GLFW_KEY_ESCAPE))
    {
        glfwGetWindowSize(window, &width, &height);
        glViewport(0, 0, width, height);
        
        //glClearStencil(0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT /*| GL_STENCIL_BUFFER_BIT*/);
        
        // update input and actions
        Input::instance().update(window);
        
        // update view and projection
        camera->update(window);
        
        if(glfwGetKey(window, 'U'))
            run(lua_state, "action.lua");
        
        run(lua_state, "update.lua");
        run(lua_state, "render.lua");
        
        if(glfwGetKey(window, 'F'))
            std::cout << "FPS: " << calcFPS(glfwGetTime()) << std::endl;
        if(glfwGetKey(window, 'Q'))
            screenshot();
            
        quad.draw(camera, glm::vec3(0, 0, 0));
        
        if(glfwGetKey(window, GLFW_KEY_ENTER))
            rect.draw(camera, glm::vec2(width, height));
            
        printOpenGLError();
        
        /* Swap front and back buffers */
        glfwSwapBuffers(window);
        /* Poll for and process events */
        glfwPollEvents();
    }
	// Cleanup VBO and shader
	//glDeleteBuffers(1, &vertexbuffer);
	//glDeleteProgram(shader.id());
    
    // close the Lua state
    lua_close(lua_state);
    glfwTerminate();
    return 0;
}
コード例 #8
0
ファイル: Window.cpp プロジェクト: bryongloden/kit
void kit::Window::restore()
{
  glfwRestoreWindow(this->m_glfwHandle);
}
コード例 #9
0
ファイル: lua-glfw.c プロジェクト: ifzz/lua-nanovg
static int Lwin_restore(lua_State *L) {
    GLFWwindow *win = (GLFWwindow*)lbind_check(L, 1, &lbT_Window);
    glfwRestoreWindow(win);
    lbind_returnself(L);
}
コード例 #10
0
void ofAppGLFWWindow::iconify(bool bIconify){
	if(bIconify)
		glfwIconifyWindow();
	else
		glfwRestoreWindow();
}