Esempio n. 1
0
void
RenderPong(unsigned long dt)
{
    GFX_Clear(0);

    //draw ball
    GFX_PutPixel(roundf(g_pongBall.x), roundf(g_pongBall.y), 1);

    //draw player paddle
    GFX_DrawLine(g_player.x, DISPLAY_HEIGHT - 1,
                 g_player.x + PADDLE_WIDTH, DISPLAY_HEIGHT - 1);

    //draw comp paddle
    GFX_DrawLine(g_comp.x, 0, g_comp.x + PADDLE_WIDTH, 0);

    //decides for itself if it needs to be drawn.
    /* Glitchy screen bug introduced a while ago coming from here.
     No f*****g clue why. Heap corruption? Don't even know how to test
     for that. */
    DrawScoreScreen(&g_comp, &g_player, dt);

    GFX_SwapBuffers();
}
Esempio n. 2
0
/**
 * Draw a single tile on the screen.
 *
 * @param packed The tile to draw.
 */
void GUI_Widget_Viewport_DrawTile(uint16 packed)
{
	uint16 x;
	uint16 y;
	uint16 colour;
	uint16 spriteID;
	Tile *t;
	uint16 mapScale;

	colour = 12;
	spriteID = 0xFFFF;

	if (Tile_IsOutOfMap(packed) || !Map_IsValidPosition(packed)) return;

	x = Tile_GetPackedX(packed);
	y = Tile_GetPackedY(packed);

	mapScale = g_scenario.mapScale + 1;

	if (mapScale == 0 || BitArray_Test(g_displayedMinimap, packed)) return;

	t = &g_map[packed];

	if ((t->isUnveiled && g_playerHouse->flags.radarActivated) || g_debugScenario) {
		uint16 type = Map_GetLandscapeType(packed);
		Unit *u;

		if (mapScale > 1) {
			spriteID = g_scenario.mapScale + g_table_landscapeInfo[type].spriteID - 1;
		} else {
			colour = g_table_landscapeInfo[type].radarColour;
		}

		if (g_table_landscapeInfo[type].radarColour == 0xFFFF) {
			if (mapScale > 1) {
				spriteID = mapScale + t->houseID * 2 + 29;
			} else {
				colour = g_table_houseInfo[t->houseID].minimapColor;
			}
		}

		u = Unit_Get_ByPackedTile(packed);

		if (u != NULL) {
			if (mapScale > 1) {
				if (u->o.type == UNIT_SANDWORM) {
					spriteID = mapScale + 53;
				} else {
					spriteID = mapScale + Unit_GetHouseID(u) * 2 + 29;
				}
			} else {
				if (u->o.type == UNIT_SANDWORM) {
					colour = 255;
				} else {
					colour = g_table_houseInfo[Unit_GetHouseID(u)].minimapColor;
				}
			}
		}
	} else {
		Structure *s;

		s = Structure_Get_ByPackedTile(packed);

		if (s != NULL && s->o.houseID == g_playerHouseID) {
			if (mapScale > 1) {
				spriteID = mapScale + s->o.houseID * 2 + 29;
			} else {
				colour = g_table_houseInfo[s->o.houseID].minimapColor;
			}
		} else {
			if (mapScale > 1) {
				spriteID = g_scenario.mapScale + g_table_landscapeInfo[LST_ENTIRELY_MOUNTAIN].spriteID - 1;
			} else {
				colour = 12;
			}
		}
	}

	x -= g_mapInfos[g_scenario.mapScale].minX;
	y -= g_mapInfos[g_scenario.mapScale].minY;

	if (spriteID != 0xFFFF) {
		x *= g_scenario.mapScale + 1;
		y *= g_scenario.mapScale + 1;
		GUI_DrawSprite(g_screenActiveID, g_sprites[spriteID], x, y, 3, 0x4000);
	} else {
		GFX_PutPixel(x + 256, y + 136, colour & 0xFF);
	}
}
Esempio n. 3
0
char
GameInputTest(void)
{	
	unsigned char wheelPos = GLIB_GetInput(GLIB_WHEEL);
	unsigned char pb0State = GLIB_GetInput(GLIB_PB0);
	unsigned char pb1State = GLIB_GetInput(GLIB_PB1);
	unsigned char pb2State = GLIB_GetInput(GLIB_PB2);

	GFX_Clear(0);
	
	unsigned char characterSelect = wheelPos / 10;
	if (characterSelect > 35)
		characterSelect = 35;
		
	if (lastChar != characterSelect)
	{
		SND_Beep(1710, 25);
		lastChar = characterSelect;
	}
	
	if (pb0State)
	{
		GFX_PutPixel(3,0,1);
	}
	
	if (pb1State)
	{
		GFX_PutPixel(4,0,1);
	}
	
	if (pb2State)
	{
		GFX_PutPixel(5,0,1);
	}
	
	GFX_BitBLTF((const char * const)&g_alphaNumGlyphs[characterSelect][0], 
		3, 5, 0, 0);
	
	/*char string[2];
	string[0] = INP_PollEvents() + 48;
	string[1] = 0;
	CON_SendRAMString(string);
	CON_SendString(PSTR("\r\n"));*/
	
	unsigned char events = INP_PollEvents();
	if (GetBitUInt8(&events, INPUT_PB0_DOWN))
		CON_SendString(PSTR("b0.d\r\n"));
	
	if (GetBitUInt8(&events, INPUT_PB0_UP))
		CON_SendString(PSTR("b0.u\r\n"));	
	
	if (GetBitUInt8(&events, INPUT_PB1_DOWN))
		CON_SendString(PSTR("b1.d\r\n"));
	
	if (GetBitUInt8(&events, INPUT_PB1_UP))
		CON_SendString(PSTR("b1.u\r\n"));
	
	if (GetBitUInt8(&events, INPUT_PB2_DOWN))
		CON_SendString(PSTR("b2.d\r\n"));
	
	if (GetBitUInt8(&events, INPUT_PB2_UP))
		CON_SendString(PSTR("b2.u\r\n"));
	
	TME_DelayRealMillis(100);
	
	GFX_SwapBuffers();
	return 1;
}