Exemplo n.º 1
0
LRESULT CALLBACK Textbox::EditProc( HWND hWndEdit, UINT msg, WPARAM wParam, LPARAM lParam )
{
  Textbox *textbox = WinSys->HasComp<Textbox*>( hWndEdit );
  MSG message;

  switch ( msg )
  {
    case WM_KEYDOWN:
		  switch (wParam)
		  {
			  case VK_RETURN:
          {
              // Get the message that the client would like to post.
            std::string str = textbox->GetText();
            textbox->Clear();

            SendMsg(str);

				    PeekMessage( &message, hWndEdit, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE );
          }
				  break;
		  }
      break;
  }

	return CallWindowProc( textbox->wndProc_, hWndEdit, msg, wParam, lParam );
}
Exemplo n.º 2
0
bool TextboxParent::UpdateTextboxes()
{
	if (textboxes.size() == 0)
		return false;
	unsigned int index = textboxes.size() - 1;
	Textbox* active = textboxes[index];
	if (!active || active->SetToClose())
		return false;
	active->Update();
	for (unsigned int i = 0; i < textboxes.size(); i++)
	{
		if (!textboxes[i])
			continue;
		if (textboxes[i]->SetToClose())
		{
			if (textboxes[i]->DeleteOnClose())
			{
				delete textboxes[i];
				textboxes[i] = 0;
			}
			else
				textboxes[i]->CancelClose();
			textboxes.erase(textboxes.begin() + i--);
		}
	}
	return true;
}
bool SystemMenuResource::SetText( Layout *layout, const char* textboxName, const char16 *text, bool failSilently )
{
	Textbox *tbox;
	if( (tbox = layout->FindTextbox( textboxName ) ) )
	{
		tbox->SetText( text );
		return true;
	}
	if( !failSilently )
	{
		gprintf( "textbox \"%s\" not found\n", textboxName );
	}
	return false;
}
Exemplo n.º 4
0
void EvolutionScreen::HitB()
{
	if (main_frame->GetTextboxes().size() == 0)
		main_frame->CancelClose();
	if (color_timer)
		return;
	if (frames == 1 || delay == 255)
		return;

	color_timer = 255;
	frames = 1;
	Textbox* frame = main_frame;
	Textbox* canceled = new Textbox();
	canceled->SetText(new TextItem(canceled, [frame](TextItem* src) {frame->Close(true); }, pokestring("Huh? ").append(pokemon->nickname).append(pokestring("\nstopped evolving!\f"))));
	main_frame->ShowTextbox(canceled, false);
}
Exemplo n.º 5
0
void TextboxParent::CloseAll(bool include_this)
{
	for (int i = textboxes.size() - 1; i >= 0; i--)
	{
		Textbox* t = textboxes[i];
		t->CloseAll();
		textboxes[i]->Close(true);
		if (textboxes[i]->SetToClose())
		{
			if (textboxes[i]->DeleteOnClose())
			{
				delete textboxes[i];
			}
			else
				textboxes[i]->CancelClose();
			textboxes.pop_back();
		}
	}
}
Exemplo n.º 6
0
void EvolutionScreen::Finalize()
{
	Textbox* main_frame = this->main_frame;
	Textbox* evolved = new Textbox();

	bool learned_move = false;
	std::function<void(TextItem* s)> m_f = nullptr;
	for (int i = 0; i < 16; i++)
	{
		if (pokemon_to->learnset[i].level == 0)
			break;
		if (pokemon_to->learnset[i].level == pokemon->level)
		{
			m_f = PokemonUtils::LearnMove(evolved, pokemon, pokemon_to->learnset[i].move);
			learned_move = true;
		}
	}

	std::function<void(TextItem* s)> a = [m_f, evolved](TextItem* src) {
		evolved->CancelClose(); 
		m_f(src); 
	};
	evolved->SetText(new TextItem(evolved, (!m_f ? [main_frame, evolved](TextItem* src) {evolved->Close(); main_frame->Close(); } : a), string(pokemon->nickname).append(pokestring(" evolved\ninto ")).append(pokemon_to->original_name).append(pokestring("!\t\t\t\t\t\t\a"))));
	main_frame->ShowTextbox(evolved, false);
	if (learned_move)
	{
		auto b = [evolved, main_frame, this](TextItem* s)
		{
			evolved->Close(true);
			main_frame->Close();
			this->parent->Close();
		};
		evolved->SetCloseCallback(b);
	}

	pokemon->id = pokemon_to->id;
	pokemon->pokedex_index = pokemon_to->pokedex_index;
	pokemon->LoadStats();
	unsigned int hp = pokemon->max_hp;
	pokemon->RecalculateStats();
	pokemon->hp += pokemon->max_hp - hp;
}
Exemplo n.º 7
0
	CompleteView() : mList(1) {
		View::mRootWidget = &mList;
		mList.setBackground(true);

		GridLayout* layout = new GridLayout(2);

		layout->add(new Image(R_IMAGE_1), 0);
		layout->add(new Image(R_IMAGE_2), 0);
		layout->add(new Label("Hello World!", GREEN), 1);	//should wind up on the top left?
		layout->add(new StringLabel("String", GREEN), 1);
		layout->add(new Textbox(10, 20, GREEN, GREEN), 1);

		mList.add(layout, 0, -1, true);
		Textbox* t = new Textbox(10, 200, GREEN, WHITE/*BRIGHT_RED*/);
		mList.add(t, 0, -1, true);
		t->setQwerty();
		t->activate();
		mList.add(new MultilineLabel("Line 1\nLine 10\nYet another line\n ", GREEN), 0);
		mList.add(new Label("Next label", WHITE), 0);
		mList.add(new HyperlinkLabel(this, "To close the program, \1click here\1.\n Now for a \1line-\nbroken\1 link.", GREEN, SKY_BLUE), 0);
	}
