Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
2.9 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #include "windows.h"
  9. #include "vgui_controls/Panel.h"
  10. #include "vgui/IScheme.h"
  11. #include "vgui/ISurface.h"
  12. #include "vgui/IVGui.h"
  13. #include "FileSystem.h"
  14. #include "tier0/icommandline.h"
  15. #include "inputsystem/iinputsystem.h"
  16. #include "appframework/tier3app.h"
  17. #include "LocalizationDialog.h"
  18. #include <stdio.h>
  19. //-----------------------------------------------------------------------------
  20. // The application object
  21. //-----------------------------------------------------------------------------
  22. class CVLocalizeApp : public CVguiSteamApp
  23. {
  24. typedef CVguiSteamApp BaseClass;
  25. public:
  26. // Methods of IApplication
  27. virtual bool Create();
  28. virtual bool PreInit();
  29. virtual int Main();
  30. virtual void Destroy() {}
  31. };
  32. DEFINE_WINDOWED_STEAM_APPLICATION_OBJECT( CVLocalizeApp );
  33. //-----------------------------------------------------------------------------
  34. // The application object
  35. //-----------------------------------------------------------------------------
  36. bool CVLocalizeApp::Create()
  37. {
  38. AppSystemInfo_t appSystems[] =
  39. {
  40. { "inputsystem.dll", INPUTSYSTEM_INTERFACE_VERSION },
  41. { "vgui2.dll", VGUI_IVGUI_INTERFACE_VERSION },
  42. { "", "" } // Required to terminate the list
  43. };
  44. return AddSystems( appSystems );
  45. }
  46. //-----------------------------------------------------------------------------
  47. // Purpose: Entry point
  48. //-----------------------------------------------------------------------------
  49. bool CVLocalizeApp::PreInit()
  50. {
  51. if ( !BaseClass::PreInit() )
  52. return false;
  53. if ( !BaseClass::SetupSearchPaths( NULL, false, true ) )
  54. {
  55. ::MessageBox( NULL, "Error", "Unable to initialize file system\n", MB_OK );
  56. return false;
  57. }
  58. g_pFullFileSystem->AddSearchPath("../game/platform", "PLATFORM");
  59. return true;
  60. }
  61. //-----------------------------------------------------------------------------
  62. // Purpose: Entry point
  63. //-----------------------------------------------------------------------------
  64. int CVLocalizeApp::Main()
  65. {
  66. // load the scheme
  67. if (!vgui::scheme()->LoadSchemeFromFile("Resource/TrackerScheme.res", "Tracker" ))
  68. return 1;
  69. // Init the surface
  70. vgui::Panel *panel = new vgui::Panel(NULL, "TopPanel");
  71. vgui::surface()->SetEmbeddedPanel(panel->GetVPanel());
  72. // Start vgui
  73. vgui::ivgui()->Start();
  74. // add our main window
  75. if ( CommandLine()->ParmCount() < 2 )
  76. {
  77. Warning( "Must specify a localization file!\n" );
  78. return 0;
  79. }
  80. const char *pFileName = CommandLine()->GetParm( 1 );
  81. CLocalizationDialog *dlg = new CLocalizationDialog( pFileName );
  82. dlg->SetParent( panel->GetVPanel() );
  83. dlg->MakePopup();
  84. // dlg->SetBounds( 0, 0, 800, 600 );
  85. dlg->SetVisible( true );
  86. // Run app frame loop
  87. while (vgui::ivgui()->IsRunning())
  88. {
  89. vgui::ivgui()->RunFrame();
  90. vgui::surface()->PaintTraverseEx( panel->GetVPanel(), true );
  91. }
  92. return 1;
  93. }