Exemple #1
0
static struct wizard* create_wizard(void)
{
    struct wizard* wizard = calloc(1, sizeof(*wizard));
    if (wizard == NULL) goto error;

    wizard->sprite = create_sprite(create_image("res/wizard.png"), 32, 32);
    if (wizard->sprite == NULL) goto error;

    wizard->walk_right = create_animation();
    if (wizard->walk_right == NULL) goto error;
        add_frame(wizard->walk_right, 4, 200, &PREP_SPEED);
        add_frame(wizard->walk_right, 0, 200, &NORMAL_SPEED); /* <------+ */
        add_frame(wizard->walk_right, 1, 200, &NORMAL_SPEED); /*        | */
        add_frame(wizard->walk_right, 2, 200, &NORMAL_SPEED); /*        | */
        add_frame(wizard->walk_right, 3, 200, &NORMAL_SPEED); /* <--+   | */
        add_frame(wizard->walk_right, 4, 200, &BRAKE_SPEED);  /*    |   | */
    wizard->walk_right->loop_from = 1; /* --------------------------|---+ */
    wizard->walk_right->loop_to = 4;   /* --------------------------+     */

    wizard->walk_left = create_animation();
    if (wizard->walk_left == NULL) goto error;
        add_frame(wizard->walk_left, 15, 200, &PREP_SPEED_L);
        add_frame(wizard->walk_left, 11, 200, &NORMAL_SPEED_L); /* <------+ */
        add_frame(wizard->walk_left, 10, 200, &NORMAL_SPEED_L); /*        | */
        add_frame(wizard->walk_left, 9, 200, &NORMAL_SPEED_L);  /*        | */
        add_frame(wizard->walk_left, 8, 200, &NORMAL_SPEED_L);  /* <--+   | */
        add_frame(wizard->walk_left, 15, 200, &BRAKE_SPEED_L);  /*    |   | */
    wizard->walk_left->loop_from = 1; /* -----------------------------|---+ */
    wizard->walk_left->loop_to = 4;   /* -----------------------------+     */

    wizard->stand = create_animation();
    if (wizard->stand == NULL) goto error;
        add_frame(wizard->stand, 5, 100, &NO_SPEED); /* <---+ */
    wizard->stand->mode = FREEZE_LAST_FRAME; /* ------------+ */

    wizard->spell = create_animation();
    if (wizard->spell == NULL) goto error;
        add_frame(wizard->spell, 5, 200, &NO_SPEED);
        add_frame(wizard->spell, 6, 200, &NO_SPEED);
        add_frame(wizard->spell, 7, 100, &NO_SPEED); /* <--+ */
        add_frame(wizard->spell, 6, 200, &NO_SPEED); /*    | */
    wizard->spell->loop_from = 2; /* ----------------------+ */
    wizard->spell->loop_to = 2;   /* ----------------------+ */

    play_animation(wizard->sprite, wizard->stand);

    wizard->pos.x = 0;
    wizard->pos.y = BASE_Y;

    return wizard;

error:
    destroy_wizard(wizard);
    ERROR("Unable to create wizard");
    return NULL;
}
Exemple #2
0
/* We create a sprite for the title and an animation
 * with 6 frames.
 * We also create a mask image for a spot and fade-in
 * effect.
 */
