int main(int argc, char *argv[])
{
	wm = init_gui(argc, argv);

	update_port_names(wm->com_port);

	set_comm_trace(true);
	gtk_main();

	return 0;
}
Exemple #2
0
        queue_debug::queue_debug(m::mailbox_wptr m) :
            _mailbox{m},
            _mailbox_stats{nullptr}
        {
            auto mb = m.lock();
            if(!mb) return;

            mb->stats(true);
            _name_s = mb->address();

            init_gui();
        }
/* The delegate object calls this method during initialization of an ARDrone application */
C_RESULT ardrone_tool_init_custom()
{
  /* Registering for a new device of game controller */
  // ardrone_tool_input_add( &gamepad );

  /* Start all threads of your application */
  START_THREAD( video_stage, NULL );
  
  init_gui(argc_cpy, argv_cpy); /* Creating the GUI */
  START_THREAD(gui, NULL); /* Starting the GUI thread */ 
  
  return C_OK;
}
Exemple #4
0
Main_win::Main_win(QWidget* parent) :
  QMainWindow(parent),
  ui_(new Ui::MainWindow),
  settings_("ma_trick_user",
            "ma_trick"), // stored in ~/.config/ma_trick_user/ma_trick.conf
  math_(new Simple_math(this)),
  A_set_(false),
  b_set_(false),
  dis_char_("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0)
{
  settings_.setFallbacksEnabled(false);
  read_settings();
  init_gui();
}
Exemple #5
0
int main(int argc, char* argv[])
{
	gtk_app_t* gtk_app = g_slice_new(gtk_app_t);

	// initialize GTK
	gtk_set_locale();
	gtk_init(&argc, &argv);

	init_gui(gtk_app);
	gtk_main();

	g_slice_free(gtk_app_t, gtk_app);

	return 0;
}
void init(int use_http, char *address, int port){
    // Setup periferal and library
    init_gui();
    init_motors();
    init_sensor();
	init_compass();
	calibrate_compass(0); // 0 = do not execute a new calibration of the compass	

	// Load ball predefined positions
	get_positions(POINTS_FILE_NAME, &positions, &n_points);

	// Start bluetooth
	if(use_http)
		bluetooth_test_init(address, port);
    else 
		bluetooth_init();
	
	//bluetooth_register_and_start(fAction_t, fAck_t, fLead_t, fStart_t, fStop_t, fWait_t, fKick_t, fCancel_t);
    bluetooth_register_and_start(&follower_action_cb, NULL, &lead_cb, &start_cb, &stop_cb, NULL, NULL, &cancel_cb);

	// Reset global variables
  	send_action_flag = 1;
	act = 0;
    end_game = 0;
    start_game = 0;
    wait = 0;
	cancel = 0;
	// Waiting for the game start
	set_light(LIT_LEFT, LIT_GREEN);
	set_light(LIT_RIGHT, LIT_GREEN);
    while(!start_game); //start game, robot rank and snake size  initialized by start_cb

	// Initial position
	home.x = BORDER_X_MAX/2;
	home.y = (snake_size - robot_rank -1)*40 + 20;
	center.x = BORDER_X_MAX/4;
	center.y = BORDER_Y_MAX/2;
	robot = home;
	
	printf("[DEBUG] Starting position X: %d, Y: %d, T: %d\n", robot.x , robot.y, robot.t);
	
	update_sensor(SENSOR_GYRO);
    gyro_init_val = get_sensor_value(SENSOR_GYRO);
    set_light(LIT_LEFT, LIT_OFF);
	set_light(LIT_RIGHT, LIT_OFF);
}
Exemple #7
0
int main()
{
  GUI* g = init_gui(NULL);
  create_main_window(g,"Test Window");
  set_main_size(g,300, 300);

  WIDGET* box = create_combobox(20,10,10,my_string);
  WIDGET* but = create_button("Hello",50,50);
  add_item_to_combobox(box,"Test 1");
  add_to_main(g,box);
  add_to_main(g,but);

  show_main(g);
  while(gui_running(g)){
    sleep(1);
  }

  destroy_gui(g);
  return 0;
}
/* The delegate object calls this method during initialization of an ARDrone application */
C_RESULT ardrone_tool_init_custom(int argc, char **argv)
{
  /* Create GUI */  
  init_gui(argc, argv); /* Creating the GUI */
  START_THREAD(gui, NULL); /* Starting the GUI thread */


  /* Registering for a new device of game controller */
  ardrone_tool_input_add( &gamepad );
 
 /* Cambia camara 
 ZAP_VIDEO_CHANNEL channel = ZAP_CHANNEL_HORI some channel, ex: ZAP_CHANNEL_LARGE_HORI_SMALL_VERT;
 ARDRONE_TOOL_CONFIGURATION_ADDEVENT (video_channel, &channel, NULL);*/


  /* Start all threads of your application */
  START_THREAD( video_stage, NULL );
  
  return C_OK;
}
int main(int argc,char** argv){
	int mot_value[] = {200, 400, 600, 1000, 1200};
    int us_value[NUM_TESTS];
    int i;

    // Init
	init_gui();
	init_motors();
	init_sensor();
	
    // US setup
    set_motors_speed(NORMAL_SPEED);
    printf("mot\tus\n");
    
    for(i=0; i<NUM_TESTS; i++){
        us_value[i] = do_test(mot_value[i]);
    }
    
    return 0;
}
void replay_controller::init(){
	DBG_REPLAY << "in replay_controller::init()...\n";

	//guarantee the cursor goes back to 'normal' at the end of the level
	const cursor::setter cursor_setter(cursor::NORMAL);
	init_replay_display();

	fire_prestart(true);
	init_gui();
	statistics::fresh_stats();
	set_victory_when_enemies_defeated(
		utils::string_bool(level_["victory_when_enemies_defeated"], true));

	DBG_REPLAY << "first_time..." << (recorder.is_skipping() ? "skipping" : "no skip") << "\n";

	fire_start(!loading_game_);
	update_gui();

	units_start_ = units_;
	teams_start_ = teams_;
}
Exemple #11
0
int		main(int ac, char *av[])
{
	int		gui(0);
	int		width(0);
	int		height(0);

	// Error handling
	if (ac < 3 || ac >= 5)
	{
	   	std::cout << "\033[31mWrong number of argument\033[0m" << std::endl << "> ./snake WIDTH HEIGHT [library.so]" << std::endl;
	   	return 0;
	}
	if (ac == 3)
		gui = 0;
	else if (ac == 4 && strcmp(av[3], "libsfml.so") == 0)
		gui = 0;
	else if (ac == 4 && strcmp(av[3], "libsdl.so") == 0)
		gui = 1;
	else if (ac == 4 && strcmp(av[3], "libglfw.so") == 0)
		gui = 2;

	width = atoi(av[1]);
	height = atoi(av[2]);

	if (width < 300 || height < 300)
	{
		std::cout << "Game area is too small. It must be greater or equal than 300" << std::endl;
		return 0;
	}
	else if (width > 1000 || height > 1000)
	{
		std::cout << "Game area is toot big. It must be smaller than 1000" << std::endl;
		return 0;
	}

	srand(time(0));
	init_gui(gui, width, height);

	return(0);
}
void replay_controller::reset_replay(){

	gui_->clear_chat_messages();
	is_playing_ = false;
	player_number_ = 1;
	current_turn_ = 1;
	it_is_a_new_turn_ = true;
	skip_replay_ = false;
	tod_manager_= tod_manager_start_;
	recorder.start_replay();
	recorder.set_skip(false);
	units_ = units_start_;
	gamestate_ = gamestate_start_;
	teams_ = teams_start_;
	if (events_manager_ ){
		// NOTE: this double reset is required so that the new
		// instance of game_events::manager isn't created before the
		// old manager is actually destroyed (triggering an assertion
		// failure)
		events_manager_.reset();
		events_manager_.reset(new game_events::manager(level_));
	}

	gui_->labels().read(level_);

	statistics::fresh_stats();
	set_victory_when_enemies_defeated(level_["victory_when_enemies_defeated"].to_bool(true));

	// Add era events for MP game.
	if (const config &era_cfg = level_.child("era")) {
		game_events::add_events(era_cfg.child_range("event"), "era_events");
	}

	fire_prestart(true);
	init_gui();
	fire_start(true);
	update_gui();

	reset_replay_ui();
}
Exemple #13
0
int main(int argc, char* argv[]){

  ui = new UI();

  init_gui();

  ui->arranger->take_focus();

  load_config();

  if(init_backend(&argc, &argv) < 0){
    return 1;
  }

  if(argc > 1){
    if(loadsmf(argv[1])<0){
      if(load(argv[1])<0){
        reset_song();
      }
    }
  }
  else{
    reset_song();
  }

  



  int ret = fltk::run();

  shutdown_backend();

  delete ui;

  return ret;

}
Exemple #14
0
int main(int argc, char **argv)
{
	printf("\nDCPU-16 emulator (CPU spec 1.7) - Reid Horuff\n");
	
	init_dcpu();
	init_hardware();
	init_disassembler();
	
	if(argc > 1)
	{
		if(!open_file( argv[1] )){
			printf("Error opening file\n");
		}
		else if( argc > 2 && !strcmp(argv[2], "-d")){
			init_disassembler();
			dump_all();
			exit(0);
		}
	}	
	
	init_gui(argc, argv);
	return 0;
}
Exemple #15
0
int main()
{
	char filename[50] = {'\0'};
	//fileBrowser(filename, (unsigned char*)"*.lua", (unsigned char*)"*.lc", (unsigned char*)"*.txt", "Title"); //*.lua, *.lc, *.txt: filetypes to filter; "Title": small text to show in blue on the top left corner  
	Exec_info exec_info = {0,0,0};
	int key = 0, debug = 0, handle_program, i=0;
	char pc_s[10];
	Bdisp_AllClr_VRAM();

	srand(time_getTicks());

	init_gui();
	init_machine();
	while(1) {
		handle_program = gui(exec_info);
		if(handle_program > 0) {
			init_machine();
			load_game(handle_program);
			exec_info = play_game();
		} else {
			while(i < 10) {
				nio_DrawConsole(&c1);
				GetKey(&key);
				i++;
			}
			i=0;
		}
	}

	nio_CleanUp(&c1);

	while(1) {
		GetKey(&key);
	}
	return 1;
}
/*!
 @brief High level task for wiimote.

 Handles initializing wiimote.
 */
void control_tasks(char *dev_name)
{
	WiimoteState_t WiimoteState = WII_PROMPT;
	bdaddr_t bdaddr = *BDADDR_ANY; /* bluetooth device address */

	init_tick_count();

#if _MUTEX_ENABLE
	pthread_mutex_lock(&mutex);
#endif

#if HAVE_GTK
	int argc_dummy = 0;
	char **argv_dummy = NULL;
	init_gui(argc_dummy, argv_dummy);

	set_comm_trace(true);
	set_diagnostic_mode(true);
#else
	if (0 >= comm_init(dev_name))
	{
		debug_print("@%u: Cannot initialize %s\n", get_tick_count(), dev_name);
		exit(4);
	}
	else
	{
		debug_print("@%u: %s initialized.\n", get_tick_count(), dev_name);
	}

	do
	{
		debug_print("Connecting to controller board... ");
		if (0 > send_password("WIFIBOT123"))
		{
			debug_print("Error\n");
		}
		else
		{
			debug_print("Done\n");
			break;
		}
	}while (1);

#endif

	set_lcd(0, "%s", PACKAGE_NAME);
	set_lcd(1, "Rev: %s", PACKAGE_VERSION);

	// display startup for 1 s
	sleep(1);

	cwiid_set_err(err);

	for (;;)
	{

		switch (WiimoteState)
		{
		case WII_PROMPT:
			/* Connect to the wiimote */
			debug_print(
					"Put Wiimote in discoverable mode now (press 1+2)...\n");

			set_lcd(0, "Connecting...");
			set_lcd(1, "Press 1+2 now");
			WiimoteState = WII_WAIT_FOR_CONNECTION;
			break;
		case WII_WAIT_FOR_CONNECTION:
			if (!(wiimote = cwiid_open(&bdaddr, 0)))
			{
				fprintf(stderr, "Unable to connect to wiimote, retrying...\n");
				WiimoteState = WII_PROMPT;
			}
			else if (cwiid_set_mesg_callback(wiimote, cwiid_callback))
			{
				fprintf(stderr,
						"Unable to set message callback, retrying...\n");
				WiimoteState = WII_PROMPT;
			}
			else
			{
				WiimoteState = WII_OPERATE;
			}
			break;
		case WII_OPERATE:
		default:
			main_menu(wiimote, &wiimote_status_data);
			debug_print("exiting.\n");
			shutdown_application(0);
			break;
		}
	}
}
LEVEL_RESULT playsingle_controller::play_scenario(
	const config::const_child_itors &story,
	bool skip_replay)
{
	uint32_t start = SDL_GetTicks();
	// level_
	//   save game: [snapshort] in save file
	//   new game: [scenario] in <scenarios>.cfg

	// Start music.
	BOOST_FOREACH (const config &m, level_.child_range("music")) {
		sound::play_music_config(m);
	}
	sound::commit_music_changes();

	if(!skip_replay) {
		// show_story(*gui_, level_["name"], story);
		// gui2::show_story(*gui_, level_["name"], story);
	}
	gui_->labels().read(level_);

	// Read sound sources
	assert(soundsources_manager_ != NULL);
	BOOST_FOREACH (const config &s, level_.child_range("sound_source")) {
		soundsource::sourcespec spec(s);
		soundsources_manager_->add(spec);
	}

	uint32_t end_sound_sources = SDL_GetTicks();
	posix_print("playsingle_controller::play_scenario, sound sources, used time: %u ms\n", end_sound_sources - start);
				
	set_victory_when_enemy_no_city(level_["victory_when_enemy_no_city"].to_bool(true));
	end_level_data &end_level = get_end_level_data();
	end_level.carryover_percentage = level_["carryover_percentage"].to_int(game_config::gold_carryover_percentage);
	end_level.carryover_add = level_["carryover_add"].to_bool();

	try {

		uint32_t end_entering_try = SDL_GetTicks();
		posix_print("playsingle_controller::play_scenario, entering try, used time: %u ms\n", end_entering_try - end_sound_sources);
		
		fire_prestart(!loading_game_);
		uint32_t end_fire_prestart = SDL_GetTicks();
		posix_print("playsingle_controller::play_scenario, fire_prestrt, used time: %u ms\n", end_fire_prestart - end_entering_try);
		
		init_gui();

		fire_start(!loading_game_);
		gui_->recalculate_minimap();

		// replaying_ = (recorder.at_end() == false);

		// Initialize countdown clock.
		std::vector<team>::iterator t;
		for(t = teams_.begin(); t != teams_.end(); ++t) {
			if (gamestate_.mp_settings().mp_countdown && !loading_game_ ){
				t->set_countdown_time(1000 * gamestate_.mp_settings().mp_countdown_init_time);
			}
		}

		// if we loaded a save file in linger mode, skip to it.
		if (linger_) {
			//determine the bonus gold handling for this scenario
			const config end_cfg = level_.child_or_empty("endlevel");
			end_level.carryover_percentage = level_["carryover_percentage"].to_int(game_config::gold_carryover_percentage);
			end_level.carryover_add = level_["carr`yover_add"].to_bool();
			end_level.gold_bonus = end_cfg["bonus"].to_bool(true);
			end_level.carryover_report = false;
			throw end_level_exception(SKIP_TO_LINGER);
		}

		// Avoid autosaving after loading, but still
		// allow the first turn to have an autosave.
		bool save = !loading_game_;
		for(; ; first_player_ = 1) {
			play_turn(save);
			save = true;
		} //end for loop

	} catch(game::load_game_exception& lge) {
		// Loading a new game is effectively a quit.
		//
		if (lge.game != "") {
			gamestate_ = game_state();
		}
		throw lge;
	} catch (end_level_exception &end_level_exn) {
		LEVEL_RESULT end_level_result = end_level_exn.result;
		if (!end_level.custom_endlevel_music.empty()) {
			if (end_level_result == DEFEAT) {
				set_defeat_music_list(end_level.custom_endlevel_music);
			} else {
				set_victory_music_list(end_level.custom_endlevel_music);
			}
		}

		if (teams_.empty())
		{
			//store persistent teams
			gamestate_.snapshot = config();

			return VICTORY; // this is probably only a story scenario, i.e. has its endlevel in the prestart event
		}
		const bool obs = is_observer();
		if (end_level_result == DEFEAT || end_level_result == VICTORY)
		{
			gamestate_.classification().completion = (end_level_exn.result == VICTORY) ? "victory" : "defeat";
			// If we're a player, and the result is victory/defeat, then send
			// a message to notify the server of the reason for the game ending.
			if (!obs) {
				config cfg;
				config& info = cfg.add_child("info");
				info["type"] = "termination";
				info["condition"] = "game over";
				info["result"] = gamestate_.classification().completion;
				network::send_data(cfg, 0);
			} else {
				gui2::show_transient_message(gui_->video(),_("Game Over"),
									_("The game is over."));
				return OBSERVER_END;
			}
		}

		if (end_level_result == QUIT) {
			return QUIT;
		}
		else if (end_level_result == DEFEAT)
		{
			gamestate_.classification().completion = "defeat";
			game_events::fire("defeat");

			if (!obs) {
				const std::string& defeat_music = select_defeat_music();
				if(defeat_music.empty() != true)
					sound::play_music_once(defeat_music);

				return DEFEAT;
			} else {
				return QUIT;
			}
		}
		else if (end_level_result == VICTORY)
		{
			gamestate_.classification().completion =
				!end_level.linger_mode ? "running" : "victory";
			game_events::fire("victory");

			//
			// Play victory music once all victory events
			// are finished, if we aren't observers.
			//
			// Some scenario authors may use 'continue'
			// result for something that is not story-wise
			// a victory, so let them use [music] tags
			// instead should they want special music.
			//
			if (!obs && end_level.linger_mode) {
				const std::string& victory_music = select_victory_music();
				if(victory_music.empty() != true)
					sound::play_music_once(victory_music);
			}

			// Add all the units that survived the scenario.
			LOG_NG << "Add units that survived the scenario to the recall list.\n";
			//store all units that survived (recall list for the next scenario) in snapshot
			gamestate_.snapshot = config();
			//store gold and report victory
			store_gold(obs);
			return VICTORY;
		}
		else if (end_level_result == SKIP_TO_LINGER)
		{
			LOG_NG << "resuming from loaded linger state...\n";
			//as carryover information is stored in the snapshot, we have to re-store it after loading a linger state
			gamestate_.snapshot = config();
			store_gold();
			return VICTORY;
		}
	} // end catch
	catch(network::error& e) {
		bool disconnect = false;
		if(e.socket) {
			e.disconnect();
			disconnect = true;
		}

		config snapshot;
		to_config(snapshot);
		savegame::game_savegame save(heros_, heros_start_, gamestate_, *gui_, snapshot);
		save.save_game_interactive(gui_->video(), _("A network disconnection has occurred, and the game cannot continue. Do you want to save the game?"), gui::YES_NO);
		if(disconnect) {
			throw network::error();
		} else {
			return QUIT;
		}
	}

	return QUIT;
}
int
main(
	int			argc,
	char **			argv
)
{


	Fl::gl_visual( FL_RGB );

	gui = new UserInterface();
	gui->make_window()->show( argc, argv );
 /*   gui->glstripchart->setBaseline(22400);
    gui->glstripchart1->setBaseline(18700);
    gui->glstripchart2->setBaseline(15300);
    gui->glstripchart3->setBaseline(8000);
    gui->glstripchart4->setBaseline(14000);
    gui->glstripchart5->setBaseline(17000);*/

#define IMU_ZOOM_MIN 1
#define IMU_ZOOM_MAX 1200
#define IMU_ZOOM_DEFAULT 600

    gui->zaccel_zoom->range(IMU_ZOOM_MIN, IMU_ZOOM_MAX);
    gui->zaccel_zoom->value(IMU_ZOOM_DEFAULT);
    gui->xaccel_zoom->range(IMU_ZOOM_MIN, IMU_ZOOM_MAX);
    gui->xaccel_zoom->value(IMU_ZOOM_DEFAULT);
    gui->yaccel_zoom->range(IMU_ZOOM_MIN, IMU_ZOOM_MAX);
    gui->yaccel_zoom->value(IMU_ZOOM_DEFAULT);
    gui->yaw_zoom->range(IMU_ZOOM_MIN, IMU_ZOOM_MAX);
    gui->yaw_zoom->value(IMU_ZOOM_DEFAULT);
    gui->pitch_zoom->range(IMU_ZOOM_MIN, IMU_ZOOM_MAX);
    gui->pitch_zoom->value(IMU_ZOOM_DEFAULT);
    gui->roll_zoom->range(IMU_ZOOM_MIN, IMU_ZOOM_MAX);
    gui->roll_zoom->value(IMU_ZOOM_DEFAULT);

	gui->serial_device_name->value("/dev/ttyS0");

    Fl_Text_Buffer textBuffer = Fl_Text_Buffer();
    gui->raw_serial_output->buffer(&textBuffer);

#ifdef WIN32
    gui->unix_serial->deactivate();
#else
    gui->win32_serial->deactivate();
#endif

    init_gui();
 
    Fl::add_timeout(
        .1,
        sync_handler
    );

    Fl::add_timeout(
#ifdef WIN32
        .11,
#else
        .05,
#endif
        anim_handler
    );

    Fl::add_timeout(
        1,
        status_handler
    );
    
	return Fl::run();
}
Exemple #19
0
int main(int argc, char **argv)
{
   return init_gui(argc, argv);;
}
LEVEL_RESULT playsingle_controller::play_scenario(
	const config::const_child_itors &story,
	bool skip_replay)
{
	LOG_NG << "in playsingle_controller::play_scenario()...\n";

	// Start music.
	foreach (const config &m, level_.child_range("music")) {
		sound::play_music_config(m);
	}
	sound::commit_music_changes();

	if(!skip_replay) {
		show_story(*gui_, level_["name"], story);
	}
	gui_->labels().read(level_);

	// Read sound sources
	assert(soundsources_manager_ != NULL);
	foreach (const config &s, level_.child_range("sound_source")) {
		soundsource::sourcespec spec(s);
		soundsources_manager_->add(spec);
	}

	set_victory_when_enemies_defeated(level_["victory_when_enemies_defeated"].to_bool(true));
	end_level_data &end_level = get_end_level_data();
	end_level.carryover_percentage = level_["carryover_percentage"].to_int(game_config::gold_carryover_percentage);
	end_level.carryover_add = level_["carryover_add"].to_bool();

	bool past_prestart = false;

	LOG_NG << "entering try... " << (SDL_GetTicks() - ticks_) << "\n";
	try {

		fire_prestart(!loading_game_);
		init_gui();

		past_prestart = true;

		LOG_NG << "first_time..." << (recorder.is_skipping() ? "skipping" : "no skip") << "\n";

		events::raise_draw_event();
		fire_start(!loading_game_);
		gui_->recalculate_minimap();

		replaying_ = (recorder.at_end() == false);

		LOG_NG << "starting main loop\n" << (SDL_GetTicks() - ticks_) << "\n";

		// Initialize countdown clock.
		std::vector<team>::iterator t;
		for(t = teams_.begin(); t != teams_.end(); ++t) {
			if (gamestate_.mp_settings().mp_countdown && !loading_game_ ){
				t->set_countdown_time(1000 * gamestate_.mp_settings().mp_countdown_init_time);
			}
		}

		// if we loaded a save file in linger mode, skip to it.
		if (linger_) {
			//determine the bonus gold handling for this scenario
			end_level.read(level_.child_or_empty("endlevel"));
			end_level.carryover_report = false;
			end_level.disabled = true;
			throw end_level_exception(SKIP_TO_LINGER);
		}

		// Avoid autosaving after loading, but still
		// allow the first turn to have an autosave.
		bool save = !loading_game_;
		ai_testing::log_game_start();
		for(; ; first_player_ = 1) {
			play_turn(save);
			save = true;
		} //end for loop

#ifdef _MSC_VER
//MSVC claims that const game::load_game_exception& lge would be unreferenced...
#pragma warning (push)
#pragma warning (disable : 4101)
#endif
	} catch(const game::load_game_exception& lge) {
		// Loading a new game is effectively a quit.
		//
		if (lge.game != "") {
			gamestate_ = game_state();
		}
		throw;
	} catch (end_level_exception &end_level_exn) {
		if(!past_prestart) {
			draw_solid_tinted_rectangle(
				0, 0, gui_->video().getx(), gui_->video().gety(), 0, 0, 0, 1.0,
				gui_->video().getSurface()
			);
			update_rect(0, 0, gui_->video().getx(), gui_->video().gety());
		}

		ai_testing::log_game_end();
		LEVEL_RESULT end_level_result = end_level_exn.result;
		if (!end_level.custom_endlevel_music.empty()) {
			if (end_level_result == DEFEAT) {
				set_defeat_music_list(end_level.custom_endlevel_music);
			} else {
				set_victory_music_list(end_level.custom_endlevel_music);
			}
		}

		if (teams_.empty())
		{
			//store persistent teams
			gamestate_.snapshot = config();
			store_recalls();

			return VICTORY; // this is probably only a story scenario, i.e. has its endlevel in the prestart event
		}
		const bool obs = is_observer();
		if (game_config::exit_at_end) {
			exit(0);
		}
		if (end_level_result == DEFEAT || end_level_result == VICTORY)
		{
			gamestate_.classification().completion = (end_level_exn.result == VICTORY) ? "victory" : "defeat";
			// If we're a player, and the result is victory/defeat, then send
			// a message to notify the server of the reason for the game ending.
			if (!obs) {
				config cfg;
				config& info = cfg.add_child("info");
				info["type"] = "termination";
				info["condition"] = "game over";
				info["result"] = gamestate_.classification().completion;
				network::send_data(cfg, 0);
			} else {
				gui2::show_transient_message(gui_->video(),_("Game Over"),
									_("The game is over."));
				return OBSERVER_END;
			}
		}

		if (end_level_result == QUIT) {
			return QUIT;
		}
		else if (end_level_result == DEFEAT)
		{
			gamestate_.classification().completion = "defeat";
			game_events::fire("defeat");

			if (!obs) {
				const std::string& defeat_music = select_defeat_music();
				if(defeat_music.empty() != true)
					sound::play_music_once(defeat_music);

				return DEFEAT;
			} else {
				return QUIT;
			}
		}
		else if (end_level_result == VICTORY)
		{
			gamestate_.classification().completion =
				!end_level.linger_mode ? "running" : "victory";
			game_events::fire("victory");

			//
			// Play victory music once all victory events
			// are finished, if we aren't observers.
			//
			// Some scenario authors may use 'continue'
			// result for something that is not story-wise
			// a victory, so let them use [music] tags
			// instead should they want special music.
			//
			if (!obs && end_level.linger_mode) {
				const std::string& victory_music = select_victory_music();
				if(victory_music.empty() != true)
					sound::play_music_once(victory_music);
			}

			// Add all the units that survived the scenario.
			LOG_NG << "Add units that survived the scenario to the recall list.\n";
			for(unit_map::iterator un = units_.begin(); un != units_.end(); ++un) {

				if (teams_[un->side() - 1].persistent()) {
					LOG_NG << "Added unit " << un->id() << ", " << un->name() << "\n";
					un->new_turn();
					un->new_scenario();
					teams_[un->side() - 1].recall_list().push_back(*un);
				}
			}
			//store all units that survived (recall list for the next scenario) in snapshot
			gamestate_.snapshot = config();
			store_recalls();
			//store gold and report victory
			store_gold(obs);
			return VICTORY;
		}
		else if (end_level_result == SKIP_TO_LINGER)
		{
			LOG_NG << "resuming from loaded linger state...\n";
			//as carryover information is stored in the snapshot, we have to re-store it after loading a linger state
			gamestate_.snapshot = config();
			store_recalls();
			store_gold();
			return VICTORY;
		}
	} // end catch
	catch(network::error& e) {
		bool disconnect = false;
		if(e.socket) {
			e.disconnect();
			disconnect = true;
		}

		savegame::game_savegame save(gamestate_, *gui_, to_config(), preferences::compress_saves());
		save.save_game_interactive(gui_->video(), _("A network disconnection has occurred, and the game cannot continue. Do you want to save the game?"), gui::YES_NO);
		if(disconnect) {
			throw network::error();
		} else {
			return QUIT;
		}
	}

	return QUIT;
}
Exemple #21
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   LPWSTR lpCmdLine, int nShowCmd) {
  DWORD tmp;
  BOOL fActivated;
  _hAppInstance = hInstance;

  if (FAILED(ActivatePreviousInstance(_szAppName, _szTitle, &fActivated)) ||
      fActivated) {
    // Exit immediately if previous instance exists
    return 0;
  }

  process_command_line(lpCmdLine);
  if (_WindowSystem && _argc == 1) {
    int eembc = 0, hello = 0, mixed = 1, done = 0;

    init_gui(hInstance, hPrevInstance, nShowCmd);
    if (!done && MessageBox(NULL, TEXT("EEMBC (mixed)?"),
                            TEXT("Pick a program"), MB_YESNO) == IDYES) {
      done = 1; eembc = 1;
    }
    if (!done && MessageBox(NULL, TEXT("EEMBC (int)?"),
                            TEXT("Pick a program"), MB_YESNO) == IDYES) {
      done = 1; eembc = 1; mixed = 0;
    }
    if (!done && MessageBox(NULL, TEXT("HelloWorld (mixed)?"),
                            TEXT("Pick a program"), MB_YESNO) == IDYES) {
      done = 1; hello = 1;
    }
    if (!done && MessageBox(NULL, TEXT("HelloWorld (int)?"),
                            TEXT("Pick a program"), MB_YESNO) == IDYES) {
      done = 1; hello = 1; mixed = 0;
    }

    if (!done) {
      exit(0);
    }
    //_argv[_argc++] = "=HeapMin1500K";
    //_argv[_argc++] = "=HeapCapacity1500K";
    if (!mixed) {
      _argv[_argc++] = "-int";
    }
    if (eembc) {
      _argv[_argc++] = "-cp";
      _argv[_argc++] = "/eembcBM.jar";
      _argv[_argc++] = "com.sun.mep.bench.main";
    }
    if (hello) {
      _argv[_argc++] = "-cp";
      _argv[_argc++] = "/HelloWorld.jar";
      _argv[_argc++] = "HelloWorld";
    }
  }

  SetForegroundWindow((HWND)(((DWORD)_hwndMain) | 0x01));

  HANDLE vm_thread_handle = CreateThread(NULL, 0, 
        (LPTHREAD_START_ROUTINE)&vm_thread_routine, 0, 0, &tmp);

  // Handle events until we're done
  if (_WindowSystem) {
    MSG msg;
    while (GetMessage(&msg, NULL, 0,0) == TRUE) {
      TranslateMessage (&msg);
      DispatchMessage(&msg);
    }
  } else {
    if (vm_thread_handle != NULL) {
      WaitForSingleObject(vm_thread_handle, INFINITE);
    }
  }

  CloseHandle(vm_thread_handle);

  if (_log_file) {
    fclose(_log_file);
    _log_file = NULL;
  }
  TerminateProcess(GetCurrentProcess(), 0);

  return 0;
}
Exemple #22
0
int main(int argc, char* argv[]) {
	init_gui(argc, argv);
}
void replay_controller::reset_replay()
{
	DBG_REPLAY << "replay_controller::reset_replay\n";

	gui_->get_chat_manager().clear_chat_messages();
	is_playing_ = false;
	player_number_ = 1;
	current_turn_ = 1;
	it_is_a_new_turn_ = true;
	skip_replay_ = false;
	gamestate_.tod_manager_= tod_manager_start_;
	recorder.start_replay();
	recorder.set_skip(false);
	saved_game_ = saved_game_start_;
	gamestate_.board_ = gameboard_start_;
	gui_->change_display_context(&gamestate_.board_); //this doesn't change the pointer value, but it triggers the gui to update the internal terrain builder object,
						   //idk what the consequences of not doing that are, but its probably a good idea to do it, esp. if layout
						   //of game_board changes in the future
	if (events_manager_ ){
		// NOTE: this double reset is required so that the new
		// instance of game_events::manager isn't created before the
		// old manager is actually destroyed (triggering an assertion
		// failure)
		events_manager_.reset();
		events_manager_.reset(new game_events::manager(level_));
	}

	gui_->labels().read(level_);

	resources::gamedata->rng().seed_random(level_["random_seed"], level_["random_calls"]);
	statistics::fresh_stats();
	set_victory_when_enemies_defeated(level_["victory_when_enemies_defeated"].to_bool(true));

	resources::screen->recalculate_minimap();
	resources::screen->invalidate_all();
	resources::screen->rebuild_all();

	// Add era events for MP game.
	if (const config &era_cfg = level_.child("era")) {
		game_events::add_events(era_cfg.child_range("event"), "era_events");
	}

	// Scenario initialization. (c.f. playsingle_controller::play_scenario())
	fire_preload();
	if(true){ //block for set_scontext_synced
		if(recorder.add_start_if_not_there_yet())
		{
			ERR_REPLAY << "inserted missing [start]" << std::endl;
		}
		config* pstart = recorder.get_next_action();
		assert(pstart->has_child("start"));
		/*
			use this after recorder.add_synced_command
			because set_scontext_synced sets the checkup to the last added command
		*/
		set_scontext_synced sync;

		fire_prestart();
		init_gui();
		fire_start(true);
	}
	// Since we did not fire the start event, it_is_a_new_turn_ has the wrong value.
	it_is_a_new_turn_ = true;
	update_gui();

	reset_replay_ui();
}
Exemple #24
0
int run_game_loop(GameState * state) {
	int done = 0;
	int i = 0;

	/* Initialise gui */
	init_gui(SCREEN_WIDTH,SCREEN_HEIGHT);

	/* Load resources */
	init_sprite_cache();
	render_world_to_sprite(&state->world);
	update_hud(
		&state->hud, 
		&state->score,
		&state->mana,
		&state->money, 
		&state->world.castle->castle.health,
		&state->wave.wave_number,
		&state->play);

	/* Initialise game loop */
	init_game_loop(FPS);
	while (!done) {
		
			/* Get events */
			Event ev;
			wait_for_event(&ev);

			/* Event handlers */
			switch (ev.type) {
			case EVENT_TIMER:
				state->redraw = 1;
				if (!state->game_over) {
					if (*state->hud.play) {
						check_spells(state);
						check_enemy_wave(state);
						update_movement(state);
						do_tower_attacks(state);
					}
				}
				break;
			case EVENT_MOUSE_MOVE:
				mouse_move(&ev.mouseMoveEvent, state);
				break;
			case EVENT_MOUSE_DOWN:
				mouse_down(&ev.mouseDownEvent, state);
				break;
			case EVENT_MOUSE_UP:
				mouse_up(&ev.mouseUpEvent, state);
				break;
			case EVENT_DISPLAY_CLOSE:
				done = 1;
				break;
			} 

			/* Render only on timer event AND if all movement and logic was processed */
			if (state->redraw && all_events_processed()) { 
				render_game(state);
			}
	}
	/* Cleanup */
	cleanup_game_loop();
	cleanup_sprite_cache();
	return 0;
}
Exemple #25
0
int
main(int argc, char** argv)
{
  int i;
  int map_idx;
  int planner_idx;
  int have_map;

  pose_t robot_pose;

  gui_data_t gui_data;

  memset(&gui_data, 0, sizeof(gui_data));

  dumpfreq = 5.0;

  gui_data.initial_zoom = 1.0;
  gui_data.aa = 1;
  map_idx = 0;
  planner_idx = 0;

  if(parse_args(argc-1, argv+1, &(gui_data.num_robots), gui_data.hostnames, 
                gui_data.ports, &(gui_data.initial_zoom), &(gui_data.aa),
                &map_idx, &planner_idx) < 0)
  {
    // Input problem, print usage and exit with error
    puts(USAGE);
    exit(-1);
  }

  if (signal(SIGINT, _interrupt_callback) ==SIG_ERR)
  {
    // Couldn't register signal callback, exit with error
    exit(-1);
  }

  gui_data.mclient = init_player(gui_data.clients, 
                                        gui_data.maps, 
                                        gui_data.localizes, 
                                        gui_data.planners, 
                                        gui_data.num_robots, 
                                        gui_data.hostnames, 
                                        gui_data.ports, 
                                        DATA_FREQ,
                                        map_idx,
                                        planner_idx);
  if(! gui_data.mclient )
  {
    // Connection to Player failed, exit with error
    exit(-1);
  }

  // assume the robots all start enabled (should really get the current
  // enable/disable state for each robot from the server).
  for(i=0;i<gui_data.num_robots;i++)
    gui_data.robot_enable_states[i] = 1;

  // use the first robot for the map
  gui_data.mapdev = gui_data.maps[0];

  /* Get the map, just so we know how big to make the window */
  puts("requesting map");
  if(playerc_map_get_map(gui_data.mapdev) < 0)
  {
    have_map = 0;
    fprintf(stderr, "Failed to get map\n");
    // no map yet; guess some values to initialize the GUI
    gui_data.mapdev->width = gui_data.mapdev->height = 400;
    gui_data.mapdev->resolution = 0.1;
    gui_data.mapdev->origin[0] = -20.0;
    gui_data.mapdev->origin[1] = -20.0;
  }
  else
  {
    have_map = 1;
    puts("done");
  }

  init_gui(&gui_data, argc, argv);

  // now draw the map
  if(have_map)
    create_map_image(&gui_data);

  for(i=0;i<gui_data.num_robots;i++)
  {
    if(gui_data.localizes[i] || gui_data.planners[i])
    {
      robot_pose.px = 0.0;
      robot_pose.py = 0.0;
      robot_pose.pa = 0.0;
      create_robot(&gui_data, i, robot_pose);
    }
  }

  gtk_widget_show((GtkWidget*)(gui_data.main_window));

  // setup read function to be called when idle
  g_idle_add((GSourceFunc)player_read_func,
             (gpointer*)&gui_data);

  gtk_main();

  fini_player(gui_data.mclient,
              gui_data.clients,
              gui_data.maps,
              gui_data.localizes,
              gui_data.planners,
              gui_data.num_robots);
  fini_gui(&gui_data);

  return(0);
}
Exemple #26
0
int main(int args, char *argv[]) {

	char *save_file;
	ines_file *nes_rom;

	/* Print NOW everything :D */
#ifdef _MSC_VER
	setvbuf(stdout,NULL,_IONBF,0);
	setvbuf(stderr,NULL,_IONBF,0);
#else
	setbuf(stdout,NULL);
	setbuf(stderr,NULL);
#endif

	/* i18n stuff */
	setlocale(LC_ALL, "");
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);

	/* Parse command line options */
	initialize_configuration();
	switch ( parse_options(args, argv) ) {
		case -1:
			usage(stderr,argv);
			exit(EXIT_FAILURE);
		case 0:
			exit(EXIT_SUCCESS);
		default:
			break;
	}

	load_user_configuration();

	/* Initialize static data */
	initialize_palette();
	initialize_instruction_set();
	initialize_playback();
	initialize_apu();
	initialize_cpu();
	initialize_ppu();
	initialize_clock();
	initialize_pads();

	/* Read the ines file and get all the ROM/VROM */
	config.rom_file = argv[optind];
	nes_rom = check_ines_file(config.rom_file);
	map_rom_memory(nes_rom);
	save_file = load_sram(config.rom_file);

	/* Init the graphics engine */
	init_screen();
	init_gui();

	/* Main execution loop */
	main_loop();

	/* After finishing the emulation, save the SRAM if necessary */
	save_sram(save_file);
	free(save_file);

	/* Free all the used resources */
	mapper->end_mapper();
	end_screen();
	end_gui();
	end_ppu();
	end_cpu();
	end_apu();
	end_playback();
	free_ines_file(nes_rom);

	return 0;
}
MainWindow2::MainWindow2( QWidget *owner ):QMainWindow(owner)
{
	statusBar();
	init_actions();
	init_gui();
}
void replay_controller::reset_replay()
{
	DBG_REPLAY << "replay_controller::reset_replay\n";

	gui_->clear_chat_messages();
	is_playing_ = false;
	player_number_ = 1;
	current_turn_ = 1;
	it_is_a_new_turn_ = true;
	skip_replay_ = false;
	tod_manager_= tod_manager_start_;
	recorder.start_replay();
	recorder.set_skip(false);
	units_ = units_start_;
	gamestate_ = gamestate_start_;
	teams_ = teams_start_;
	if (events_manager_ ){
		// NOTE: this double reset is required so that the new
		// instance of game_events::manager isn't created before the
		// old manager is actually destroyed (triggering an assertion
		// failure)
		events_manager_.reset();
		events_manager_.reset(new game_events::manager(level_));
	}

	gui_->labels().read(level_);

	resources::gamedata->rng().seed_random(level_["random_seed"], level_["random_calls"]);
	statistics::fresh_stats();
	set_victory_when_enemies_defeated(level_["victory_when_enemies_defeated"].to_bool(true));

	// Add era events for MP game.
	if (const config &era_cfg = level_.child("era")) {
		game_events::add_events(era_cfg.child_range("event"), "era_events");
	}

	// Scenario initialization. (c.f. playsingle_controller::play_scenario())
	fire_preload();
	if(true){ //block for set_scontext_synced
		if(recorder.add_start_if_not_there_yet())
		{
			ERR_REPLAY << "inserted missing [start]" << std::endl;
		}
		config* pstart = recorder.get_next_action();
		assert(pstart->has_child("start"));
		/*
			use this after recorder.add_synced_command
			because set_scontext_synced sets the checkup to the last added command
		*/
		set_scontext_synced sync;
		
		fire_prestart(true);
		init_gui();
		fire_start(true);
	}
	// Since we did not fire the start event, it_is_a_new_turn_ has the wrong value.
	it_is_a_new_turn_ = true;
	update_gui();

	reset_replay_ui();
}
Exemple #29
0
int
main(int argc, char *argv[])
{
	char line[INPUTLEN];
	char buff[BUFFSIZE];

	char *peersfile;
	struct stat st;
	int rc;

	sigset_t set;

	if (argc < 3) {
		fprintf(stderr, "Usage: %s <peers_file> <self_id>\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	peersfile = argv[1];
	rc = stat(peersfile, &st);
	if (rc == -1) {
		if (errno == ENOENT) {
			fprintf(stderr, "Can't open %s.\n", peersfile);
			exit(EXIT_FAILURE);
		}
		else {
			fprintf(stderr, "Error stating %s: %d\n", peersfile, errno);
			exit(EXIT_FAILURE);
		}
	}
	self_info = NULL;
	load_peers(peersfile, argv[2]);
	if (self_info == NULL) {
		fprintf(stderr, "Can't find id %s in %s.\n", argv[2], peersfile);
		exit(EXIT_FAILURE);
	}

	init_gui();

	main_tid = pthread_self();

	sigemptyset(&set);
	sigaddset(&set, SIGINT);
	pthread_sigmask(SIG_BLOCK, &set, NULL);

	pthread_create(&heartbeat_tid, NULL, heartbeat, NULL);
	pthread_create(&chatserver_tid, NULL, chatserver, NULL);

	create_peers_poller();

	pthread_sigmask(SIG_UNBLOCK, &set, NULL);
	signal(SIGINT, sigint_handler);

	usleep(250000);
	chat_writeln(TRUE, LOG_INFO, "Client ready...");

	while(TRUE) {
		werase(input_window);
		wgetnstr(input_window, line, INPUTLEN);

		if (strstr(line, "status") == line) {
			chat_writeln(TRUE, LOG_INFO, "STATUS");
			cmd_status();
		}
		else if (strstr(line, "leave") == line) {
			werase(input_window);
			chat_writeln(TRUE, LOG_INFO, "Leaving...");
			sleep(1);
			break;
		}
		else if (strstr(line, "msg") == line) {
			cmd_message(line + 3);
		}
		else if (strstr(line, "bcast") == line) {
			cmd_broadcast(line + 5);
		}
		else if (strstr(line, "exec") == line) {
			cmd_exec(line + 4);
		}
		else {
			snprintf(buff, BUFFSIZE, "%s :unknown command", line);
			chat_writeln(TRUE, LOG_ERR, buff);
		}
	}

	sigint_handler(SIGINT);

	exit(EXIT_SUCCESS);
}
Exemple #30
0
/*setup_windows{{{*/
void setup_windows(int flags) {
 obj_param_t tmp_parm;

 globl_drop_depth =25;
 globl_flags = DROP_SHADOW;
 init_gui(WIDTH, HEIGHT, flags);

 SET_COLOR(globl_fg, 		0   ,0   ,0);
 SET_COLOR(globl_bg, 		224 ,224 ,204);
 SET_COLOR(globl_move_color, 	0x1f,0x8f,0x1f);
 SET_COLOR(hscroll_color, 	0   ,0x7f,0xff);
 SET_COLOR(sprite_color, 	0xff,0x7f,0);
 SET_COLOR(window_color, 	0   ,0   ,0xff);
 SET_COLOR(scroll_b_color, 	0xff,0   ,0xff);
 SET_COLOR(scroll_a_color, 	0xff,0   ,0);

 change_message_grp = new_group(40,40, 202, 77, globl_flags, globl_drop_depth);
 simple_window(change_message_grp, 200, 75);
 PARM(50, 45,100,20, &globl_fg, &globl_bg, SHOW_FOCUS | QUIT_BUTTON, proc_button_box);
 tmp_parm.dp1 = (void *)"Okay";
 new_obj(change_message_grp, &tmp_parm);
 PARM(12,16,172,20,&globl_fg, &globl_bg, MAX_CHARS|SHOW_FOCUS, proc_edit_line);
 tmp_parm.d3 = 80;
 text_edit_object = new_obj(change_message_grp, &tmp_parm);

 select_grp = new_group(0,0,WIDTH, HEIGHT,0,0);
 PARM(305,126,320,240,&globl_fg,&globl_bg,0,select_special);
 select_special_object = new_obj(select_grp, &tmp_parm);


 PARM(0,0, 304, 126, 0,0, 0, select_quit_on_click);
 tmp_parm.user_flags = 0;
 new_obj(select_grp, &tmp_parm);

 PARM(0,126,304,240, 0,0, 0, select_quit_on_click);
 tmp_parm.user_flags = HORIZONTAL;
 new_obj(select_grp, &tmp_parm);

 PARM(0, 366, 305, 112, 0,0, 0, select_quit_on_click);
 tmp_parm.user_flags = 0;
 new_obj(select_grp, &tmp_parm);

 PARM(305, 0, 320, 126, 0,0, 0, select_quit_on_click);
 new_obj(select_grp, &tmp_parm);

 PARM(305, 366, 320, 114, 0,0, 0, select_quit_on_click);
 tmp_parm.user_flags = VERTICAL;
 new_obj(select_grp, &tmp_parm);

 PARM(625, 0, 15, 480, 0,0,0, select_quit_on_click);
 tmp_parm.user_flags = 0;
 new_obj(select_grp, &tmp_parm);

 main_grp = new_group(0,0, WIDTH, HEIGHT, 0, 0);

 PARM(0,0,WIDTH,HEIGHT,&globl_fg,&globl_bg,DROP_ACCUM|LOAD_XPM_FROM_ARRAY,proc_bitmap);
 tmp_parm.dp1 = back_xpm;
 background_object = new_obj(main_grp, &tmp_parm);

 PARM(82,22,0,0,&globl_fg,&globl_bg,
   TOGGLE|CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = undo_button;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 1;
 tmp_parm.dp1 = undo_xpm;
 new_obj(main_grp, &tmp_parm);


 /* tools */

 PARM(124, 22, 0, 0, &globl_fg, &globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY, proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = select_xpm;
 select_object = new_obj(main_grp, &tmp_parm);

 PARM(82, 53, 0, 0, &globl_fg, &globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY, proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = pal_hi_low_xpm;
 pal_hi_low_object = new_obj(main_grp, &tmp_parm);

 PARM(124, 53, 0, 0, &globl_fg, &globl_bg, 
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = flip_xpm;
 flip_object = new_obj(main_grp, &tmp_parm);
 

 PARM(82,88,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = line_xpm;
 line_object = new_obj(main_grp, &tmp_parm);
 last_tool = line_object;

 PARM(124,88,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = put_pat_xpm;
 put_pat_object = new_obj(main_grp, &tmp_parm);

 PARM(82,123,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button); 
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = fill_xpm;
 fill_object = new_obj(main_grp, &tmp_parm);

 PARM(124,123,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = clear_to_color_xpm;
 clear_to_color_object = new_obj(main_grp, &tmp_parm);


 PARM(82,158,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button); 
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = pic_xpm;
 pic_object = new_obj(main_grp, &tmp_parm);

 PARM(124,158,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button); 
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = pic_pat_xpm;
 pic_pat_object = new_obj(main_grp, &tmp_parm);



 /* not tools */

#ifndef WINDOWS
 PARM(580,450,50,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"F/W";
 tmp_parm.callback = fw_bottom;
 new_obj(main_grp, &tmp_parm);
#endif

 
 PARM(580,1,50,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"Quit";
 tmp_parm.callback = really_quit;
 new_obj(main_grp, &tmp_parm);

 
 PARM(500,1,50,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"About";
 tmp_parm.callback = about;
 new_obj(main_grp, &tmp_parm);

 PARM(20,1, 50,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"Load";
 tmp_parm.user_flags = LOAD;
 tmp_parm.callback=load_save_top;
 new_obj(main_grp, &tmp_parm);

 load_grp = new_menu(20,5, load_menu, &globl_fg, &globl_bg);

 PARM(75,1, 50,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"Save";
 tmp_parm.user_flags = SAVE;
 tmp_parm.callback=load_save_top;
 new_obj(main_grp, &tmp_parm);

 save_grp = new_menu(75,5, save_menu, &globl_fg, &globl_bg);
 high_low_grp = new_menu(124,88, high_low_menu, &globl_fg, &sprite_color);
 hor_ver_grp = new_menu(124,88,horizontal_vertical_menu, &globl_fg, &sprite_color);
 pal_hi_low_grp = new_menu(124,88, pal_hi_low_menu, &globl_fg, &sprite_color);
 copy_move_grp = new_menu(124,88,copy_move_menu, &globl_fg, &sprite_color);

 PARM(380,1,90,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"Background";
 tmp_parm.callback = change_background;
 new_obj(main_grp, &tmp_parm);

 PARM(425,81,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = preview_zoom_change;
 tmp_parm.d1 = FALSE;
 tmp_parm	.d2 = 4;
 tmp_parm.dp1 = zoom_out_xpm;
 preview_zoom_out = new_obj(main_grp,&tmp_parm);

 PARM(461,81,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = preview_zoom_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 5;
 tmp_parm.dp1 = zoom_in_xpm;
 preview_zoom_in = new_obj(main_grp,&tmp_parm);

 PARM(499,83, 31,27, &globl_fg,&globl_bg,CALL_BUTTON,proc_button_box);
 tmp_parm.callback = change_bg_color;
 tmp_parm.dp1 = (char *)" ";
 bg_color_box = new_obj(main_grp, &tmp_parm);
 UPDATE_BG_COLOR;

 PARM(305,114,320,11,&globl_move_color, &globl_bg,SHOW_FOCUS|CALL_BUTTON,proc_scroll_bar);
 tmp_parm.d2 = 256;
 tmp_parm.d1 = 0;
 tmp_parm.callback = preview_scroll_change;
 preview_scroll_bar = new_obj(main_grp, &tmp_parm);

 PARM(292,126,11,240,&globl_move_color,&globl_bg,SHOW_FOCUS|CALL_BUTTON,proc_scroll_bar);
 tmp_parm.d2 = 0;
 tmp_parm.d1 = 0;
 preview_y_scroll = new_obj(main_grp,&tmp_parm);

 PARM(305,367,320,11,&globl_move_color,&globl_bg,SHOW_FOCUS|CALL_BUTTON,proc_scroll_bar);
 tmp_parm.d2 = 0;
 tmp_parm.d1 = 0;
 preview_x_scroll = new_obj(main_grp,&tmp_parm);


 tmp_parm.callback = preview_size_change;
 PARM(293,82,0,0,&globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON, proc_radio_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 1;
 tmp_parm.dp1 = (void *)"NTSC";
 preview_ntsc = new_obj(main_grp, &tmp_parm);

 PARM(293,96,0,0,&globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 1;
 tmp_parm.dp1 = (void *)"PAL";
 preview_pal = new_obj(main_grp, &tmp_parm);

 PARM(348,82,0,0,&globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON, proc_radio_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = (void *)"40 cell";
 preview_40c = new_obj(main_grp, &tmp_parm);

 PARM(348,96,0,0,&globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = (void *)"32 cell";
 preview_32c = new_obj(main_grp, &tmp_parm);




 PARM(190,297,11,176,&globl_move_color,&globl_bg,CALL_BUTTON|SHOW_FOCUS,proc_scroll_bar);
 tmp_parm.d2 = 0xf6;
 tmp_parm.d1 = 0;
 tmp_parm.callback = pattern_select_bot;
 pattern_select_scroll_bar = new_obj(main_grp, &tmp_parm);

 
 PARM(10,301,179,0xa*16,&globl_fg,&globl_bg,0,proc_pattern_select);
 pattern_select_object = new_obj(main_grp, &tmp_parm);

 PARM(10,22,70,260,&globl_fg,&globl_bg,0,proc_palette_change_object);
 palette_change_object = new_obj(main_grp, &tmp_parm);

 /* Pattern edit */
 PARM(88,200,67,83,&globl_fg,&globl_bg,0,proc_pattern_edit);
 pattern_edit_object = new_obj(main_grp, &tmp_parm);

 PARM(305,126,320,240,&globl_fg,&globl_bg,0,proc_preview_object);
 preview_object = new_obj(main_grp,&tmp_parm);

 PARM(540,88,65,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON,proc_button_box);
 tmp_parm.dp1 = (void *)"overlay";
 tmp_parm.callback = load_ovr_window;
 preview_overlay = new_obj(main_grp, &tmp_parm);


/* View and edit what? */

 tmp_parm.callback = edit_change;
 PARM(254,96,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY, proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 3;
 tmp_parm.user_flags = EDIT_SCROLL_A;
 tmp_parm.dp1 = scroll_a_edit_xpm;
 new_obj(main_grp, &tmp_parm);
 currently_editing = EDIT_SCROLL_A;

 PARM(254,120,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY, proc_icon_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 3;
 tmp_parm.user_flags = EDIT_SCROLL_B;
 tmp_parm.dp1 = scroll_b_edit_xpm;
 new_obj(main_grp, &tmp_parm);

 PARM(254,144,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY, proc_icon_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 3;
 tmp_parm.user_flags = EDIT_SPRITE;
 tmp_parm.dp1 = sprite_edit_xpm;
 new_obj(main_grp, &tmp_parm);


 tmp_parm.callback = edit_change;
 PARM(230,96,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY|SINGLE_RADIO, proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 4;
 tmp_parm.user_flags = VIEW_SCROLL_B;
 tmp_parm.dp1 = scroll_b_xpm;
 new_obj(main_grp, &tmp_parm);

 PARM(230,120,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY|SINGLE_RADIO, proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 4;
 tmp_parm.user_flags = VIEW_SCROLL_A;
 tmp_parm.dp1 = scroll_a_xpm;
 new_obj(main_grp, &tmp_parm);


 PARM(230,120+24,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY|SINGLE_RADIO, proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 4;
 tmp_parm.user_flags = VIEW_SCROLL_B_HIGH;
 tmp_parm.dp1 = scroll_b_high_xpm;
 new_obj(main_grp, &tmp_parm);

 PARM(230,120+24+24,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY|SINGLE_RADIO, proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 4;
 tmp_parm.user_flags = VIEW_SCROLL_A_HIGH;
 tmp_parm.dp1 = scroll_a_high_xpm;
 new_obj(main_grp, &tmp_parm);





 PARM(353,25,31,31, &hscroll_color, &globl_bg, 0, proc_scroll_size);
 new_obj(main_grp, &tmp_parm); 

 PARM(415,25,41,41, &globl_fg, &globl_bg, 0, proc_sprite_size);
 new_obj(main_grp, &tmp_parm); 

 PARM(369, 64,0,0,&globl_fg, &globl_bg, 0, proc_ctext);
 tmp_parm.dp1 = (void *)malloc( 8 );
 snprintf(tmp_parm.dp1, 8, "64x64");
 scroll_width = 1;
 scroll_height = 1;

 scroll_size2 =new_obj(main_grp, &tmp_parm);

 sprite_width = 0;
 sprite_height = 0;

 PARM(410, 393,41,51, &globl_fg, &globl_bg, CALL_BUTTON|MODULAR|HEX|INACTIVE, proc_knob);
 tmp_parm.d1 = 40;
 tmp_parm.d2 = 0x400;
 tmp_parm.user_flags = KNOB;
 tmp_parm.callback = knob_tick;
 knob = new_obj(main_grp, &tmp_parm);


 PARM(244,410, 23,24,&globl_fg, &globl_bg,
   LOAD_XPM_FROM_ARRAY|SHOW_FOCUS|CALL_BUTTON|SINGLE_RADIO,proc_icon_button);
 tmp_parm.dp1 = small_knob_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 200;
 tmp_parm.callback = knob_select;
 knob_icon = new_obj(main_grp,&tmp_parm);

 PARM(315, 422, 0,0, &globl_fg, &globl_bg, 0, proc_ctext);
 tmp_parm.dp1 = (void *)malloc(64);
 snprintf( tmp_parm.dp1, 64, ":<");
 knob_text = new_obj(main_grp,&tmp_parm);


 PARM(272, 256, 11, 82, &globl_fg, &globl_bg, 0, proc_scroll_bar_special)
 tmp_parm.d1 = 2;
 tmp_parm.d2 = 2;
 tmp_parm.user_flags = HORIZONTAL;
 horizontal_scroll_bar = new_obj(main_grp, &tmp_parm);

 PARM(493,385, 82,11, &globl_fg, &globl_bg, 0, proc_scroll_bar_special);
 tmp_parm.d1 = 0;
 tmp_parm.d2 = 1;
 tmp_parm.user_flags = VERTICAL;
 vertical_scroll_bar = new_obj(main_grp, &tmp_parm);

 PARM(462, 401, 0,0, &globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 5;
 tmp_parm.dp1 = (void *)scroll_a_edit_xpm;
 tmp_parm.callback = knob_tick;
 tmp_parm.user_flags = SELECT_A;
 select_a_object = new_obj(main_grp, &tmp_parm);

 PARM(462, 423, 0,0, &globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 5;
 tmp_parm.dp1 = (void *)scroll_b_edit_xpm;
 tmp_parm.callback = knob_tick;
 tmp_parm.user_flags = SELECT_B;
 new_obj(main_grp, &tmp_parm);

 tmp_parm.proc = load_default_mega;
 select_b_object = new_obj(main_grp, &tmp_parm);

 PARM(172, 177, 0,0, &globl_fg, &globl_bg, SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
// tmp_parm.callback = stop_bot;
 tmp_parm.dp1 = (void *)clob_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 clob_object = new_obj(main_grp, &tmp_parm);

 PARM(172, 202, 0,0, &globl_fg, &globl_bg, CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
 tmp_parm.callback = stop_bot;
 tmp_parm.dp1 = (void *)stop_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 stop_object = new_obj(main_grp, &tmp_parm);

 PARM(172, 227, 0,0, &globl_fg, &globl_bg, CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
 tmp_parm.callback = go_bot;
 tmp_parm.dp1 = (void *)clear_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 new_obj(main_grp, &tmp_parm);

 PARM(172, 252, 0,0, &globl_fg, &globl_bg, CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
 tmp_parm.callback = new_bot;
 tmp_parm.dp1 = (void *)new_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 new_obj(main_grp, &tmp_parm);

 PARM(490, 400, 140, 45, &globl_fg, &globl_bg, DROP_SHADOW, proc_info);
 info_object = new_obj(main_grp, &tmp_parm);

/* SHADOW BOX */

 PARM(170, 175, 25, 100, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(460, 400, 25, 45, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);


 PARM(270, 254, 14, 86, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(491,383, 86, 14, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(240, 407, 150, 30, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 knob_message_box = new_obj(main_grp, &tmp_parm);

 PARM(405, 400, 50, 45, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(340, 21, 58, 50, &globl_fg,&globl_bg, DROP_SHADOW, proc_shadow_box);
 scroll_size1 = new_obj(main_grp, &tmp_parm);

 PARM(340+67, 21, 58, 50, &globl_fg,&globl_bg, DROP_SHADOW, proc_shadow_box);
 sprite_size1 = new_obj(main_grp, &tmp_parm);


 PARM(340+67+67+((58/4)-6), 20+((50/4)-6)-1, 20, 20, &globl_fg, &globl_bg, 
   CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = sprite_overlay;
 tmp_parm.dp1 = (void *)minus_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 minus_object = new_obj(main_grp, &tmp_parm);

 PARM(340+67+67+((58/4)-6), 20+((50/2)+2)-1, 20, 20, &globl_fg, &globl_bg, 
   CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.dp1 = (void *)plus_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 plus_object =  new_obj(main_grp, &tmp_parm);


 PARM(340+67+67+((58/4)+15), 20+((50/4)-6)-1, 20, 20, &globl_fg, &globl_bg, 
   CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.dp1 = (void *)a_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 a_object = new_obj(main_grp, &tmp_parm);

 PARM(340+67+67+((58/4)+15), 20+((50/2)+2)-1, 20, 20, &globl_fg, &globl_bg, 
   CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.dp1 = (void *)b_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 b_object = new_obj(main_grp, &tmp_parm);





 PARM(340+67+67,21,58,50, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp,&tmp_parm);
 
 
 PARM(228, 94, 50, 148-24-24, &globl_fg,&globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(8,19,152,266,&globl_fg,&globl_bg,DROP_SHADOW,proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(8,295,198,179,&globl_fg,&globl_bg,DROP_SHADOW,proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 

 PARM(288,80,340,300,&globl_fg,&globl_bg,DROP_SHADOW,proc_shadow_box);
 preview_box_object =  new_obj(main_grp, &tmp_parm);

 red.r = 0x7f;
 red.g = 0;
 red.b = 0;

 green.r = 0;
 green.g = 0x7f;
 green.b = 0;
  
 blue.r = 0;
 blue.g = 0;
 blue.b = 0x7f;

 PARM(168,22,100,11,&red,&globl_bg,SHOW_FOCUS|CALL_BUTTON,proc_scroll_bar);
 tmp_parm.d2 = 7;
 tmp_parm.d1 = 
  current_vdp->palette[current_palette][current_palette_index].r / (0xff/7);
 tmp_parm.callback = color_change_bot;
 rgb_red_object = new_obj(main_grp, &tmp_parm);

 tmp_parm.d1 = 
  current_vdp->palette[current_palette][current_palette_index].g / (0xff/7);
 tmp_parm.y+=18;
 tmp_parm.fg = &green;
 rgb_green_object = new_obj(main_grp, &tmp_parm);


 tmp_parm.d1 = 
  current_vdp->palette[current_palette][current_palette_index].b / (0xff/7);
 tmp_parm.y+=18;
 tmp_parm.fg = &blue;
 rgb_blue_object = new_obj(main_grp, &tmp_parm);

 PARM(301,38,24,8,&current_color_text_color,&globl_bg,0,proc_ctext);
 tmp_parm.dp1 = (void *)malloc(4);
 current_color_text_object = new_obj(main_grp,&tmp_parm);

 PARM(301,52,24,8, &current_color_text_color, &globl_bg, 0,proc_ctext);
 tmp_parm.dp1 = (void *)malloc(4);
 current_color_text2_object = new_obj(main_grp, &tmp_parm);
  
 update_color_text();

 PARM(276,30,50,30,&globl_fg,&current_vdp->palette[0][0],0,proc_shadow_box);
 current_color_object = new_obj(main_grp, &tmp_parm);

 PARM(165,19,170,55,&globl_fg,&globl_bg,DROP_SHADOW,proc_shadow_box);
 rgb_box_object = new_obj(main_grp, &tmp_parm);



 overlay_sel = setup_overlay_window(400,300, LOAD, "an image", load_ovr_callback);
 background_sel = setup_overlay_window(400,300, LOAD, "an image", load_background_callback);


 pointers = new_group(200, 300, 151,151,globl_flags,globl_drop_depth);
 simple_window(pointers, 150, 150);

 PARM( 25, 100, 100, 30, &globl_fg, &globl_bg, QUIT_BUTTON|SHOW_FOCUS, proc_button_box);
 tmp_parm.dp1 = (char *)"OK";
 new_obj(pointers, &tmp_parm);

 PARM(30, 20, 0,0, &hscroll_color, &globl_bg, SHOW_FOCUS|SINGLE_RADIO, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 50;
 tmp_parm.dp1 = (char *)"hscroll";
 hscroll_radio = new_obj(pointers, &tmp_parm);

 PARM(30, 31, 0,0, &sprite_color, &globl_bg, SHOW_FOCUS|SINGLE_RADIO, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 50;
 tmp_parm.dp1 = (char *)"sprite";
 sprite_radio = new_obj(pointers, &tmp_parm);

 PARM(30, 42, 0,0, &scroll_a_color, &globl_bg, SHOW_FOCUS|SINGLE_RADIO, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 50;
 tmp_parm.dp1 = (char *)"scroll_a";
 scroll_a_radio = new_obj(pointers, &tmp_parm);

 PARM(30, 53, 0,0, &scroll_b_color, &globl_bg, SHOW_FOCUS|SINGLE_RADIO, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 50;
 tmp_parm.dp1 = (char *)"scroll_b";
 scroll_b_radio = new_obj(pointers, &tmp_parm);

 PARM(30, 64, 0,0, &window_color, &globl_bg, SHOW_FOCUS|SINGLE_RADIO, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 50;
 tmp_parm.dp1 = (char *)"window";
 window_radio = new_obj(pointers, &tmp_parm);

 load_sel = setup_overlay_window(400,300, LOAD, "123456", load_save_bottom);
 save_sel = setup_overlay_window(400,300, SAVE, "123456", load_save_bottom);
}