Exemplo n.º 8
0
void drawWindow()
{
	glClear(GL_COLOR_BUFFER_BIT);
	
	startButton.draw();
	loadConfig.draw();
	saveConfig.draw();
	
	startPage.draw();
	maxCount.draw();
	blacklisted.draw();
	allowedDomains.draw();
	query.draw();

	progress.draw();

	drawText(50,100,"Load Config");
	drawText(50,175,"Save Config");
	//query.setText("smdsf");	
	drawText(165, 45,"Query:");	
	drawText(165,190,"Start Page:");
	drawText(165,240,"Max Count:");
	drawText(165,140,"BlackListed:");
	drawText(165,90,"Allow Domains:");
	drawText(588,340,"START");
	drawText(75,315,"Status:");
	glutSwapBuffers();
}
Exemplo n.º 9
0
void World::update(Snake &player, Textbox &textbox) {
	if (player.getPosition() == _item) {
		player.extend();
		player.increaseScore();

		textbox.add("You ate an apple. Score:" + std::to_string(player.getScore()));

		while(player.checkCollisionWithNewItem(_item))
			respawnApple();
	}

	int gridSizeX = _windowSize.x / _blockSize;
	int gridSizeY = _windowSize.y / _blockSize;

	if (player.getPosition().x <= 0
		|| player.getPosition().y <= 0
		|| player.getPosition().x >= gridSizeX - 1
		|| player.getPosition().y >= gridSizeY - 1) {

		player.lose();
	}
}
Exemplo n.º 10
0
void BuildTitleUI(void)
{
	TitleScene	=	fusion->Scene->AddScene();
	TitleUI		=	fusion->Interface->AddUI(TitleScene);

	Window *w	=	TitleUI->AddWindow(fusion->Input);
	w->SetTitle("Title");

	ITexture	*tb;
	Overlay		*o;
	Entity		*e;

//=====================================
//	Load the texture startbutton.tga, 
//	add an overlay, create an entity 
//	from that overlay
//=====================================
	tb	=	fusion->Graphics->CreateTexture("file://sprites/startbutton.tga");
	o	=	fusion->Mesh->CreateOverlay(tb);

	o->AddFrame(new Rect(0,0,128,32));
	o->AddFrame(new Rect(0,32,128,64));
	o->AddFrame(new Rect(0,0,128,32));
	
//	Create an entity for the button, scale it and add a Mesh animation for it
//	Then create a Button component and add it to the window
	e	=	fusion->Mesh->CreateEntity(o);
	e->SetTranslate(TRANSLATE_ABS,-200,450,0.8f);
	e->SetScale(110,30,1);
	e->SetMeshAnimation(TS_ButtonAnimation);
	TitlescreenEntity[0] = e;
	w->AddComponent(new ButtonSetup(e,StartButtonClick, NULL));
	e->SetActive(false);

//=====================================
//	Load the texture exitbutton.tga, 
//	add an overlay, create an entity 
//	from that overlay
//=====================================
	tb	=	fusion->Graphics->CreateTexture("file://sprites/exitbutton.tga");
	o	=	fusion->Mesh->CreateOverlay(tb);

	o->AddFrame(new Rect(0,0,128,32));
	o->AddFrame(new Rect(0,32,128,64));
	o->AddFrame(new Rect(0,0,128,32));

//	Create an entity for the button, scale it and add a Mesh animation for it
//	Then create a Button component and add it to the window
	e	=	fusion->Mesh->CreateEntity(o);
	e->SetTranslate(TRANSLATE_ABS,-300,500,0.8f);
	e->SetScale(80,30,1);
	e->SetMeshAnimation(TS_ButtonAnimation);
	TitlescreenEntity[1] = e;
	w->AddComponent(new ButtonSetup(e,ExitButtonClick, NULL));
	e->SetActive(false);

//=====================================
//	Load the texture CreditsButton.tga, 
//	add an overlay, create an entity 
//	from that overlay
//=====================================
	tb	=	fusion->Graphics->CreateTexture("file://sprites/CreditsButton.tga");
	o	=	fusion->Mesh->CreateOverlay(tb);

	o->AddFrame(new Rect(0,0,128,32));
	o->AddFrame(new Rect(0,32,128,64));
	o->AddFrame(new Rect(0,0,128,32));

//	Create an entity for the button, scale it and add a Mesh animation for it
//	Then create a Button component and add it to the window
	e	=	fusion->Mesh->CreateEntity(o);
	e->SetTranslate(TRANSLATE_ABS,-300,550,0.8f);
	e->SetScale(164,30,1);
	e->SetMeshAnimation(TS_ButtonAnimation);
	TitlescreenEntity[2] = e;
	w->AddComponent(new ButtonSetup(e,ShowCredits, NULL));
	e->SetActive(false);

//========================================================================
//	Load each texture, add an overlay, create an entity from that overlay, 
//	set it's initial state to inactive
//========================================================================

//======================
//	PlayerShip-Title.tga
//======================
	tb	=	fusion->Graphics->CreateTexture("file://sprites/PlayerShip-Title.tga");
	o	=	fusion->Mesh->CreateOverlay(tb);
	o->AddFrame();
	e	=	fusion->Mesh->CreateEntity(o);

	//	Scale the entity and set it's animation function
	e->SetTranslate(TRANSLATE_ABS,800,100,0.4f);
	e->SetScale(512,512,1);
	e->SetMeshAnimation(TS_ShipAnimation);
	e->SetActive(false);
	TitleScene->AddEntity(e);
	TitlescreenEntity[3] = e;

//======================
//	Zargadia-Title.tga
//======================
	tb	=	fusion->Graphics->CreateTexture("file://sprites/Zargadia-Title.tga");
	o	=	fusion->Mesh->CreateOverlay(tb);
	o->AddFrame();
	e	=	fusion->Mesh->CreateEntity(o);

	//	Translate/scale the entity and set it's animation function
	e->SetTranslate(TRANSLATE_ABS,10,-120,0.5f);
	e->SetScale(600,120,1);
	e->SetMeshAnimation(TS_ZargadiaTitleAnimation);
	e->SetActive(false);
	TitleScene->AddEntity(e);
	TitlescreenEntity[4] = e;

//======================
//	Mouse Cursor
//======================
	e = Input->InitCursor();
	e->SetActive(false);
	TitleScene->AddEntity(e);
	TitlescreenEntity[5] = e;

//==================================
//	Powered By DodgyVision(tm) logo
//==================================
	Textbox *t;
	t = reinterpret_cast<Textbox *>(w->AddComponent(new TextBoxSetup(10,SCREENHEIGHT-15,1,font,"Powered by DodgyVision (tm)")));
	t->SetColour(255,255,255,255);
	t->SetScale(0.5,0.5);
	t->SetActive(false);

//======================
//	Animated Fusion Logo
//======================
	TitleScene->AddEntity(fusionlogo);
}
Exemplo n.º 11
0
void step(int i){
	switch (i){
		case 1:
			progress.setText("Welcome!");
			break;
		case 2:
			query.setText("schmorkleblinxx");
			break;
		case 3:
			allowedDomains.setText("http://www.cnn.com;http://www.zombo.com");
			break;
		case 4:
			blacklisted.setText("http://www.wikipedia.com;http://www.fox.com");
			break;
		case 5:
			startPage.setText("http://www.cnn.com/walrus_llama_death_match");
			break;
		case 6:
			maxCount.setText("9,261");
			break;
		case 7:
			progress.setText("Starting up!");
			break;
		case 8:
			progress.setText("Grabbed: 5/10,000 pages");
			break;
		case 9:
			progress.setText("Crawling completed!");
			break;
		case 10:
			progress.setText("Analysis beginning...");
			break;
		case 11:
			progress.setText("Indexing web pages.");
			break;
		case 12:
			progress.setText("Searching for query hits...");
			break;
		case 13:
			progress.setText("Search completed.");
			break;
		case 14:
			progress.setText("Outputting data...");
			break;
		case 15:
			progress.setText("HiPerCrCiC task complete.");
			break;
	}
}
Exemplo n.º 12
0
int main()
{
//	TestScenario test;

//	test.scenarioEvents();

	sf::RenderWindow* window = new sf::RenderWindow(sf::VideoMode(1980, 1080), "SFML works!", sf::Style::Fullscreen);
//	sf::RenderWindow* window = new sf::RenderWindow(sf::VideoMode(1000, 580), "SFML works!");

//	Game game;

//	game.GameLoop();
	
	
	sf::CircleShape shape(100.f);
	shape.setFillColor(sf::Color::Green);

	Button exitButton("Exit", 840, 700);
	Textbox testbox;
	sf::Clock time;
	sf::Vector2i mousePos;
	while (window->isOpen())
	{
		sf::Event event;

		
		
		while (testbox.Update(time.restart().asSeconds()))
		{
			while (window->pollEvent(event))
			{
				mousePos = sf::Mouse::getPosition(*window);
				if (exitButton.ButtonFunction(mousePos) || event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
				{
					window->close();
					return 0;
				}
			}


			window->clear();
			window->draw(shape);
			testbox.Draw(window);
			exitButton.Draw(window); 
			window->display();

		}
		testbox.ChangeText("Well it worked well \nThat's really nice to know :) \n едцедцедц");

		while (testbox.Update(time.restart().asSeconds()))
		{
			while (window->pollEvent(event))
			{
				mousePos = sf::Mouse::getPosition(*window);
				if (exitButton.ButtonFunction(mousePos) || event.type == sf::Event::Closed || sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
				{
					window->close();
					return 0;
				}
			}


			window->clear(sf::Color(222,222,222));
			window->draw(shape);
			testbox.Draw(window);
			exitButton.Draw(window);
			window->display();

		}
		testbox.ChangeText("Program gonna loop now soo that's it folks!");
	}
	
//	game.Delete();
	return 0;
}