Пример #1
0
void WorldEdit::Update()
{
	if (keyboardPress(sf::Keyboard::Escape))
		GC->GSNext = Paul::MM;

	UpdateFlash();

	sf::FloatRect BoundingBox;
	
	for (int i = 0; i < Squares.size(); i++)
	{
		for (int j = 0; j < Squares[i].size(); j++)
		{
			if (Squares[i][j].getGlobalBounds().contains(GC->currentMousePosition.x, GC->currentMousePosition.y))
			{
				if (mousePress(LeftMouseButton))
					SquareColor[i][j] = sf::Color::Red;

				Squares[i][j].setFillColor(sf::Color(SquareColor[i][j].r, SquareColor[i][j].g, SquareColor[i][j].b, FlashAlphaColor));
			}
			else
				Squares[i][j].setFillColor(SquareColor[i][j]);
		}
	}
}
Пример #2
0
void MoveMonitor::Update(float dt)
{
	if ( IsStepOver() )
	{
		return ;
	}

	if ( m_nType == MoveType_Normal )
	{
		UpdateMove(dt);
	}
	else if( m_nType == MoveType_Flash )
	{
		UpdateFlash(dt); 
	}
}
Пример #3
0
//*****************************************************************************
//
//! main() is the programs main routine.
//!
//! \param argc is the number of parameters that were passed in via the command
//!     line.
//! \param argv is the list of strings that holds each parameter that was were
//!     passed in via the command line.
//!
//! This is the main routine for downloading an image to the device via the
//! UART.
//!
//! \return This function either returns a negative value indicating a failure
//!     or zero if the download was successful.
//
//*****************************************************************************
int32_t
main(int32_t argc, char **argv)
{
    FILE *hFile;
    FILE *hFileBoot;

    g_ui32DownloadAddress = 0;
    g_ui32StartAddress = 0xffffffff;
    g_pcFilename = 0;
    g_pcBootLoadName = 0;
    g_pui32BaudRate = 115200;
    g_ui32DataSize = 8;
    g_i32DisableAutoBaud = 0;

    setbuf(stdout, 0);

    //
    // Get any arguments that were passed in.
    //
    if(parseArgs(argc, argv))
    {
        printf("%s", pcUsageString);
        return(-1);
    }

    if(CheckArgs())
    {
        return(-1);
    }

    //
    // If a boot loader was specified then open it.
    //
    if(g_pcBootLoadName)
    {
        //
        // Open the boot loader file to download.
        //
        hFileBoot = fopen(g_pcBootLoadName, "rb");
        if(hFileBoot == 0)
        {
            printf("Failed to open file: %s\n", g_pcBootLoadName);
            return(-1);
        }
    }

    //
    // Open the file to download.
    //
    hFile = fopen(g_pcFilename, "rb");
    if(hFile == 0)
    {
        printf("Failed to open file: %s\n", g_pcFilename);
        return(-1);
    }

    if(OpenUART(g_pcCOMName, g_pui32BaudRate))
    {
        printf("Failed to configure Host UART\n");
        return(-1);
    }

    //
    // Now try to auto baud with the board by sending the Sync and waiting
    // for an ack from the board.
    //
    if(g_i32DisableAutoBaud == 0)
    {
        if(AutoBaud())
        {
            printf("Failed to synchronize with board.\n");
            return(-1);
        }
    }

    printf("\n");
    if(g_pcBootLoadName)
    {
        printf("Boot Loader    : %s\n", g_pcBootLoadName);
    }
    printf("Application    : %s\n", g_pcFilename);
    printf("Program Address: 0x%x\n", g_ui32DownloadAddress);
    printf("       COM Port: %s\n", g_pcCOMName);
    printf("      Baud Rate: %d\n", g_pui32BaudRate);

    printf("Erasing Flash:\n");

    //
    // If both a boot loader and an application were specified then update both
    // the boot loader and the application.
    //
    if(g_pcBootLoadName != 0)
    {
        if(UpdateFlash(hFile, hFileBoot, g_ui32DownloadAddress) < 0)
        {
            return(-1);
        }
    }
    //
    // Otherwise just update the application.
    //
    else if(UpdateFlash(hFile, 0, g_ui32DownloadAddress) < 0)
    {
        return(-1);
    }

    //
    // If a start address was specified then send the run command to the
    // boot loader.
    //
    if(g_ui32StartAddress != 0xffffffff)
    {
        //
        // Send the run command but just send the packet, there will likely
        // be no boot loader to answer after this command completes.
        //
        g_pui8Buffer[0] = COMMAND_RUN;
        g_pui8Buffer[1] = (uint8_t)(g_ui32StartAddress>>24);
        g_pui8Buffer[2] = (uint8_t)(g_ui32StartAddress>>16);
        g_pui8Buffer[3] = (uint8_t)(g_ui32StartAddress>>8);
        g_pui8Buffer[4] = (uint8_t)g_ui32StartAddress;
        if(SendPacket(g_pui8Buffer, 5, 0) < 0)
        {
            printf("Failed to Send Run command\n");
        }
        else
        {
            printf("Running from address %08x\n",g_ui32StartAddress);
        }
    }
Пример #4
0
/*
 * .KB_C_FN_DEFINITION_START
 * void ParseCommand(char *)
 *  This private function executes matching functions.
 * .KB_C_FN_DEFINITION_END
 */
static void
ParseCommand(char *buffer)
{
	int		argc, i;

	if ((argc = BreakCommand(buffer)) < 1)
		return;

	switch (StringToCommand(argv[0])) {
	case COMMAND_DUMP:
		// display boot commands
		DumpBootCommands();
		break;

	case COMMAND_EXEC:
	{
		// "e <address>"
		// execute at address
		void (*execAddr)(unsigned, unsigned);

		if (argc > 1) {
			/* in future, include machtypes (MACH_KB9200 = 612) */
			execAddr = (void (*)(unsigned, unsigned))
			    p_ASCIIToHex(argv[1]);
			(*execAddr)(0, 612);
		}
		break;
	}

	case COMMAND_TFTP:
	{
		// "tftp <local_dest_addr filename>"
		//  tftp download
		unsigned address = 0;

		if (argc > 2)
			address = p_ASCIIToHex(argv[1]);
		TFTP_Download(address, argv[2]);
		break;
	}

	case COMMAND_SERVER_IP:
		// "server_ip <server IP 192 200 1 20>"
		// set download server address
		if (argc > 4)
			SetServerIPAddress(BuildIP());
		break;

	case COMMAND_LOCAL_IP:
		// "local_ip <local IP 192 200 1 21>
		// set ip of this module
		if (argc > 4)
			SetLocalIPAddress(BuildIP());
		break;

	case COMMAND_MAC:
	{
		// "m <mac address 12 34 56 78 9a bc>
		// set mac address using 6 byte values
		unsigned char mac[6];

		if (argc > 6) {
			for (i = 0; i < 6; i++)
				mac[i] = p_ASCIIToHex(argv[i + 1]);
			EMAC_SetMACAddress(mac);
		}
		break;
	}

	case COMMAND_LOAD_SPI_KERNEL:
		// "k <address>"
		if (argc > 1)
			LoadKernelFromSpi((char *)p_ASCIIToHex(argv[1]));
		break;

	case COMMAND_XMODEM:
		// "x <address>"
		// download X-modem record at address
		if (argc > 1)
			xmodem_rx((char *)p_ASCIIToHex(argv[1]));
		break;

	case COMMAND_RESET:
		printf("Reset\n");
		reset();
		while (1) continue;
		break;

	case COMMAND_REPLACE_KERNEL_VIA_XMODEM:
		printf("Updating KERNEL image\n");
		UpdateFlash(KERNEL_OFFSET);
		break;
	case COMMAND_REPLACE_FLASH_VIA_XMODEM: 
		printf("Updating FLASH image\n");
		UpdateFlash(FLASH_OFFSET);
		break;

	case COMMAND_REPLACE_ID_EEPROM: 
	{
	    char buf[25];
		printf("Testing Config EEPROM\n");
		EEWrite(0, "This is a test", 15);
		EERead(0, buf, 15);
		printf("Found '%s'\n", buf);
		break;
	}
	default:
		break;
	}

	printf("\n");
}
Пример #5
0
void ObjectWidget::UpdateProperty(UInt32 type)
{
	switch(type)
	{
	// I'm not sure if you need each data type needs their own separate set of flags or not.
	// I'm assuming the show in combat/hide on death/Line of Sight checks are important but I don't know how
	// I'd apply it to magicka and stamina as well.
	case kPropertyType_Flags:
		{
			// Update visibility if necessary
			if((flags & kFlag_ShowInCombat) == kFlag_ShowInCombat || 
				(flags & kFlag_HideOutOfCombat) == kFlag_HideOutOfCombat || 
				(flags & kFlag_HideOnDeath) == kFlag_HideOnDeath) {
				TESForm * form = LookupFormByID(formId);
				if(form) {
					TESObjectREFR * reference = DYNAMIC_CAST(form, TESForm, TESObjectREFR);
					if(reference) {
						bool isVisible = false;
						bool isFriendly = false;
						QueryState(reference, &isVisible, &isFriendly);
						if(object.IsDisplayObject()) {
							GFxValue::DisplayInfo dInfo;
							dInfo.SetVisible(isVisible);
							object.SetDisplayInfo(&dInfo);
						}
					}
				}
			}
		}
		break;
	// Case fall through so it will keep going through the cases
	// until the break; statement is reached.
	case kPropertyType_HealthCurrentValue:
	case kPropertyType_HealthMaximumValue:
	case kPropertyType_MagickaCurrentValue:
	case kPropertyType_MagickaMaximumValue:
	case kPropertyType_StaminaCurrentValue:
	case kPropertyType_StaminaMaximumValue:
		UpdateValues();
		break;
	// Health Cases
	case kPropertyType_HealthPrimaryColor:
	case kPropertyType_HealthSecondaryColor:
	case kPropertyType_HealthFlashColor:
	case kPropertyType_HealthPrimaryFriendlyColor:
	case kPropertyType_HealthSecondaryFriendlyColor:
	case kPropertyType_HealthFlashFriendlyColor:
	// Magicka Cases
	case kPropertyType_MagickaPrimaryColor:
	case kPropertyType_MagickaSecondaryColor:
	case kPropertyType_MagickaFlashColor:
	case kPropertyType_MagickaPrimaryFriendlyColor:
	case kPropertyType_MagickaSecondaryFriendlyColor:
	case kPropertyType_MagickaFlashFriendlyColor:
	// Stamina Cases
	case kPropertyType_StaminaPrimaryColor:
	case kPropertyType_StaminaSecondaryColor:
	case kPropertyType_StaminaFlashColor:
	case kPropertyType_StaminaPrimaryFriendlyColor:
	case kPropertyType_StaminaSecondaryFriendlyColor:
	case kPropertyType_StaminaFlashFriendlyColor:
		UpdateColors();
		break;
	case kPropertyType_HealthFillMode:
	case kPropertyType_MagickaFillMode:
	case kPropertyType_StaminaFillMode:
		UpdateFillMode();
		break;
	case kPropertyType_StartFlash:
		UpdateFlash();
		break;
	case kPropertyType_Name:
		UpdateText();
		break;
	}
}