Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

DialogGlobeTileTexture.cpp

Go to the documentation of this file.
00001 /*
00002  * DialogGlobeTileTexture.cpp
00003  *
00004  * Part of Fly! Legacy project
00005  *
00006  * Copyright 2003 Chris Wallace
00007  *
00008  * Fly! Legacy is free software; you can redistribute it and/or modify
00009  *   it under the terms of the GNU General Public License as published by
00010  *   the Free Software Foundation; either version 2 of the License, or
00011  *   (at your option) any later version.
00012  *
00013  * Fly! Legacy is distributed in the hope that it will be useful,
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *   GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  *   along with Fly! Legacy; if not, write to the Free Software
00020  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  *
00023  * This dialog implements the Globe Tile texture export feature of the Debug menu.
00024  *
00025  */
00026 
00027 
00028 #include "../Include/FlyLegacy.h"
00029 #include "../Include/Ui.h"
00030 #include "../Include/Utility.h"
00031 #include "../Include/Terrain.h"
00032 #include "../Include/Globals.h"
00033 
00034 
00035 static char *tiledetaillist[] =
00036 {
00037   "LOW",
00038   "MEDIUM",
00039   "HIGH",
00040   NULL
00041 };
00042 
00043 
00044 typedef struct {
00045   puDialogBox*  dialog;
00046   puFrame*    frame;
00047   puText*     title;
00048 
00049   puInput*    x_input;
00050   puInput*    z_input;
00051   puComboBox*   detail_combo;
00052 
00053   puOneShot*    btnExport;
00054   puOneShot*    close;
00055 
00056   char      et_string[80];
00057   int       x;
00058   int       z;
00059 } SGlobeTileTextureDialogData;
00060 
00061 static SGlobeTileTextureDialogData *dt = NULL;
00062 
00063 
00064 static void globe_tile_texture_export_cb (puObject* obj)
00065 {
00066   if (dt == NULL) return;
00067 
00068   ETileDetail detail = (ETileDetail) dt->detail_combo->getCurrentItem ();
00069 
00070   if ((dt->x >= 0) && (dt->x <= 255) && (dt->z >= 0) && (dt->z <= 255)) {
00071 //    globals->terrainmgr->ExportGlobeTileTexture (dt->x, dt->z, detail);
00072   } else {
00073     DrawNoticeToUser ("ERROR : Globe tile coordinates must be in range 0-255", 5);
00074   }
00075 }
00076 
00077 static void globe_tile_texture_close_cb (puObject* obj)
00078 {
00079   if (dt == NULL) return;
00080 
00081   // Deleting the PUI dialog will delete all child widgets as well
00082   delete dt->dialog;
00083 
00084   // Delete dialog data structure
00085   delete dt;
00086   dt = NULL;
00087 }
00088 
00089 
00090 void globe_tile_texture_dlg_create (void)
00091 {
00092   if (dt != NULL) return;
00093 
00094   // Instantiate data structure for dialog contents
00095   dt = new SGlobeTileTextureDialogData;
00096   dt->x = 0;
00097   dt->z = 0;
00098 
00099   // Define dialog size
00100   int frame_w = 300;
00101   int frame_h = 200;
00102 
00103   // Create dialog box
00104   dt->dialog = new puDialogBox (20, globals->screenHeight - 25 - frame_h);
00105   {
00106     // Frame
00107     dt->frame = new puFrame (0, 0, frame_w, frame_h);
00108 
00109     dt->title = new puText (10, 160);
00110     dt->title->setLabel ("Export Globe Tile Texture:");
00111 
00112     // detail combo box
00113     dt->detail_combo = new puComboBox (110, 100, 240, 120, tiledetaillist);
00114     dt->detail_combo->setLabel ("Detail :");
00115     dt->detail_combo->setLabelPlace (PUPLACE_CENTERED_LEFT);
00116     dt->detail_combo->setStyle (PUSTYLE_BOXED);
00117     dt->detail_combo->setCurrentItem (0);
00118 
00119     // GT X-coordinate input field
00120     dt->x_input = new puInput (80, 60, 130, 80);
00121     dt->x_input->setLabel ("GT X :");
00122     dt->x_input->setLabelPlace (PUPLACE_CENTERED_LEFT);
00123     dt->x_input->setStyle (PUSTYLE_BOXED);
00124     dt->x_input->setValuator (&dt->x);
00125 
00126     // GT Z-coordinate input field
00127     dt->z_input = new puInput (200, 60, 250, 80);
00128     dt->z_input->setLabel ("GT Z :");
00129     dt->z_input->setLabelPlace (PUPLACE_CENTERED_LEFT);
00130     dt->z_input->setStyle (PUSTYLE_BOXED);
00131     dt->z_input->setValuator (&dt->z);
00132 
00133     // Export button
00134     dt->btnExport = new puOneShot (110, 20, 170, 40);
00135     dt->btnExport->setLegend ("Export");
00136     dt->btnExport->makeReturnDefault (false);
00137     dt->btnExport->setStyle (PUSTYLE_SMALL_SHADED);
00138     dt->btnExport->setCallback (globe_tile_texture_export_cb);
00139 
00140     // Close dialog button
00141     dt->close = new puOneShot (190, 20, 240, 40);
00142     dt->close->setLegend ("Close");
00143     dt->close->makeReturnDefault (false);
00144     dt->close->setStyle (PUSTYLE_SMALL_SHADED);
00145     dt->close->setCallback (globe_tile_texture_close_cb);
00146   }
00147   dt->dialog->close ();
00148   dt->dialog->reveal ();
00149 }
00150 
SourceForge.net Logo Documentation generated by doxygen