Changed: Removed unused client code from sheets_packer

This commit is contained in:
kervala 2010-06-12 18:02:51 +02:00
parent 2f93f19afc
commit 2c5b13b4a4
6 changed files with 13 additions and 322 deletions

View file

@ -1,18 +1,7 @@
////////////////////////// /////////////////////////////////
////////////////////////// /////////////////////////////////
/// CLIENT CONFIG FILE /// /// SHEETS PACKER CONFIG FILE ///
////////////////////////// /////////////////////////////////
////////////////////////// /////////////////////////////////
FullScreen = 0;
Width = 800;
Height = 600;
PositionX = 0;
PositionY = 0;
Frequency = 60;
Depth = 32;
Sleep = -1;
Contrast = 0.0; // -1.0 ~ 1.0
Luminosity = 0.0; // -1.0 ~ 1.0
Gamma = 0.0; // -1.0 ~ 1.0
DataPath = { "../../common/data_leveldesign", "../../common/data_common", "../../client/data" }; DataPath = { "../../common/data_leveldesign", "../../common/data_common", "../../client/data" };
LigoPrimitiveClass = "world_editor_classes.xml"; LigoPrimitiveClass = "world_editor_classes.xml";

View file

@ -65,50 +65,6 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR cmdline,
int main(int argc, char **argv) int main(int argc, char **argv)
#endif #endif
{ {
/*
#if defined(NL_OS_WINDOWS)
// extract the 2 first param (argv[1] and argv[2]) it must be cookie and addr
string cmd = cmdline;
std::string::size_type pos1 = cmd.find_first_not_of (' ');
std::string::size_type pos2;
if (pos1 != string::npos)
{
pos2 = cmd.find (' ', pos1);
if(pos2 != string::npos)
{
cookie = cmd.substr (pos1, pos2-pos1);
pos1 = cmd.find_first_not_of (' ', pos2);
if (pos1 != string::npos)
{
pos2 = cmd.find (' ', pos1);
if(pos2 == string::npos)
{
fsaddr = cmd.substr (pos1);
}
else if (pos1 != pos2)
{
fsaddr = cmd.substr (pos1, pos2-pos1);
}
}
}
}
#else
if (argc>=3)
{
cookie = argv[1];
fsaddr = argv[2];
}
nlinfo ("From command line (argc=%d): cookie '%s' addr '%s'", argc, cookie.c_str (), fsaddr.c_str());
#endif
*/
///////////////////////////////// /////////////////////////////////
// Initialize the application. // // Initialize the application. //
try try

View file

@ -22,21 +22,12 @@
///////////// /////////////
#include "stdpch.h" #include "stdpch.h"
#if defined(NL_OS_WINDOWS)
#include <windows.h>
#endif
// Misc. // Misc.
#include "nel/misc/config_file.h" #include "nel/misc/config_file.h"
#include "nel/misc/bit_mem_stream.h" #include "nel/misc/bit_mem_stream.h"
// Client. // Client.
#include "sheets_packer_cfg.h" #include "sheets_packer_cfg.h"
#include "debug_client.h"
// 3D Interface.
//#include "nel/3d/u_driver.h"
//#include "nel/3d/u_scene.h"
// Game Share.
#include "game_share/time_weather_season/time_and_season.h"
/////////// ///////////
// MACRO // // MACRO //
@ -138,7 +129,6 @@
// USING // // USING //
/////////// ///////////
using namespace NLMISC; using namespace NLMISC;
//using namespace NL3D;
//////////// ////////////
@ -148,13 +138,6 @@ CClientConfig AppCfg;
const std::string ConfigFileName = "sheets_packer.cfg"; const std::string ConfigFileName = "sheets_packer.cfg";
////////////
// EXTERN //
////////////
//extern NL3D::UScene *Scene;
//extern NL3D::UDriver *Driver;
extern CRyzomTime RT;
///////////// /////////////
// METHODS // // METHODS //
///////////// /////////////
@ -165,17 +148,6 @@ extern CRyzomTime RT;
CClientConfig::CClientConfig() CClientConfig::CClientConfig()
{ {
SaveConfig = false; SaveConfig = false;
PositionX = 0;
PositionY = 0;
Frequency = 60;
Windowed = false; // Default is windowed mode.
Width = 800; // Default Width for the window.
Height = 600; // Default Height for the window.
Depth = 32; // Default Bit per Pixel.
Contrast = 0.f; // Default Monitor Contrast.
Luminosity = 0.f; // Default Monitor Luminosity.
Gamma = 0.f; // Default Monitor Gamma.
PreDataPath.push_back("../../client/data/gamedev/language/"); // Default Path for the language data
DataPath.push_back("../../client/data/"); // Default Path for the Data. DataPath.push_back("../../client/data/"); // Default Path for the Data.
DataPath.push_back("../../common/data_leveldesign/"); // Default Path for the Level Design Directory. DataPath.push_back("../../common/data_leveldesign/"); // Default Path for the Level Design Directory.
DataPath.push_back("../../common/data_common/"); // Default Path for the Level Design Directory. DataPath.push_back("../../common/data_common/"); // Default Path for the Level Design Directory.
@ -197,69 +169,8 @@ void setValues()
CConfigFile::CVar *varPtr = 0; CConfigFile::CVar *varPtr = 0;
///////////////////
// WINDOW CONFIG //
// Mode.
// SaveConfig
varPtr = AppCfg.ConfigFile.getVarPtr ("SaveConfig");
if (varPtr)
AppCfg.SaveConfig = varPtr->asInt() ? true : false;
else
nlwarning ("Default value used for 'SaveConfig' !!!");
// Window Positon
varPtr = AppCfg.ConfigFile.getVarPtr ("PositionX");
if (varPtr)
AppCfg.PositionX = varPtr->asInt();
else
nlwarning ("Default value used for 'PositionX' !!!");
varPtr = AppCfg.ConfigFile.getVarPtr ("PositionY");
if (varPtr)
AppCfg.PositionY = varPtr->asInt();
else
nlwarning ("Default value used for 'PositionY' !!!");
// Window frequency
varPtr = AppCfg.ConfigFile.getVarPtr ("Frequency");
if (varPtr)
AppCfg.Frequency = varPtr->asInt();
else
nlwarning ("Default value used for 'Frequency' !!!");
try
{
CConfigFile::CVar &cvFullScreen = AppCfg.ConfigFile.getVar("FullScreen");
AppCfg.Windowed = cvFullScreen.asInt() ? false : true;
}
catch(EUnknownVar &) {nlwarning("Default value used for 'Fullscreen' !!!");}
// Width
READ_INT(Width)
// Height
READ_INT(Height)
// Depth : Bit Per Pixel
READ_INT(Depth)
// Contrast
READ_FLOAT(Contrast)
// Luminosity
READ_FLOAT(Luminosity)
// Gamma
READ_FLOAT(Gamma)
////////// //////////
// MISC // // MISC //
// Pre Data Path.
try
{
CConfigFile::CVar &cvPreDataPath = AppCfg.ConfigFile.getVar("PreDataPath");
AppCfg.PreDataPath.clear ();
for (uint i = 0; i < cvPreDataPath.size(); i++)
AppCfg.PreDataPath.push_back(cvPreDataPath.asString(i));
}
catch(EUnknownVar &) {nlwarning("Default value used for 'PreDataPath' !!!");}
// Data Path. // Data Path.
try try
{ {
@ -314,35 +225,7 @@ void setValues()
// LanguageCode // LanguageCode
READ_STRING(LanguageCode) READ_STRING(LanguageCode)
READ_BOOL(FPExceptions) READ_BOOL(FPExceptions)
//////////
// INIT //
// FPU
#ifdef NL_OS_WINDOWS
if(AppCfg.FPExceptions)
_control87(_EM_INVALID|_EM_DENORMAL/*|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM);
else
_control87(_EM_INVALID|_EM_DENORMAL|_EM_ZERODIVIDE|_EM_OVERFLOW|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM);
#endif // NL_OS_WINDOWS
/* if(Driver)
{
// Set the monitor color properties
CMonitorColorProperties monitorColor;
for(uint i=0; i<3; i++)
{
monitorColor.Contrast[i] = AppCfg.Contrast;
monitorColor.Luminosity[i] = AppCfg.Luminosity;
monitorColor.Gamma[i] = AppCfg.Gamma;
}
if(!Driver->setMonitorColorProperties(monitorColor))
nlwarning("reloadCFG: setMonitorColorProperties fails");
}
*/
}// load // }// load //
@ -355,41 +238,6 @@ void CClientConfig::serial(class NLMISC::IStream &f) throw(NLMISC::EStream)
// Start the opening of a new node named ClientCFG. // Start the opening of a new node named ClientCFG.
f.xmlPush("ClientCFG"); f.xmlPush("ClientCFG");
f.xmlPushBegin("Windowed");
f.xmlPushEnd();
f.serial(Windowed);
f.xmlPop();
f.xmlPushBegin("Width");
f.xmlPushEnd();
f.serial(Width);
f.xmlPop();
f.xmlPushBegin("Height");
f.xmlPushEnd();
f.serial(Height);
f.xmlPop();
f.xmlPushBegin("Depth");
f.xmlPushEnd();
f.serial(Depth);
f.xmlPop();
f.xmlPushBegin("Contrast");
f.xmlPushEnd();
f.serial(Contrast);
f.xmlPop();
f.xmlPushBegin("Luminosity");
f.xmlPushEnd();
f.serial(Luminosity);
f.xmlPop();
f.xmlPushBegin("Gamma");
f.xmlPushEnd();
f.serial(Gamma);
f.xmlPop();
// Close the serial for hte Client CFG. // Close the serial for hte Client CFG.
f.xmlPop(); f.xmlPop();
}// serial // }// serial //
@ -412,52 +260,13 @@ void CClientConfig::init(const std::string &configFileName)
//----------------------------------------------- //-----------------------------------------------
// init : // release :
//----------------------------------------------- //-----------------------------------------------
void CClientConfig::release () void CClientConfig::release ()
{ {
// Do we have to save the cfg file ? // Do we have to save the cfg file ?
if (AppCfg.SaveConfig) if (AppCfg.SaveConfig)
{ {
// Are we in window mode ?
if (AppCfg.Windowed)
{
/* // Driver still alive ?
if (Driver && Driver->isActive ())
{
#ifdef NL_OS_WINDOWS
HWND hWnd = (HWND)Driver->getDisplay ();
// Get the window position
RECT window;
RECT client;
GetWindowRect (hWnd, &window);
GetClientRect (hWnd, &client);
// Save values
try
{
CConfigFile::CVar *varPtr = AppCfg.ConfigFile.getVarPtr ("PositionX");
if (varPtr)
varPtr->setAsInt (window.left);
varPtr = AppCfg.ConfigFile.getVarPtr ("PositionY");
if (varPtr)
varPtr->setAsInt (window.top);
varPtr = AppCfg.ConfigFile.getVarPtr ("Width");
if (varPtr)
varPtr->setAsInt (client.right - client.left);
varPtr = AppCfg.ConfigFile.getVarPtr ("Height");
if (varPtr)
varPtr->setAsInt (client.bottom - client.top);
}
catch (Exception &e)
{
nlwarning ("Error while set config file variables : %s", e.what ());
}
#endif // NL_OS_WINDOWS
}
*/ }
// Save it // Save it
AppCfg.ConfigFile.save (); AppCfg.ConfigFile.save ();
} }

View file

@ -43,29 +43,7 @@ struct CClientConfig
/// Save the cfg file when exit the client ? /// Save the cfg file when exit the client ?
bool SaveConfig; bool SaveConfig;
/// Window position in windowed mode
sint PositionX;
sint PositionY;
/// Window frequency
uint Frequency;
/// Application start in a window or in fullscreen.
bool Windowed;
/// Width for the Application.
uint16 Width;
/// Height for the Application.
uint16 Height;
/// Bit Per Pixel (only used in Fullscreen mode).
uint16 Depth;
/// Monitor Constrast [-1 ~ 1], default 0
float Contrast;
/// Monitor Luminosity [-1 ~ 1], default 0
float Luminosity;
/// Monitor Gamma [-1 ~ 1], default 0
float Gamma;
/// Pre Data Path.
std::vector<std::string> PreDataPath;
/// Data Path. /// Data Path.
std::vector<std::string> DataPath; std::vector<std::string> DataPath;
/// True if we want the packed sheet to be updated if needed /// True if we want the packed sheet to be updated if needed

View file

@ -81,26 +81,6 @@ bool init()
nlinfo("Loading config file..."); nlinfo("Loading config file...");
AppCfg.init(ConfigFileName); AppCfg.init(ConfigFileName);
/*
// Create the driver (most important part of the client).
nlinfo("Creating 3d driver...");
Driver = UDriver::createDriver ();
if(Driver == 0)
{
nlerror("sheets_packer_init: Cannot create a Driver.");
return false;
}
UDriver::CMode mode;
mode.Windowed = AppCfg.Windowed;
mode.Depth = AppCfg.Depth;
mode.Width = AppCfg.Width;
mode.Height = AppCfg.Height;
// Set the mode of the window.
Driver->setDisplay(mode);
*/
// Define the root path that contains all data needed for the application. // Define the root path that contains all data needed for the application.
nlinfo("Adding search paths..."); nlinfo("Adding search paths...");
for(uint i = 0; i < AppCfg.DataPath.size(); i++) for(uint i = 0; i < AppCfg.DataPath.size(); i++)

View file

@ -21,27 +21,17 @@
// INCLUDE // // INCLUDE //
///////////// /////////////
#include "stdpch.h" #include "stdpch.h"
// Misc.
#include "nel/misc/debug.h"
// 3D Interface.
//#include "nel/3d/u_driver.h"
// Client
#include "sheets_packer_release.h" #include "sheets_packer_release.h"
#include "nel/misc/debug.h"
/////////// ///////////
// USING // // USING //
/////////// ///////////
//using namespace NL3D;
using namespace NLMISC; using namespace NLMISC;
////////////
// EXTERN //
////////////
//extern UDriver *Driver;
/////////////// ///////////////
// FUNCTIONS // // FUNCTIONS //
/////////////// ///////////////
@ -51,20 +41,9 @@ using namespace NLMISC;
//--------------------------------------------------- //---------------------------------------------------
void release() void release()
{ {
// Delete the driver. DebugLog->removeDisplayer ("SHEETS_PACKER.LOG");
/* if(Driver) InfoLog->removeDisplayer ("SHEETS_PACKER.LOG");
{ WarningLog->removeDisplayer ("SHEETS_PACKER.LOG");
// Release Scene, textcontexts, materials, ... ErrorLog->removeDisplayer ("SHEETS_PACKER.LOG");
Driver->release(); AssertLog->removeDisplayer ("SHEETS_PACKER.LOG");
// Delete the driver.
delete Driver;
Driver = 0;
}
*/
DebugLog->removeDisplayer ("CLIENT.LOG");
InfoLog->removeDisplayer ("CLIENT.LOG");
WarningLog->removeDisplayer ("CLIENT.LOG");
ErrorLog->removeDisplayer ("CLIENT.LOG");
AssertLog->removeDisplayer ("CLIENT.LOG");
}// release // }// release //