Пример #1
0
void RendererThread::Draw()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	DrawWallpaper();
	DrawEngines();
	DrawIcons();
}
Пример #2
0
void DemoState::AdvanceFrame(float delta_time) {
  HandleInput();
  UpdateIcons(delta_time);
  audio_engine_.AdvanceFrame(delta_time);
  RemoveInvalidSounds();
  SDL_RenderClear(renderer_);
  DrawInstructions();
  DrawIcons();
  SDL_RenderPresent(renderer_);
  SDL_Delay(kDelayMilliseconds);
}
Пример #3
0
void golly_render::pixblit(int x, int y, int w, int h, char* pmdata, int pmscale)
{
    // is Tom's hashdraw code doing unnecessary work???
    if (x >= currwd || y >= currht) return;
    if (x + w <= 0 || y + h <= 0) return;

    // stride is the horizontal pixel width of the image data
    int stride = w/pmscale;

    // clip data outside viewport
    if (pmscale > 1) {
        // pmdata contains 1 byte per `pmscale' pixels, so we must be careful
        // and adjust x, y, w and h by multiples of `pmscale' only
        if (x < 0) {
            int dx = -x/pmscale*pmscale;
            pmdata += dx/pmscale;
            w -= dx;
            x += dx;
        }
        if (y < 0) {
            int dy = -y/pmscale*pmscale;
            pmdata += dy/pmscale*stride;
            h -= dy;
            y += dy;
        }
        if (x + w >= currwd + pmscale) w = (currwd - x + pmscale - 1)/pmscale*pmscale;
        if (y + h >= currht + pmscale) h = (currht - y + pmscale - 1)/pmscale*pmscale;
    }

    int numstates = currlayer->algo->NumCellStates();
    if (pmscale == 1) {
        // draw rgb pixel data at scale 1:1
        if (drawing_paste || numstates == 2) {
            // we can't use DrawTexture to draw paste image because glTexImage2D clobbers
            // any background pattern, so we use DrawPoints which is usually faster than
            // DrawTexture in a sparsely populated universe with only 2 states (eg. Life)
            DrawPoints((unsigned char*) pmdata, x, y, w, h);
        } else {
            DrawTexture((unsigned char*) pmdata, x, y, w, h);
        }
    } else if (showicons && pmscale > 4 && icontextures) {
        // draw icons at scales 1:8 or above
        DrawIcons((unsigned char*) pmdata, x, y, w/pmscale, h/pmscale, pmscale, stride);
    } else {
        // draw magnified cells, assuming pmdata contains (w/pmscale)*(h/pmscale) bytes
        // where each byte contains a cell state
        if (numstates == 2) {
            DrawMagnifiedTwoStateCells((unsigned char*) pmdata, x, y, w/pmscale, h/pmscale, pmscale, stride);
        } else {
            DrawMagnifiedCells((unsigned char*) pmdata, x, y, w/pmscale, h/pmscale, pmscale, stride, numstates);
        }
    }
}