void generate_frame_buffer(void)
{
  uint x, y;
  for (y = 0; y < SPRITE_ENGINE_HEIGHT; y++) {
    for (x = 0; x < SPRITE_ENGINE_WIDTH; x++) {
      update_pixel(x, y);
    }
  }
}
Ejemplo n.º 2
0
/**
 * @brief calculate integral image values down to the given pixel
 *
 * @param ii		the integral image
 * @param target_x 	the x-coordinate to calculate (inclusive)
 * @param target_y 	the y-coordinate to calculate (inclusive)
 */
void koki_integral_image_advance( koki_integral_image_t *ii,
                                  uint16_t target_x, uint16_t target_y )
{
    uint16_t x, y;
    assert( target_x < ii->w );
    assert( target_y < ii->h );

    /* Advance in the x-direction, but not y first */
    for( x = ii->complete_x; x <= target_x; x++ )
        for( y=0; y < ii->complete_y; y++ )
            update_pixel( ii, x, y );
    ii->complete_x = target_x + 1;

    /* Now advance in the y-direction */
    for( x=0; x < ii->complete_x; x++ )
        for( y = ii->complete_y; y <= target_y; y++ )
            update_pixel( ii, x, y );
    ii->complete_y = target_y + 1;
}
Ejemplo n.º 3
0
void setup() {
  Serial.begin(115200);
  pixels.begin();
  pixels.setBrightness(BASE_BRIGHTNESS);

  reset_pixels();

  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  WiFi.hostname(HOSTNAME);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("WiFi connected");
  Serial.println(WiFi.localIP());

  if (!MDNS.begin(HOSTNAME)) {
    update_pixel(0, 200, 0, 0);
    Serial.println("Error setting up MDNS responder!");
    while (1) {
      delay(1000);
    }
  }
  Serial.println("mDNS responder started");

  update_pixel(0, 0, 200, 0);
  pixels.show();

  server.begin();
  MDNS.addService("http", "tcp", 80);
}
Ejemplo n.º 4
0
static void nbmj8991_gfxdraw(running_machine &machine)
{
	nbmj8991_state *state = machine.driver_data<nbmj8991_state>();
	UINT8 *GFX = machine.region("gfx1")->base();
	int width = machine.primary_screen->width();

	int x, y;
	int dx1, dx2, dy;
	int startx, starty;
	int sizex, sizey;
	int skipx, skipy;
	int ctrx, ctry;
	UINT8 color, color1, color2;
	int gfxaddr, gfxlen;

	nb1413m3_busyctr = 0;

	if (state->m_blitter_direction_x)
	{
		startx = state->m_blitter_destx;
		sizex = state->m_blitter_sizex ^ 0xff;
		skipx = 1;
	}
	else
	{
		startx = state->m_blitter_destx + state->m_blitter_sizex;
		sizex = state->m_blitter_sizex;
		skipx = -1;
	}

	if (state->m_blitter_direction_y)
	{
		starty = state->m_blitter_desty;
		sizey = state->m_blitter_sizey ^ 0xff;
		skipy = 1;
	}
	else
	{
		starty = state->m_blitter_desty + state->m_blitter_sizey;
		sizey = state->m_blitter_sizey;
		skipy = -1;
	}

	gfxlen = machine.region("gfx1")->bytes();
	gfxaddr = (state->m_gfxrom << 17) + (state->m_blitter_src_addr << 1);

	for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
	{
		for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--)
		{
			if ((gfxaddr > (gfxlen - 1)))
			{
#ifdef MAME_DEBUG
				popmessage("GFXROM ADDRESS OVER!!");
#endif
				gfxaddr &= (gfxlen - 1);
			}

			color = GFX[gfxaddr++];

			dx1 = (2 * x + 0) & 0x3ff;
			dx2 = (2 * x + 1) & 0x3ff;
			dy = y & 0x1ff;

			if (!state->m_flipscreen)
			{
				dx1 ^= 0x1ff;
				dx2 ^= 0x1ff;
				dy ^= 0x1ff;
			}

			if (state->m_blitter_direction_x)
			{
				// flip
				color1 = (color & 0x0f) >> 0;
				color2 = (color & 0xf0) >> 4;
			}
			else
			{
				// normal
				color1 = (color & 0xf0) >> 4;
				color2 = (color & 0x0f) >> 0;
			}

			color1 = state->m_clut[((state->m_clutsel & 0x7f) * 0x10) + color1];
			color2 = state->m_clut[((state->m_clutsel & 0x7f) * 0x10) + color2];

			if (color1 != 0xff)
			{
				state->m_videoram[(dy * width) + dx1] = color1;
				update_pixel(machine, dx1, dy);
			}
			if (color2 != 0xff)
			{
				state->m_videoram[(dy * width) + dx2] = color2;
				update_pixel(machine, dx2, dy);
			}

			nb1413m3_busyctr++;
		}
Ejemplo n.º 5
0
static void
idle()
{
    if (pixcount < (unsigned long)(gwidth * gheight)) update_pixel();
}
Ejemplo n.º 6
0
void nbmj8991_state::gfxdraw()
{
	uint8_t *GFX = memregion("gfx1")->base();
	int width = m_screen->width();

	int x, y;
	int dx1, dx2, dy;
	int startx, starty;
	int sizex, sizey;
	int skipx, skipy;
	int ctrx, ctry;
	uint8_t color, color1, color2;
	int gfxaddr, gfxlen;

	m_nb1413m3->m_busyctr = 0;

	if (m_blitter_direction_x)
	{
		startx = m_blitter_destx;
		sizex = m_blitter_sizex ^ 0xff;
		skipx = 1;
	}
	else
	{
		startx = m_blitter_destx + m_blitter_sizex;
		sizex = m_blitter_sizex;
		skipx = -1;
	}

	if (m_blitter_direction_y)
	{
		starty = m_blitter_desty;
		sizey = m_blitter_sizey ^ 0xff;
		skipy = 1;
	}
	else
	{
		starty = m_blitter_desty + m_blitter_sizey;
		sizey = m_blitter_sizey;
		skipy = -1;
	}

	gfxlen = memregion("gfx1")->bytes();
	gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1);

	for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
	{
		for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--)
		{
			if ((gfxaddr > (gfxlen - 1)))
			{
#ifdef MAME_DEBUG
				popmessage("GFXROM ADDRESS OVER!!");
#endif
				gfxaddr &= (gfxlen - 1);
			}

			color = GFX[gfxaddr++];

			dx1 = (2 * x + 0) & 0x3ff;
			dx2 = (2 * x + 1) & 0x3ff;
			dy = y & 0x1ff;

			if (!m_flipscreen)
			{
				dx1 ^= 0x1ff;
				dx2 ^= 0x1ff;
				dy ^= 0x1ff;
			}

			if (m_blitter_direction_x)
			{
				// flip
				color1 = (color & 0x0f) >> 0;
				color2 = (color & 0xf0) >> 4;
			}
			else
			{
				// normal
				color1 = (color & 0xf0) >> 4;
				color2 = (color & 0x0f) >> 0;
			}

			color1 = m_clut[((m_clutsel & 0x7f) * 0x10) + color1];
			color2 = m_clut[((m_clutsel & 0x7f) * 0x10) + color2];

			if (color1 != 0xff)
			{
				m_videoram[(dy * width) + dx1] = color1;
				update_pixel(dx1, dy);
			}
			if (color2 != 0xff)
			{
				m_videoram[(dy * width) + dx2] = color2;
				update_pixel(dx2, dy);
			}

			m_nb1413m3->m_busyctr++;
		}
	}