static int prepare_title(struct game_title* title)
{
    int f;
    title->sprite = create_sprite(create_image("res/title.png"), 70, 15);
    if (title->sprite == NULL) goto error;
    title->bling = create_animation();
    if (title->bling == NULL) goto error;
    add_frame(title->bling, 0, SECOND / 2, NULL);
    for (f = 5; f >= 0; f--)
        add_frame(title->bling, f, SECOND / 10, NULL);
    title->bling->mode = FREEZE_LAST_FRAME;

    title->mask = create_target_image(192, 108, color_from_RGB(50, 50, 50));
    if (title->mask == NULL) goto error;
    set_blend_mode(title->mask, MULTIPLY);
    title->spot = create_image("res/spot.png");
    if (title->spot == NULL) goto error;
    set_blend_mode(title->spot, ADD);

    return 0;

error:
    ERROR("Unable to prepare title");
    cleanup_title(title);
    return -1;
}
//
// Return a loaded animation and if not the manager tries to load one
std::shared_ptr<Animation> AnimationManager::get_animation(std::string link)
{
   std::map<std::string, std::shared_ptr<Animation> >::const_iterator it = m_animations.find(link);
   if(it != m_animations.end())
        return it->second;
   else
        return create_animation(link);
}
Exemple #4
0
void
dialog_about (WBCGtk *wbcg)
{
	GtkWidget *w, *c;
	GList *children;
	AboutState *state;

	if (gnumeric_dialog_raise_if_exists (wbcg, ABOUT_KEY))
		return;

	state = g_new0 (AboutState, 1);

	w = g_object_new (GTK_TYPE_ABOUT_DIALOG,
			  "title", _("About Gnumeric"),
			  "version", GNM_VERSION_FULL,
			  "website", "http://www.gnumeric.org/",
			  "website-label", _("Visit the Gnumeric website"),
			  "logo-icon-name", "gnumeric",
			  "copyright", _("Copyright \xc2\xa9 1998-2014"),
			  "comments", _("Free, Fast, Accurate - Pick Any Three!"),
			  NULL);
	state->dialog = w;

	g_signal_connect (w, "response",
			  G_CALLBACK (gtk_widget_destroy), NULL);
	g_signal_connect_swapped (w, "destroy",
				  G_CALLBACK (free_state), state);

	c = gtk_dialog_get_content_area (GTK_DIALOG (w));
	children = gtk_container_get_children (GTK_CONTAINER (c));

	if (children && GTK_IS_BOX (children->data)) {
		GtkWidget *vbox = children->data;
		int height;
		PangoLayout *layout;

		state->anim_area = gtk_drawing_area_new ();
		layout = gtk_widget_create_pango_layout (state->anim_area, NULL);
		pango_layout_get_pixel_size (layout, NULL, &height);
		gtk_widget_set_size_request (state->anim_area, -1, 4 * height);
		g_object_unref (layout);

		g_signal_connect (state->anim_area, "draw",
				  G_CALLBACK (about_dialog_anim_draw),
				  state);

		gtk_box_pack_end (GTK_BOX (vbox), state->anim_area, TRUE, TRUE, 0);

		create_animation (state);

		state->timer = g_timeout_add (TIME_SLICE, about_dialog_timer, state);
	}
	g_list_free (children);

	gnumeric_keyed_dialog (wbcg, GTK_WINDOW (w), ABOUT_KEY);
	gtk_widget_show_all (w);
}
Exemple #5
0
void kill_window(Window* window) {
	printk("kill_window called on %x\n", window);
	//fade out window
	float to = 0.0;
	ca_animation* fade_out = create_animation(ALPHA_ANIM, &to, 0.25);
	printk("fade out animation: %x\n", fade_out);
	//when animation finishes, perform real teardown
	fade_out->finished_handler = (event_handler)kill_window_real;
	add_animation(window, fade_out);
}
Exemple #6
0
void present_window(Window* window) {
	float old_alpha = window->layer->alpha;
	window->layer->alpha = 0.0;

	Screen* current = gfx_screen();
	add_subwindow(current->window, window);

	float to = old_alpha;
	ca_animation* fade_in = create_animation(ALPHA_ANIM, &to, 0.25);
	add_animation(window, fade_in);
}
PickupObject::PickupObject(Pickup c_type, Textures::Type t_type, TextureGenerator &t)
: StaticObject(t.get(t_type))
, type(c_type)
, points(0)
{
	sf::FloatRect local_rect = Entity::sprite.getLocalBounds();
	Entity::sprite.setOrigin(6.f, 6.f);

	animated[Pickup::SmallDot] = false;
	animated[Pickup::BigDot] = true;

	create_animation();
}
Exemple #8
0
void play_boom(char *msg)
{
  static Animation *boom = NULL;
  if (boom == NULL)
    boom = create_animation("boom.txt");

  char *subtitle = (char *) malloc((sizeof(char)) * (strlen(msg) + strlen(" (Press any key)")) + 1 );
  KINDLY_DIE_IF_NULL(subtitle);
  strcpy(subtitle, msg);
  strcat(subtitle, " (Press any key)");
  play_animation(boom, subtitle, true, true);
  free(subtitle);
}
Exemple #9
0
static int prepare_tree(struct tree* tree)
{
    tree->sprite = create_sprite(create_image("res/tree.png"), 32, 32);
    if (tree->sprite == NULL) goto cleanup_sprite;
    tree->windblow = create_animation();
    if (tree->windblow == NULL) goto cleanup_animation;
    add_frame(tree->windblow, 0, 1 * SECOND, NULL);
    add_frame(tree->windblow, 1, 1 * SECOND, NULL);
    tree->windblow->loop_from = 0;
    tree->windblow->loop_to = 1;
    return 0;

cleanup_animation:
    destroy_animation(tree->windblow);
cleanup_sprite:
    destroy_sprite(tree->sprite);
error:
    ERROR("Unable to prepare tree");
    return -1;
}
/*
 * load_animation_data
 *
 * This function creates and loads up the different animations that are to be
 * used in the game.
 *
 * @@@DAT - currently this uses hard coded strings for the animation files.
 *          There is potential that we can change this in the future and pass
 *          some data in.
 *
 * Parameters: animation_handler - This must have been created previously and
 *                                 if the function is succesful it will be
 *                                 returned with an array of animation objects
 *                                 that describe all possible animations.
 *
 * Returns: One of LOAD_ANIMATION_DATA_RET_CODES.
 */
