void t_campaign_selection_dialog::initialize()
{
	m_layout = g_layout.get();
//	std::fill( m_enabled, m_enabled + ELEMENTS_OF( m_enabled ), true );
	m_campaign_id = k_standard_campaign_none;

	//////////////////////////////////////////////////////////////////
 	// find dimensions & center
	t_screen_point        origin(0,0);
	t_bitmap_layer const* layer = m_layout->find( "background" );
	t_screen_rect		  rect = layer->get_rect();

	set_bitmap( layer );
	rect += t_screen_point( (get_parent()->get_width() - rect.width()) / 2, 
		                           (get_parent()->get_height() - rect.height()) / 2 );
	move( rect );
	set_drop_shadow();

	//////////////////////////////////////////////////////////////////

	// add title
	t_text_window* window;
	layer = m_layout->find( "title" );
	rect = layer->get_rect();
	window = new t_text_window( get_font( rect.height() ), rect, this, 
		                         k_score_title, t_pixel_24(0,0,0) );
	window->set_center_horizontal();
	window->set_center_vertical();
	window->set_drop_shadow( true, t_pixel_24(200,200,200));

	create_text();
	create_buttons();
	create_icons();
}
Esempio n. 2
0
t_army_dialog_garrison::t_army_dialog_garrison( t_ownable_garrisonable_adv_object* garrison, t_army* adjacent_army,
												t_adventure_frame* adventure_frame,	
												t_creature_array * selected_army, int selected_slot )
	: t_army_dialog_base( garrison, adjacent_army, adventure_frame, selected_slot ),
	  m_garrison( garrison )
{
	create_buttons();
	create_creature_windows();
	create_icons();
	create_text_boxes();
	check_for_allied();

	// Crude hack to handle no-remove garrisons; out of time to do this right
	if ( !m_garrison->can_remove_garrison() )
	{
		m_army_window->set_allow_drags( false );

		if ( m_adjacent_army_window )
			m_adjacent_army_window->set_allow_drags( false );
	}

	// select first creature
	if (selected_slot < 0)
    {
		select_leader();
    }
	else
    {
        if ( m_creatures == selected_army )
    		m_army_window->select_creature( selected_slot );
        else
    	    m_adjacent_army_window->select_creature( selected_slot );
    }
}
Esempio n. 3
0
int main()
{
  create_icons();
  window = window_create();
  window_set_window_handlers(window, (WindowHandlers)
  {
    .load = window_load,
    .unload = window_unload,
  });
Esempio n. 4
0
/*!
*
*/
int
main(int argc, char** argv)
{
  char *progname = argv[0];

  glutInit(&argc, argv);

  for(++argv; --argc > 0; ++argv)
  {
    if( strcmp(*argv, "-help") ==  0 || strcmp(*argv, "--help") == 0 )
    {
      fputs("View a 3DS model file using OpenGL.\n", stderr);
      fputs("Usage: 3dsplayer [-nodb|-aa|-flush] <filename>\n", stderr);
#ifndef USE_SDL
      fputs("Texture rendering is not available; install SDL_image and recompile.\n", stderr);
#endif
      exit(0);
    }
    else if( strcmp(*argv, "-nodb") == 0 )
      dbuf = 0;
    else if( strcmp(*argv, "-aa") == 0 )
      anti_alias = 1;
    else if( strcmp(*argv, "-flush") == 0 )
      flush = 1;
    else {
      filepath = *argv;
      decompose_datapath(filepath);
    }
  }

  if (filepath == NULL) {
    fputs("3dsplayer: Error: No 3DS file specified\n", stderr);
    exit(1);
  }

  glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | (dbuf ? GLUT_DOUBLE:0) );
  glutInitWindowSize(500, 500);
  glutInitWindowPosition(100, 100);
  glutCreateWindow(filepath != NULL ? Basename(filepath) : progname);

  init();
  create_icons();
  load_model();

  build_menu();
  glutAttachMenu(2);

  glutDisplayFunc(display);
  glutReshapeFunc(reshape);
  glutKeyboardFunc(keyboard);
  glutMouseFunc(mouse_cb);
  glutMotionFunc(drag_cb);
  glutTimerFunc(10, timer_cb, 0);
  glutMainLoop();
  return(0);
}
void t_combat_results_dialog::initialize()
{
	m_layout = g_layout.get();
	m_creatures_lost_layout = k_creature_select_bitmaps.get();

	//////////////////////////////////////////////////////////////////
 	// find dimensions & center
	t_screen_point        origin(0,0);
	t_bitmap_layer const* layer = m_layout->find( "background" );
	t_screen_rect		  rect = layer->get_rect();

	set_bitmap( layer );
	rect += t_screen_point( (get_parent()->get_width() - rect.width()) / 2, 
		                           (get_parent()->get_height() - rect.height()) / 2 );
	move( rect );
	set_drop_shadow();

	//////////////////////////////////////////////////////////////////

	// add title
	std::string           text;

	layer = m_layout->find( "title" );
	rect = layer->get_rect();
	m_title = new t_text_window( get_font( rect.height() ), rect, this, 
		                         k_combat_results_title, t_pixel_24(0,0,0) );
	m_title->set_center_horizontal();
	m_title->set_center_vertical();
	m_title->set_drop_shadow( true, t_pixel_24(200,200,200));

	create_text();
	create_icons();
	create_buttons();

	// add title
//	text = replace_keywords( k_text_combat_results_creatures, "%creatures", m_traits->plural_name );
	// make it all upper case
//	std::transform( text.begin(), text.end(), text.begin(), toupper );
//	m_title->set_text( text );

}
Esempio n. 6
0
void t_score_dialog::initialize()
{
	// calculate the final scores
	calculate_scores( m_map, m_winner_team, m_scores );

	m_layout = g_layout.get();
	m_difficulty_icons = g_difficulty_icons.get();

	//////////////////////////////////////////////////////////////////
 	// find dimensions & center
	t_screen_point        origin(0,0);
	t_bitmap_layer const* layer = m_layout->find( "background" );
	t_screen_rect		  rect = layer->get_rect();

	set_bitmap( layer );
	rect += t_screen_point( (get_parent()->get_width() - rect.width()) / 2, 
		                           (get_parent()->get_height() - rect.height()) / 2 );
	move( rect );
	set_drop_shadow();

	//////////////////////////////////////////////////////////////////

	// add title
	t_text_window* window;
	layer = m_layout->find( "title" );
	rect = layer->get_rect();
	window = new t_text_window( get_font( rect.height() ), rect, this, 
		                         k_score_title, t_pixel_24(0,0,0) );
	window->set_center_horizontal();
	window->set_center_vertical();
	window->set_drop_shadow( true, t_pixel_24(200,200,200));

	create_text();
	create_icons();
	create_buttons();
}
Esempio n. 7
0
int BC_FileBox::create_objects()
{
	int x = 10, y = 10;
	BC_Resources *resources = BC_WindowBase::get_resources();
	int directory_title_margin = MAX(20,
		resources->filebox_text_images[0]->get_h());

// Create recent dir list
	create_history();

// Directories aren't filtered in FileSystem so skip this
	if(!want_directory)
	{
		filter_list.append(new BC_ListBoxItem("*"));
		filter_list.append(new BC_ListBoxItem("[*.ifo][*.vob]"));
		filter_list.append(new BC_ListBoxItem("[*.mp2][*.mp3][*.wav]"));
		filter_list.append(new BC_ListBoxItem("[*.avi][*.mpg][*.m2v][*.m1v][*.mov]"));
		filter_list.append(new BC_ListBoxItem("heroine*"));
		filter_list.append(new BC_ListBoxItem("*.xml"));
		fs->set_filter(get_resources()->filebox_filter);
	}

	fs->update(directory);
	create_icons();
	create_tables();

	add_subwindow(ok_button = new BC_FileBoxOK(this));
	if(want_directory)
		add_subwindow(usethis_button = new BC_FileBoxUseThis(this));
	add_subwindow(cancel_button = new BC_FileBoxCancel(this));

	add_subwindow(new BC_Title(x, y, caption));

	x = get_w() - resources->filebox_icons_images[0]->get_w() - 10;
	add_subwindow(icon_button = new BC_FileBoxIcons(x, y, this));
	x -= resources->filebox_text_images[0]->get_w() + 5;
	add_subwindow(text_button = new BC_FileBoxText(x, y, this));
	x -= resources->filebox_newfolder_images[0]->get_w() + 5;
	add_subwindow(folder_button = new BC_FileBoxNewfolder(x, y, this));
	x -= resources->filebox_delete_images[0]->get_w() + 5;
	add_subwindow(delete_button = new BC_FileBoxDelete(x, y, this));
	x -= resources->filebox_reload_images[0]->get_w() + 5;
	add_subwindow(reload_button = new BC_FileBoxReload(x, y, this));
	x -= resources->filebox_updir_images[0]->get_w() + 5;
	add_subwindow(updir_button = new BC_FileBoxUpdir(x, y, this));

	x = 10;
	y += directory_title_margin + 3;

	add_subwindow(recent_popup = new BC_FileBoxRecent(this, 
		x, 
		y));
	add_subwindow(directory_title = new BC_FileBoxDirectoryText(x, y, this));
	directory_title->reposition_window(
		x,
		y,
		get_w() - recent_popup->get_w() -  20,
		1);
	recent_popup->reposition_window(
		x + directory_title->get_w(),
		y,
		directory_title->get_w(),
		200);

	x = 10;
	y += directory_title->get_h() + 5;
	listbox = 0;

	create_listbox(x, y, get_display_mode());
	y += listbox->get_h() + 10;
	add_subwindow(textbox = new BC_FileBoxTextBox(x, y, this));
	y += textbox->get_h() + 10;


	if(!want_directory)
	{
		add_subwindow(filter_text = new BC_FileBoxFilterText(x, y, this));
		add_subwindow(filter_popup = 
			new BC_FileBoxFilterMenu(x + filter_text->get_w(), y, this));;
	}

// listbox has to be active because refresh might be called from newfolder_thread
 	listbox->activate();
	newfolder_thread = new BC_NewFolderThread(this);
	
	show_window();
	return 0;
}