bool HighscoreScreen::init()
{
    if (!Layer::init())
    {
        return false;
    }

    _rootNode = CSLoader::createNode("Screens/HighscoreScreen.csb");
    addChild(_rootNode);
    this->scheduleUpdate();

    _myDictionary = __Dictionary::create();

    ReadHighscore();

    if (_scores[1]->length() == 0)
    {
        WriteDefaultHighscore();
        ReadHighscore();
    }

    //SPRITES
    InitSprites();
    //Animated Santa Sprite
    InitAnimation();
    //LABELS
    InitLabels();
    //TOUCHES
    InitControls();
    //BUTTONS
    InitButtons();

    return true;
}
Ejemplo n.º 2
0
/**
**  Initialize all modules.
**
**  Call each module to initialize.
*/
void InitModules()
{
	GameCycle = 0;
	CDate::CurrentTotalHours = 0;
	FastForwardCycle = 0;
	SyncHash = 0;

	CallbackMusicOn();
	InitSyncRand();
	InitVideoCursors();
	InitUserInterface();
	InitPlayers();
	InitMissileTypes();
	InitMissiles();
	InitConstructions();

	// LUDO : 0 = don't reset player stats ( units level , upgrades, ... ) !
	InitUnitTypes(0);

	InitUnits();
	InitSpells();
	InitUpgrades();

	InitButtons();
	CTrigger::InitActiveTriggers();

	InitAiModule();

	Map.Init();
}
Ejemplo n.º 3
0
void tpl_init_machine(void)
{
    nxt_device_init();
    tpl_init_machine_generic();
    InitButtons();
	ecrobot_set_motor_rev(NXT_PORT_A, 0);
	ecrobot_set_motor_rev(NXT_PORT_B, 0);
	ecrobot_set_motor_rev(NXT_PORT_C, 0);
}
Ejemplo n.º 4
0
BOOL CGameParamsSheet::OnInitDialog()
{
  // Perform default processing
  CPropertySheet::OnInitDialog();

  // Initialize the OK and Cancel buttons
  InitButtons();

  // Return true to set the focus to the first tabstop control
  return true;
}
Ejemplo n.º 5
0
Archivo: dialog.c Proyecto: Mirppc/twin
static byte InitMenuBox(void) {
    int i, y;
    if (ShowText()) {
	y = CountNewLines(text) + 2;
	for (i = 0; i < listN; i++) {
	    TwGotoXYWindow(Dialog_Win, 3, i+y);
	    TwWriteAsciiWindow(Dialog_Win, strlen(list[i].tag), list[i].tag);
	    TwGotoXYWindow(Dialog_Win, 10, i+y);
	    TwWriteAsciiWindow(Dialog_Win, strlen(list[i].item), list[i].item);
	}
	return InitButtons("  OK  ", "Cancel");
    }
    return FALSE;
}
Ejemplo n.º 6
0
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) :
		wxFrame(NULL, -1, title, pos, size) {
	wxMenuBar *menuBar = new wxMenuBar;
	wxMenu *menuFile = new wxMenu;
	menuFile->Append(wxID_ABOUT, wxT("&About…"));
	menuFile->Append(wxID_EXIT, wxT("E & xit"));
	menuBar->Append(menuFile, wxT("&File"));
	SetMenuBar(menuBar);

	InitButtons();
	m_gdb = new wxTextCtrl(this, wxID_ANY);
	m_img = new wxTextCtrl(this, wxID_ANY);
	m_corefile = new wxTextCtrl(this, wxID_ANY);
	m_coreinfo = new wxTextCtrl(this, wxID_ANY,
			wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxHSCROLL);
	m_coreinfo->SetWindowStyle(m_coreinfo->GetWindowStyle() & ~wxTE_DONTWRAP | wxTE_BESTWRAP);

	wxGridBagSizer *m_fgsizer = new wxGridBagSizer;
	int row = 0;
	m_fgsizer->Add(new wxStaticText(this, wxID_ANY, wxEmptyString), wxGBPosition(row,0));
	m_fgsizer->Add(m_gdb, wxGBPosition(row,1), wxDefaultSpan, wxGROW);
	row++;
	m_fgsizer->Add(m_select_img, wxGBPosition(row,0));
	m_fgsizer->Add(m_img, wxGBPosition(row,1), wxDefaultSpan, wxGROW);
	row++;
	m_fgsizer->Add(m_select_corefile, wxGBPosition(row,0));
	m_fgsizer->Add(m_corefile, wxGBPosition(row,1), wxDefaultSpan, wxGROW);
	row++;
	m_fgsizer->Add(m_copy, wxGBPosition(row,0));
	m_fgsizer->Add(m_coreinfo, wxGBPosition(row,1), wxGBSpan(3,1), wxGROW);
	row++;
	m_fgsizer->Add(m_reset, wxGBPosition(row,0));
	m_fgsizer->AddGrowableCol(1);
	m_fgsizer->AddGrowableRow(row);
	this->SetSizer(m_fgsizer);

	Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
			(wxObjectEventFunction) & MyFrame::OnQuit);
	Connect(wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED,
			(wxObjectEventFunction) & MyFrame::OnAbout);
	Connect(wxEVT_PAINT, wxPaintEventHandler(MyFrame::OnPaint));
	Connect(wxEVT_ERASE_BACKGROUND,
			wxEraseEventHandler(MyFrame::OnEraseBackground));
	char cmdbuf[1024];
	      sprintf(cmdbuf, "grep so /proc/%d/maps |awk '{print $6}' | uniq", getpid());
	libs = (exec_cmd(cmdbuf));
	reset();
}
Ejemplo n.º 7
0
CUIWnd::CUIWnd(const std::string& t, GG::X x, GG::Y y, GG::X w, GG::Y h, GG::Flags<GG::WndFlag> flags) :
    GG::Wnd(x, y, w, h, flags & ~GG::RESIZABLE),
    m_resizable(flags & GG::RESIZABLE),
    m_closable(flags & CLOSABLE),
    m_minimizable(flags & MINIMIZABLE),
    m_minimized(false),
    m_drag_offset(-GG::X1, -GG::Y1),
    m_mouse_in_resize_tab(false),
    m_close_button(0),
    m_minimize_button(0)
{
    // set window name
    SetName(t);
    // call to CUIWnd::MinimizedWidth() because MinimizedWidth is virtual
    SetMinSize(GG::Pt(CUIWnd::MinimizedWidth(), BORDER_TOP + INNER_BORDER_ANGLE_OFFSET + BORDER_BOTTOM + 50));
    InitButtons();
    SetChildClippingMode(ClipToClientAndWindowSeparately);
}
Ejemplo n.º 8
0
void LibraryPage::InitLayout(bool draggable/* = true*/)
{
	wxSizer* sizer = GetSizer();
	if (sizer)
		sizer->DeleteWindows();
	else
		sizer = new wxBoxSizer(wxVERTICAL);

	if (!m_is_static) {
//		InitLayoutExtend(sizer);
		InitButtons(sizer);
	}

	if (!m_list) {
		m_list = new LibraryList(this);
	}
	sizer->Add(m_list, 1, wxEXPAND);

	SetSizer(sizer);
}
Ejemplo n.º 9
0
bool GameScreen::init()
{
	if (!Layer::init())
	{
		return false;
	}

	_rootNode = CSLoader::createNode("Screens/MainGame.csb");
	addChild(_rootNode);
	this->scheduleUpdate();

	_platform = (Platform*)_rootNode->getChildByName("platform");
	_platform = Platform::create();
	this->addChild(_platform);

	_powerUp = (PowerUp*)_rootNode->getChildByName("powerup");
	_powerUp = PowerUp::create();
	this->addChild(_powerUp);

	_menuBar = (MenuBar*)_rootNode->getChildByName("menuBar");
	_menuBar = MenuBar::create();
	this->addChild(_menuBar);

	//SPRITES
	InitSprites();
	//Animated Santa Sprite
	InitAnimation();
	//LABELS
	InitLabels();
	//TOUCHES
	InitControls();
	//BUTTONS
	InitButtons();


	// Game is not live until the start button is pressed.
	GameManager::sharedGameManager()->isGameLive = false;
	GameState();

	return true;
}
Ejemplo n.º 10
0
int main(void)
{
	// Configure the system clock.
	// The system clock is 168Mhz.
	RCC_HSEConfig(RCC_HSE_ON); // ENABLE HSE (HSE = 8Mhz)
	while(!RCC_WaitForHSEStartUp());  // Wait for HSE to stabilize
	
	SystemCoreClockUpdate();
	RCC_PCLK1Config(RCC_HCLK_Div4); // Set APB1=42Mhz (168/4)

	// Initialize peripheral modules
	InitCAN();
	InitGPIO();
	InitButtons();
	InitEXTI();
	InitNVIC();
	InitTim();
	InitSystick();
	InitWatchdog();
	
	/* 
	Check if the IWDG reset has occoured
	*/
	/*if(RCC_GetFlagStatus(RCC_FLAG_IWDGRST) == SET){
		GPIOA->ODR |= GPIO_Pin_6; //temp action
		RCC_ClearFlag();
	}*/
	
	while(1)
	{ 	
		if(clk10msWheel == COMPLETE){
			TxWheelrpm();
			clk10msWheel = RESTART;
		}
		
		checkButtons();
		
		LED_SetState(LED_GREEN, (GPIOE->IDR & BUTTON_START_GPIO_PIN) ? DISABLE : ENABLE);
		LED_SetState(LED_RED,   (GPIOE->IDR & BUTTON_STOP_GPIO_PIN)  ? ENABLE : DISABLE);
	}
}
Ejemplo n.º 11
0
int main()
{

    // Configure UART2 for no interrupts at 9600 baud. Include a reset of
    // the RX flag as required.
    OpenUART2(UART_EN, UART_TX_ENABLE, BRGVAL);
    IFS1bits.U2RXIF = 0;

    // This variable is defined as 2 to specify that UART2 will be used for
    // stdin/stdout.
    __C30_UART = 2;

    /******************************************************************************
     * Your code goes in between this comment and the following one with asterisks.
     *****************************************************************************/
    LcdInit();		//initialize our lcd
    InitButtons();	//initialize our buttons
    InitMorseDecoder();	//initialize morse tree

    printf("Type Morse With Buttons Above\n");
    SetTopLine(greet);
    while(1) {
        if(ReceivedInput(temp)) {				//check for user input
            printf("Your input: %c\n", temp);	//echo input
            EncodeCharacter(temp, out);		//encode the character then display
            printf("In Morse: %c%c%c%c%c%c\n", out[0], out[1], out[2], out[3], out[4], out[5]);
        }
        char x = CheckButtonEvents();					//check for button event
        if (x == 0x00) {								// check if no Buttons were pressed
            if(flag0 != 1) {
                SetTopLine(greet);
            }
            flag0 = 1;

        } else if (x & Button6DownEvent) {			// check if Button 6 was pressed
            if(flag1 != 1) {
                toDecode[position] = dash;	//save input to current slot
                toDecode[position+1] = space;
                position++;					//increment to next slot
                SetBottomLine(toDecode);	//display total line array
            }
            flag1 = 1;		//flag is on
        } else if (x & Button6UpEvent) {				// check if Button 6 was released
            flag1 = 0;		//clear flag
        } else if (x & Button5DownEvent) {			// check if Button 5 was pressed
            if(flag2 != 1) {
                toDecode = (char *)GetBottomLine();	//decode what ever is in bottom line
            }
            flag2 = 1;
        } else if (x & Button5UpEvent) {				// check if Button 5 was released
            decodeChar[0] = DecodeCharacter(toDecode);	// decode our input
            topline[Pos] = decodeChar[0];			// add next decoded char
            Pos++;
            SetTopLine(topline);
            SetBottomLine(empty);						// clear bottom line on LCD
            int i;
            for(i = 0; i < 16; i++) {
                toDecode[i] = ' ';						// clear bottom line
            }
            position = 0;								// start at new line of input
            flag2 = 0;
        } else if (x & Button4DownEvent) {			// check if Button 4 was pressed
            flag3 = 1;		//flag is on
        } else if (x & Button4UpEvent) {				// check if Button 3 was released
            topline[Pos] = ' ';						// add space for next decodedc char
            Pos++;
            SetTopLine(topline);
            SetBottomLine(empty);
            int i;
            for(i = 0; i < 16; i++) {
                toDecode[i] = ' ';						// clear bottom line
            }
            position = 0;								// start at new line of input
            flag3 = 0;
        } else if (x & Button3DownEvent) {			// check if Button 3 was pressed
            if(flag4 != 1) {
                toDecode[position] = dot;
                toDecode[position + 1] = space;
                position++;
                SetBottomLine(toDecode);
            }
            flag4 = 1;		//flag is on
        } else if (x & Button3UpEvent) {				// check if Button 3 was released
            flag4 = 0;		//clear flag
        }
    }


    /******************************************************************************
     * Your code goes in between this comment and the preceeding one with asterisks
     *****************************************************************************/

    while (1);
}
Ejemplo n.º 12
0
Archivo: dialog.c Proyecto: Mirppc/twin
static byte InitMsgBox(void) {
    return ShowText() && InitButtons(" OK ", NULL);
}
Ejemplo n.º 13
0
Archivo: dialog.c Proyecto: Mirppc/twin
static byte InitTextBox(void) {
    return ShowFile() && InitButtons(" EXIT ", NULL); 
}
Ejemplo n.º 14
0
/**
**  CreateGame.
**
**  Load map, graphics, sounds, etc
**
**  @param filename  map filename
**  @param map       map loaded
**
**  @todo FIXME: use in this function InitModules / LoadModules!!!
*/
void CreateGame(const char *filename, CMap *map)
{
	int i;

	if (SaveGameLoading) {
		SaveGameLoading = 0;
		// Load game, already created game with Init/LoadModules
		CommandLog(NULL, NoUnitP, FlushCommands, -1, -1, NoUnitP, NULL, -1);
		return;
	}

	InitVisionTable(); // build vision table for fog of war
	InitPlayers();
	
	if (Map.Info.Filename.empty() && filename) {
		char path[PATH_MAX];
		
		Assert(filename);
		LibraryFileName(filename, path, sizeof(path));
		if(strcasestr(filename, ".smp")) {
			LuaLoadFile(path);
		}
	}

	for (i = 0; i < PlayerMax; ++i) {
		int playertype = Map.Info.PlayerType[i];
		// Network games only:
		if (GameSettings.Presets[i].Type != SettingsPresetMapDefault) {
			playertype = GameSettings.Presets[i].Type;
		}
		CreatePlayer(playertype);
	}

	if (filename) {
		if (CurrentMapPath != filename) {
			strcpy_s(CurrentMapPath, sizeof(CurrentMapPath), filename);
		}

		//
		// Load the map.
		//
		InitUnitTypes(1);
		LoadMap(filename, map);
		
		// HARDCODING FOG OF WAR TRUE.  It doesn't currently use preferences on a game restart - Should be changed 
		map->NoFogOfWar = true;
		Map.Reveal();
	}

	GameCycle = 0;
	FastForwardCycle = 0;
	SyncHash = 0;
	InitSyncRand();

	if (IsNetworkGame()) { // Prepare network play
		DebugPrint("Client setup: Calling InitNetwork2\n");
		InitNetwork2();
	} else {
		if (LocalPlayerName && strcmp(LocalPlayerName, "Anonymous")) {
		  ThisPlayer->SetName(LocalPlayerName);
		}
	}

	CallbackMusicOn();

#if 0
	GamePaused = true;
#endif

	if (FlagRevealMap) {
		Map.Reveal();
	}

	//
	// Setup game types
	//
	// FIXME: implement more game types
	if (GameSettings.GameType != SettingsGameTypeMapDefault) {
		switch (GameSettings.GameType) {
			case SettingsGameTypeMelee:
				break;
			case SettingsGameTypeFreeForAll:
				GameTypeFreeForAll();
				break;
			case SettingsGameTypeTopVsBottom:
				GameTypeTopVsBottom();
				break;
			case SettingsGameTypeLeftVsRight:
				GameTypeLeftVsRight();
				break;
			case SettingsGameTypeManVsMachine:
				GameTypeManVsMachine();
				break;
			case SettingsGameTypeManTeamVsMachine:
				GameTypeManTeamVsMachine();

			// Future game type ideas
#if 0
			case SettingsGameTypeOneOnOne:
				break;
			case SettingsGameTypeCaptureTheFlag:
				break;
			case SettingsGameTypeGreed:
				break;
			case SettingsGameTypeSlaughter:
				break;
			case SettingsGameTypeSuddenDeath:
				break;
			case SettingsGameTypeTeamMelee:
				break;
			case SettingsGameTypeTeamCaptureTheFlag:
				break;
#endif
		}
	}

	//
	// Graphic part
	//
	SetPlayersPalette();
	InitIcons();
	LoadIcons();

	LoadCursors(PlayerRaces.Name[ThisPlayer->Race]);
	UnitUnderCursor = NoUnitP;

	InitMissileTypes();
#ifndef DYNAMIC_LOAD
	LoadMissileSprites();
#endif
	InitConstructions();
	LoadConstructions();
	LoadUnitTypes();
	LoadDecorations();

	InitSelections();

	InitUserInterface();
	UI.Load();

	UI.Minimap.Create();
	Map.Init();
	PreprocessMap();

	//
	// Sound part
	//
	LoadUnitSounds();
	MapUnitSounds();
	if (SoundEnabled()) {
		InitSoundClient();
	}

	//
	// Spells
	//
	InitSpells();

	//
	// Init units' groups
	//
	InitGroups();

	//
	// Init players?
	//
	DebugPlayers();
	PlayersInitAi();

	//
	// Upgrades
	//
	InitUpgrades();

	//
	// Dependencies
	//
	InitDependencies();

	//
	// Buttons (botpanel)
	//
	InitButtons();

	//
	// Triggers
	//
	InitTriggers();

	SetDefaultTextColors(UI.NormalFontColor, UI.ReverseFontColor);

#if 0
	if (!UI.SelectedViewport) {
		UI.SelectedViewport = UI.Viewports;
	}
#endif
	UI.SelectedViewport->Center(
		ThisPlayer->StartX, ThisPlayer->StartY, TileSizeX / 2, TileSizeY / 2);

	//
	// Various hacks wich must be done after the map is loaded.
	//
	// FIXME: must be done after map is loaded
	InitAStar();
	//
	// FIXME: The palette is loaded after the units are created.
	// FIXME: This loops fixes the colors of the units.
	//
	for (i = 0; i < NumUnits; ++i) {
		// I don't really think that there can be any rescued
		// units at this point.
		if (Units[i]->RescuedFrom) {
			Units[i]->Colors = &Units[i]->RescuedFrom->UnitColors;
		} else {
			Units[i]->Colors = &Units[i]->Player->UnitColors;
		}
	}

	GameResult = GameNoResult;

	CommandLog(NULL, NoUnitP, FlushCommands, -1, -1, NoUnitP, NULL, -1);
	Video.ClearScreen();
}
Ejemplo n.º 15
0
BtnController::BtnController() {
	InitButtons();
}
Ejemplo n.º 16
0
BOOL CElcSkinFrameBase::Initialize(HWND hThis)
{
	if (!m_bEnableSkin)
		return TRUE;
		
	if (!::IsWindow(hThis)) {
		m_hDerive = 0;
		ASSERT(0);
		return FALSE;
	}

	m_hDerive = hThis;

	LONG style = GetWindowLong(m_hDerive, GWL_STYLE);
	LONG exstyle = GetWindowLong(m_hDerive, GWL_EXSTYLE);

	style &= ~WS_CAPTION;
	style &= ~WS_BORDER;

	exstyle &= ~WS_EX_CLIENTEDGE;
	exstyle &= ~WS_EX_STATICEDGE;

	CWnd* pWnd = CWnd::FromHandle(m_hDerive);
	if (!pWnd) {
		return FALSE;
	}
	else if (pWnd->IsKindOf(RUNTIME_CLASS(CDialog))) {
		m_nWndType = ELCSWT_DIALOG;

		if (style & WS_CHILDWINDOW) {
			m_nCaption = 0;
			m_nMenuBar = 0;
			m_nLeft = 0;
			m_nRight = 0;
			m_nBottom = 0;
		}
		else if (exstyle & WS_EX_WINDOWEDGE) {
			if ((style & WS_THICKFRAME) == 0)
				style |= WS_DLGFRAME;
		}

		m_bDrawClientBackgnd = TRUE;
	}
	else if (pWnd->IsKindOf(RUNTIME_CLASS(CFrameWnd))) {
		m_nWndType = ELCSWT_FRAMEWND;
	}
	else {
		if (style & WS_CHILDWINDOW) {
			m_nCaption = 0;
			m_nMenuBar = 0;
			m_nLeft = 0;
			m_nRight = 0;
			m_nBottom = 0;
		}

		m_nWndType = ELCSWT_WND;
	}

	::SetWindowLong(m_hDerive, GWL_STYLE, style);
	::SetWindowLong(m_hDerive, GWL_EXSTYLE, exstyle);

	InitButtons();
	InitMenuItem();

	::SetWindowPos(m_hDerive, NULL, 0, 0, 0, 0, 
		SWP_NOACTIVATE|SWP_NOZORDER|SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE);

	::SetTimer(m_hDerive, ELC_SKIN_FRAME_STATE_TIMER, 1000, NULL);

	return TRUE;
}
Ejemplo n.º 17
0
Archivo: dialog.c Proyecto: Mirppc/twin
static byte InitYesNoBox(void) {
    return ShowText() && InitButtons(" Yes ", " No ");
}
Ejemplo n.º 18
0
void CElcSkinFrameBase::RefreshFrameStatus()
{
	InitButtons();
	RedrawCaption();
}