int load_animation_data(ANIMATION_HANDLER *animation_handler)
{
  /*
   * Local Variables.
   */
  int ret_code = LOAD_ANIMATION_DATA_OK;
  int rc;
  char *filename;
  int frame_width;
  int frame_height;
  ANIMATION_CHOICE curr_animation;

  /*
   * Go through all the different animation values in the enumeration of
   * animation choices. For each, load the appropriate animation object and put
   * it into the array.
   */
  for (curr_animation = 0;
       curr_animation < num_animations;
       curr_animation++)
  {
    /*
     * The filename is hardcoded based on which animation we are loading. It is
     * a coding error for their to be no corresponding animation file but we
     * still pass control back to the caller in case they want to handle it.
     */
    switch (curr_animation)
    {
      case running_animation:
        filename = "resources/animations/player_running_sheet.png";
        frame_width = 16;
        frame_height = 16;
        break;
      case standing_animation:
        filename = "resources/animations/player_standing_sheet.png";
        frame_width = 10;
        frame_height = 10;
        break;
      case jumping_animation:
        filename = "resources/animations/player_jumping_sheet.png";
        frame_width = 10;
        frame_height = 10;
        break;
      default:
        DT_DEBUG_LOG("Attempting to load animation for %i. No file specified\n",
                     curr_animation);
        ret_code = LOAD_ANIMATION_DATA_INVALID_ANIMATION;
        goto EXIT_LABEL;
    }

    /*
     * This function creates the animation object, loads the sprite sheet as an
     * image and puts it into memory.
     *
     * It can fail if the file did not exist or if SDL/opengl failed to convert
     * the image for use.
     */
    rc = create_animation(filename,
                          frame_width,
                          frame_height,
                          &(animation_handler->animations[curr_animation]));
    if (ANIMATION_CREATE_OK != rc)
    {
      DT_DEBUG_LOG("Failed to create an animation object. Err code: %i\n", rc);
      ret_code = LOAD_ANIMATION_DATE_CREATE_FAIL;
      goto EXIT_LABEL;
    }
  }

EXIT_LABEL:

  return(ret_code);
}
Exemple #11
0
void
dialog_about (WBCGtk *wbcg)
{
	GtkWidget *w, *c;
	GList *children;
	AboutState *state;
	GPtrArray *authors;
	GPtrArray *documenters;
	GPtrArray *artists;
	unsigned ui;

	if (gnm_dialog_raise_if_exists (wbcg, ABOUT_KEY))
		return;

	state = g_new0 (AboutState, 1);

	authors = g_ptr_array_new_with_free_func (g_free);
	documenters = g_ptr_array_new_with_free_func (g_free);
	artists = g_ptr_array_new_with_free_func (g_free);
	for (ui = 0; ui < G_N_ELEMENTS (contributors); ui++) {
		const char *name = contributors[ui].name;
		const char *details = contributors[ui].details;
		unsigned flags = contributors[ui].contributions;
		if (flags & GNM_ART) {
			g_ptr_array_add (artists, g_strdup (name));
		}
		if (flags & GNM_DOCUMENTATION) {
			g_ptr_array_add (documenters, g_strdup (name));
		}
		if (flags & ~(GNM_ART | GNM_DOCUMENTATION)) {
			char *text = details
				? g_strdup_printf ("%s (%s)", name, details)
				: g_strdup (name);
			g_ptr_array_add (authors, text);
		}
	}
	g_ptr_array_add (authors, NULL);
	g_ptr_array_add (documenters, NULL);
	g_ptr_array_add (artists, NULL);
	w = g_object_new (GTK_TYPE_ABOUT_DIALOG,
			  "title", _("About Gnumeric"),
			  "version", GNM_VERSION_FULL,
			  "website", PACKAGE_URL,
			  "website-label", _("Visit the Gnumeric website"),
			  "logo-icon-name", "gnumeric",
			  "copyright", _("Copyright \xc2\xa9 1998-2018"),
			  "comments", _("Free, Fast, Accurate - Pick Any Three!"),
			  "license", _(LICENSE_TEXT),
			  "wrap-license", TRUE,
			  "authors", authors->pdata,
			  "documenters", documenters->pdata,
			  "artists", artists->pdata,
			  NULL);
	g_ptr_array_free (authors, TRUE);
	g_ptr_array_free (documenters, TRUE);
	g_ptr_array_free (artists, TRUE);
	state->dialog = w;

	g_signal_connect (w, "response",
			  G_CALLBACK (gtk_widget_destroy), NULL);
	g_signal_connect_swapped (w, "destroy",
				  G_CALLBACK (free_state), state);

	c = gtk_dialog_get_content_area (GTK_DIALOG (w));
	children = gtk_container_get_children (GTK_CONTAINER (c));

	if (children && GTK_IS_BOX (children->data)) {
		GtkWidget *vbox = children->data;
		int width, height;
		PangoLayout *layout;

		state->anim_area = gtk_drawing_area_new ();
		layout = gtk_widget_create_pango_layout (state->anim_area, "x");
		pango_layout_get_pixel_size (layout, &width, &height);
		gtk_widget_set_size_request (state->anim_area,
					     40 * width, 8 * height);
		g_object_unref (layout);

		g_signal_connect (state->anim_area, "draw",
				  G_CALLBACK (about_dialog_anim_draw),
				  state);

		gtk_box_pack_end (GTK_BOX (vbox), state->anim_area, TRUE, TRUE, 0);

		create_animation (state);

		state->timer = g_timeout_add (TIME_SLICE, about_dialog_timer, state);
	}
	g_list_free (children);

	gnm_keyed_dialog (wbcg, GTK_WINDOW (w), ABOUT_KEY);
	gtk_widget_show_all (w);
}
Exemple #12
0
void title_screen()
{
  char *picture[] = {
    "                                     # #  ( )",
    "                                  ___#_#___|__",
    "                              _  |____________|  _",
    "                       _=====| | |            | | |==== _",
    "                 =====| |.---------------------------. | |====",
    "   <--------------------'   .  .  .  .  .  .  .  .   '--------------/",
    "     \\                                                             /",
    "      \\_______________________________________________WWS_________/",
    "  wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww",
    "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww",
    "   wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww",
    NULL
  };

  print_picture(stdscr, picture);

  /* int numsquiggles = 8; */
  /* int numreps = 2; */
  /* int framespeed = 60000; */
  /* do a little "animation" */
  /* for (int i=0; i<numreps; ++i) { */
  /*   /\* pushing out *\/ */
  /*   for (int j=0; j<numsquiggles; ++j) { */
  /*     char msg[100]; */
  /*     int s=0; */
  /*     for (int k=0; k<j+1; ++k) { */
  /*    msg[s++] = '~'; */
  /*     } */
  /*     msg[s++]=' '; */
  /*     msg[s++]='t'; */
  /*     msg[s++]='e'; */
  /*     msg[s++]='r'; */
  /*     msg[s++]='m'; */
  /*     msg[s++]='s'; */
  /*     msg[s++]='h'; */
  /*     msg[s++]='i'; */
  /*     msg[s++]='p'; */
  /*     msg[s++]=' '; */
  /*     for (int k=0; k<j+1; ++k) { */
  /*    msg[s++] = '~'; */
  /*     } */
  /*     msg[s++] = '\0'; */
  /*     show_message_box(msg); */
  /*     usleep(framespeed); */
  /*   } */
  /*   /\* pulling in *\/ */
  /*   for (int j=numsquiggles; j>0; --j) { */
  /*     char msg[100]; */
  /*     int s=0; */
  /*     for (int k=0; k<j+1; ++k) { */
  /*    msg[s++] = '~'; */
  /*     } */
  /*     msg[s++]=' '; */
  /*     msg[s++]='t'; */
  /*     msg[s++]='e'; */
  /*     msg[s++]='r'; */
  /*     msg[s++]='m'; */
  /*     msg[s++]='s'; */
  /*     msg[s++]='h'; */
  /*     msg[s++]='i'; */
  /*     msg[s++]='p'; */
  /*     msg[s++]=' '; */
  /*     for (int k=0; k<j+1; ++k) { */
  /*    msg[s++] = '~'; */
  /*     } */
  /*     msg[s++] = '\0'; */
  /*     show_message_box(msg); */
  /*     usleep(framespeed); */
  /*   } */
  /* } */



  /* Test an animation: */
  /* Animation *anim1 = create_animation("test1.txt"); */
  /* play_animation(anim1, true); */
  /* Animation *underwater_explosion = create_animation("underwater_explosion.txt"); */
  /* play_animation(underwater_explosion, true); */
  /* destroy_animation(underwater_explosion); */
  Animation *montage = create_animation("opener.txt");
  play_animation(montage, "Welcome to termship! (Press any key)", true, true);
  destroy_animation(montage);

}
Exemple #13
0
//Create a CGLWin widget
CGLWin::CGLWin(void):
	QMainWindow( 0, "View3D", WDestructiveClose), 
	m_pListViews(NULL)
{
	int i;

	// Data members;
	CGLDrawParms tDraw;
	_drawParms = tDraw;

	m_nTimeDelay = 0;

	for (i=0; i<VIEW3D_MAX_OBJ_COUNT; i++) _pCia3dObjs[i] = NULL;

	// setup printer
	m_pPrinter = new QPrinter;

	// GUI members, create a toolbar;
	m_pToolBar = _createToolBar();		

    // populate a menu with all actions
	m_pMenuBar = menuBar();
	assert(m_pMenuBar!=NULL);

	//====================File options ==========================
	{
		QPopupMenu * file = new QPopupMenu( this );
		menuBar()->insertItem( "&File  ", file );
		_fileNewAction->addTo( file );
		_fileOpenAction->addTo( file );
		_fileSaveAction->addTo( file );
		file->insertSeparator();
		file->insertItem( "Open Background", this,  SLOT(openBackgroundImage()), NULL);
		file->insertItem( "Load Camera", this,  SLOT(loadCamera()), NULL);
		file->insertItem( "Save Camera", this,  SLOT(saveCamera()), NULL);
		file->insertSeparator();	//===========================
		file->insertItem( "Export Povray", this,  SLOT(exportPovray()), NULL);
		file->insertItem( "Export STL", this,  SLOT(saveSTLFile()), NULL);
		file->insertItem( "Export TXT", this,  SLOT(saveTXTFile()), NULL);
		file->insertItem( "Export EPS", this,  SLOT(exportEps()), NULL);
	    file->insertSeparator();	//===========================
		_filePrintAction->addTo( file );
	    file->insertSeparator();	//===========================
		file->insertItem( "E&xit", qApp,  SLOT(closeAllWindows()), NULL);
	}


	//================ Tools Options ================================
	{
		QPopupMenu * pMenuTools = new QPopupMenu( this );
		menuBar()->insertItem( "&Tools", pMenuTools );
		pMenuTools->insertItem( "Show Entire Scene", this,  SLOT(show_entirescene()));
		pMenuTools->insertItem( "Dupe Current Object", this,  SLOT(dupe_currentobj()));
		pMenuTools->insertItem( "Dupe Current Object N", this,  SLOT(dupe_currentobjN()));

		{// Animation options
			pMenuTools->insertSeparator();	//=======================
			QPopupMenu * pAnimOption = new QPopupMenu( this );
			pMenuTools->insertItem( "&Prepare Animation", pAnimOption);
			pAnimOption->insertItem( "Setup", this,  SLOT(create_animation()));

		    QAction* startAction = new QAction(QPixmap(play_xpm), "&Start Animation", Qt::Key_F10, this);
			connect(startAction, SIGNAL(activated()), this, SLOT(startAnimation()));
		    startAction->addTo( pAnimOption );

			pAnimOption->insertItem( "Stop Animation", this,  SLOT(stopAnimation()), Qt::Key_F11);
			pAnimOption->insertItem( "Change Delay Time", this,  SLOT(editDelayTime()));

			{//toggle fast draw mode
				m_pActRepeatPlay = new QAction("Repeat", CTRL+Key_T, this);
				connect(m_pActRepeatPlay, SIGNAL(activated()), this, SLOT(toggleRepeatPlay()));
				m_pActRepeatPlay->setToggleAction(true);
				m_pActRepeatPlay->setOn(false);
				m_pActRepeatPlay->addTo( pAnimOption );
			}
		}
		pMenuTools->insertSeparator();	//=======================
		{// Stereo options
			QPopupMenu * pStereoOption = new QPopupMenu( this );
			pMenuTools->insertItem( "&Stereo", pStereoOption);

			QAction* m_pActToggleStereo = new QAction("Stereo Mode", Qt::Key_F12, this);
			connect(m_pActToggleStereo, SIGNAL(activated()), this, SLOT(toggleStereo()));
			m_pActToggleStereo->setToggleAction(true);
			m_pActToggleStereo->setOn(false);
			m_pActToggleStereo->addTo( pStereoOption );

			pStereoOption->insertItem( "Increase Eye Distance", this,  SLOT(incEyeDistance()), Qt::Key_Plus);
			pStereoOption->insertItem( "Decrease Eye Distance", this,  SLOT(decEyeDistance()), Qt::Key_Minus);
		}

		//pMenuTools->insertItem( "Rotation Axis", this,  SLOT(InputRotationAxis()), NULL);
		//pMenuTools->insertItem( "Mirror Plane", this,  SLOT(InputMirrorPlane()), NULL);
		//pMenuTools->insertSeparator();
		//pMenuTools->insertItem( "Vector Hidden Line Removal", this,  SLOT(hidden_line()), CTRL+Key_H);
		//pMenuTools->insertSeparator();	//=======================

		pMenuTools->insertSeparator();	//=======================
		pMenuTools->insertItem( "Set Mirror Plane", this,  SLOT(InputMirrorPlane()));
		pMenuTools->insertItem( "Set Rotation Axis", this,  SLOT(InputRotationAxis()));
	}

	//================ Rendering options ================================
	{
		QPopupMenu * pMenuOption = new QPopupMenu( this );
		menuBar()->insertItem( "&Options", pMenuOption );
		pMenuOption->insertItem( "Global Setting", this,  SLOT(OptionGlobalSetting()));
		pMenuOption->insertItem( "Surface Rendering", this,  SLOT(OptionRendering()));
		pMenuOption->insertItem( "Volume Rendering", this,  SLOT(OptionVolumeRendering()));
		pMenuOption->insertSeparator();	//=======================
		{
			QPopupMenu * pPickOption = new QPopupMenu( this );
			pMenuOption->insertItem( "&Picking Types", pPickOption);
			pPickOption->insertItem( "Pick an Object", this,  SLOT(set_obj_picking()));
			pPickOption->insertItem( "Pick a Polygon", this,  SLOT(set_face_picking()));
			pPickOption->insertItem( "Pick a Line", this,  SLOT(set_line_picking()));
		}

		QAction* act_mirroring = new QAction("Mirroring", 0, this);
		connect( act_mirroring, SIGNAL(activated()), this, SLOT(OptionMirroring()));
		act_mirroring->setToggleAction(true);
		act_mirroring->setOn(false);
		act_mirroring->addTo( pMenuOption );
		m_pMirroringAction = act_mirroring;

		QPopupMenu * pRotOption = new QPopupMenu( this );
		pMenuOption->insertItem( "&Rotation Types", pRotOption);
		QAction* act_rot0obj = new QAction("Rotate 90 Degree", 0, this);
		connect( act_rot0obj, SIGNAL(activated()), this, SLOT(OptionRotate90()));
		act_rot0obj->addTo( pRotOption );
		QAction* act_rot1obj = new QAction("Rotate 180 Degree", 0, this);
		connect( act_rot1obj, SIGNAL(activated()), this, SLOT(OptionRotate180()));
		act_rot1obj->addTo( pRotOption );
		QAction* act_rot2obj = new QAction("Rotate 270 Degree", 0, this);
		connect( act_rot2obj, SIGNAL(activated()), this, SLOT(OptionRotate270()));
		act_rot2obj->addTo( pRotOption );
		m_pRot90Action = act_rot0obj;
		m_pRot180Action = act_rot1obj;
		m_pRot270Action = act_rot2obj;
		m_pRot90Action->setToggleAction(true);
		m_pRot90Action->setOn(false);
		m_pRot180Action->setToggleAction(true);
		m_pRot180Action->setOn(false);
		m_pRot270Action->setToggleAction(true);
		m_pRot270Action->setOn(false);

		//show background image buttion
		QAction* act_showbgimg = new QAction("Background Image", 0, this);
		connect( act_showbgimg, SIGNAL(activated()), this, SLOT(ShowBackgroundImage()));
		act_showbgimg->setToggleAction(true);
		act_showbgimg->setOn(false);
		act_showbgimg->addTo( pMenuOption );
		m_pBGImageAction = act_showbgimg;

		//show floor plane buttion
		QAction* act_showfloor = new QAction(QString::fromLocal8Bit("Floor Plane"), 0, this);
		connect( act_showfloor, SIGNAL(activated()), this, SLOT(ShowFloor()));
		act_showfloor->setToggleAction(true);
		act_showfloor->setOn(false);
		act_showfloor->addTo( pMenuOption );
		m_pFloorAction = act_showfloor;

		{//Toggle fast draw mode
			m_pActFastDraw = new QAction("Fast Drawing", 0, this);
			connect(m_pActFastDraw, SIGNAL(activated()), this, SLOT(toggleFastDraw()));
			m_pActFastDraw->setToggleAction(true);
			m_pActFastDraw->setOn(false);
			m_pActFastDraw->addTo( pMenuOption );
		}

	}


	//========change opengl window size ==========================
	{
		QPopupMenu * pMenuGLWinsize = new QPopupMenu( this );
		menuBar()->insertItem( "&Window", pMenuGLWinsize );
		pMenuGLWinsize->insertItem( "320x200", this,  SLOT(setGLWinSize320x200()), CTRL+Qt::Key_3);
		pMenuGLWinsize->insertItem( "400x400", this,  SLOT(setGLWinSize400x400()), CTRL+Qt::Key_4);
		pMenuGLWinsize->insertItem( "500x400", this,  SLOT(setGLWinSize500x400()), CTRL+Qt::Key_5);
		pMenuGLWinsize->insertItem( "500x500", this,  SLOT(setGLWinSize500x500()), CTRL+Qt::Key_2 );
		pMenuGLWinsize->insertItem( "640x480", this,  SLOT(setGLWinSize640x480()), CTRL+Qt::Key_6);
		pMenuGLWinsize->insertItem( "800x600", this,  SLOT(setGLWinSize800x600()), CTRL+Qt::Key_8);
		pMenuGLWinsize->insertItem( "1024x768", this,  SLOT(setGLWinSize1024x768()), CTRL+Qt::Key_1);
		pMenuGLWinsize->insertSeparator();
		pMenuGLWinsize->insertItem( "Swap Width/Height", this,  SLOT(swapWidthHeight()), CTRL+Key_W);
		pMenuGLWinsize->insertItem( "Input Width/Height", this,  SLOT(inputWidthHeight()), CTRL+Key_I);
	}


/*
	{
		QPopupMenu * pPopMenu = new QPopupMenu( this );
		menuBar()->insertItem( "&My Research", pPopMenu );
		pPopMenu->insertItem( "Bar Recons", this,  SLOT(detail_recon_bar()));
		pPopMenu->insertItem( "Vase Recons", this,  SLOT(detail_recon_vase()));
		pPopMenu->insertSeparator();
		pPopMenu->insertItem( "Letter Size Plate", this,  SLOT(detail_recon_a4plate()));
		pPopMenu->insertSeparator();
		pPopMenu->insertItem( "Detail Recon Dialog", this,  SLOT(detail_recon_anyobj()));
	} 
*/

	//================ end Rendering options ================================
	QGLFormat format;
	format.setStereo( true );
    m_pGLUIWin = new Viewer(format, this, "Viewer3D"); 
	assert(m_pGLUIWin!=NULL);
    statusBar()->setFixedHeight( fontMetrics().height() + 6 );
    statusBar()->message( "Viewer ready", 3000 );

    setCentralWidget(m_pGLUIWin);
	m_pGLUIWin->setDrawingData(&_drawParms);
	m_pGLUIWin->m_SceneGraph.hookObject(m_pGLUIWin);
	m_pGLUIWin->m_SceneGraph.hookGLWindow(m_pGLUIWin);

	//================ dock window==================
	QString appDir;
    m_pFemBar=_createDockWidgetBar(this, appDir);

}