Team Fortress 2 Source Code as on 22/4/2020
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.

117 lines
3.0 KiB

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