コード例 #1
0
ファイル: window.cpp プロジェクト: soulik/LuaSDL-2.0
	int Window::updateRects(State & state, SDL_Window  * window){
		Stack * stack = state.stack;
		Rect * interfaceRect = state.getInterface<Rect>("LuaSDL_Rect");

		if (stack->is<LUA_TTABLE>(1)){
			int count = stack->objLen(1);
			int totalCount = 0;
			SDL_Rect * rects = new SDL_Rect[count];

			for (int i = 0; i < count; i++){
				stack->getField(i + 1, 1);
				SDL_Rect * r = interfaceRect->get(-1);
				if (r){
					rects[totalCount] = *r;
					totalCount++;
				}
			}

			int result = SDL_UpdateWindowSurfaceRects(window, rects, totalCount);
			delete[] rects;
			stack->push<bool>(result == 0);
			return 1;
		}
		return 0;
	}
コード例 #2
0
ファイル: ZWindow.cpp プロジェクト: zentelfong/ZuiLib
void ZWindow::Update(const ZRect * rects,int numrects)
{
	if (!rects)
	{
		SDL_UpdateWindowSurface(m_win);
	}
	else
	{
		SDL_UpdateWindowSurfaceRects(m_win,rects,numrects);
	}
}
コード例 #3
0
ファイル: SDL_compat.c プロジェクト: Blitzoreo/pcsx2-online
void
SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects)
{
    int i;

    if (screen == SDL_ShadowSurface) {
        for (i = 0; i < numrects; ++i) {
            SDL_LowerBlit(SDL_ShadowSurface, &rects[i], SDL_VideoSurface,
                          &rects[i]);
        }

        /* Fall through to video surface update */
        screen = SDL_VideoSurface;
    }
    if (screen == SDL_VideoSurface) {
        if (SDL_VideoViewport.x || SDL_VideoViewport.y) {
            SDL_Rect *stackrects = SDL_stack_alloc(SDL_Rect, numrects);
            SDL_Rect *stackrect;
            const SDL_Rect *rect;
            
            /* Offset all the rectangles before updating */
            for (i = 0; i < numrects; ++i) {
                rect = &rects[i];
                stackrect = &stackrects[i];
                stackrect->x = SDL_VideoViewport.x + rect->x;
                stackrect->y = SDL_VideoViewport.y + rect->y;
                stackrect->w = rect->w;
                stackrect->h = rect->h;
            }
            SDL_UpdateWindowSurfaceRects(SDL_VideoWindow, stackrects, numrects);
            SDL_stack_free(stackrects);
        } else {
            SDL_UpdateWindowSurfaceRects(SDL_VideoWindow, rects, numrects);
        }
    }
}