Esempio n. 1
0
void _glfwSetVideoMode(int* width, int* height, int* rate)
{
    int bestmode;

    // Find a best match mode
    bestmode = _glfwGetClosestVideoMode(width, height, rate);

    // Change mode
    _glfwSetVideoModeMODE(bestmode, *rate);
}
Esempio n. 2
0
int _glfwOpenScreen( int *width, int *height, int *r, int *g, int *b,
    int refresh )
{
    int bpp, modeID;

    // Calculate BPP
    bpp = *r + *g + *b;

    // If colorbits < 8 (e.g. 0) or >= 24, default to 24 bpp
    if( bpp < 8 || bpp >= 24 )
    {
        *r = *g = *b = 8;
    }

    // Find best matching video mode
    modeID = _glfwGetClosestVideoMode( width, height, r, g, b, refresh );

    // Open screen
    _glfwWin.Screen = OpenScreenTags(
        NULL,
        SA_Width,     *width,
        SA_Height,    *height,
        SA_DisplayID, modeID,
        SA_Type,      CUSTOMSCREEN,
        SA_SysFont,   1,
        SA_ShowTitle, FALSE,
        TAG_DONE, 0
    );

    // Did we succeed?
    if( !_glfwWin.Screen )
    {
        printf( "Failed to open Amiga screen\n" );
        return GL_FALSE;
    }

    // Remember Mode ID
    _glfwWin.ModeID = modeID;

/*
    // Debugging information
    printf( "Amiga Screen opened:\n" );
    printf( "  ModeID:     0x%08X\n", modeID );
    printf( "  Dimensions: %d x %d\n", *width, *height );
    printf( "  Color bits: %d : %d : %d\n", *r, *g, *b );
*/

    return GL_TRUE;
}
Esempio n. 3
0
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
{
    int mode = 0, rate, sizeChanged = GL_FALSE;
    XSizeHints* sizehints;

    rate = window->refreshRate;

    if (window->mode == GLFW_FULLSCREEN)
    {
        // Get the closest matching video mode for the specified window size
        mode = _glfwGetClosestVideoMode(&width, &height, &rate);
    }

    if (!window->resizable)
    {
        // Update window size restrictions to match new window size

        sizehints = XAllocSizeHints();
        sizehints->flags = 0;

        sizehints->min_width  = sizehints->max_width  = width;
        sizehints->min_height = sizehints->max_height = height;

        XSetWMNormalHints(_glfwLibrary.X11.display, window->X11.handle, sizehints);
        XFree(sizehints);
    }

    // Change window size before changing fullscreen mode?
    if (window->mode == GLFW_FULLSCREEN && (width > window->width))
    {
        XResizeWindow(_glfwLibrary.X11.display, window->X11.handle, width, height);
        sizeChanged = GL_TRUE;
    }

    if (window->mode == GLFW_FULLSCREEN)
    {
        // Change video mode, keeping current refresh rate
        _glfwSetVideoModeMODE(mode, window->refreshRate);
    }

    // Set window size (if not already changed)
    if (!sizeChanged)
        XResizeWindow(_glfwLibrary.X11.display, window->X11.handle, width, height);
}