summaryrefslogtreecommitdiffstats
path: root/src/app/system_other.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/system_other.h')
-rw-r--r--src/app/system_other.h119
1 files changed, 9 insertions, 110 deletions
diff --git a/src/app/system_other.h b/src/app/system_other.h
index eff0c8a..bf16c80 100644
--- a/src/app/system_other.h
+++ b/src/app/system_other.h
@@ -20,20 +20,13 @@
* \brief Fallback code for other systems
*/
-/* NOTE: code is contained in this header;
- * there is no separate .cpp module for simplicity */
+#include "app/system.h"
-#include <SDL/SDL.h>
+#include <SDL.h>
#include <iostream>
-SystemDialogResult SystemDialog_Other(SystemDialogType type, const std::string& title, const std::string& message);
-
-void GetCurrentTimeStamp_Other(SystemTimeStamp *stamp);
-long long GetTimeStampExactResolution_Other();
-long long TimeStampExactDiff_Other(SystemTimeStamp *before, SystemTimeStamp *after);
-
struct SystemTimeStamp
{
Uint32 sdlTicks;
@@ -44,106 +37,12 @@ struct SystemTimeStamp
}
};
-
-SystemDialogResult SystemDialog_Other(SystemDialogType type, const std::string& title, const std::string& message)
-{
- switch (type)
- {
- case SDT_INFO:
- std::cout << "INFO: ";
- break;
- case SDT_WARNING:
- std::cout << "WARNING:";
- break;
- case SDT_ERROR:
- std::cout << "ERROR: ";
- break;
- case SDT_YES_NO:
- case SDT_OK_CANCEL:
- std::cout << "QUESTION: ";
- break;
- }
-
- std::cout << message << std::endl;
-
- std::string line;
-
- SystemDialogResult result = SDR_OK;
-
- bool done = false;
- while (!done)
- {
- switch (type)
- {
- case SDT_INFO:
- case SDT_WARNING:
- case SDT_ERROR:
- std::cout << "Press ENTER to continue";
- break;
-
- case SDT_YES_NO:
- std::cout << "Type 'Y' for Yes or 'N' for No";
- break;
-
- case SDT_OK_CANCEL:
- std::cout << "Type 'O' for OK or 'C' for Cancel";
- break;
- }
-
- std::getline(std::cin, line);
-
- switch (type)
- {
- case SDT_INFO:
- case SDT_WARNING:
- case SDT_ERROR:
- done = true;
- break;
-
- case SDT_YES_NO:
- if (line == "Y" || line == "y")
- {
- result = SDR_YES;
- done = true;
- }
- else if (line == "N" || line == "n")
- {
- result = SDR_NO;
- done = true;
- }
- break;
-
- case SDT_OK_CANCEL:
- if (line == "O" || line == "o")
- {
- done = true;
- result = SDR_OK;
- }
- else if (line == "C" || line == "c")
- {
- done = true;
- result = SDR_CANCEL;
- }
- break;
- }
- }
-
- return result;
-}
-
-
-
-void GetCurrentTimeStamp_Other(SystemTimeStamp *stamp)
-{
- stamp->sdlTicks = SDL_GetTicks();
-}
-
-long long GetTimeStampExactResolution_Other()
+class CSystemUtilsOther : public CSystemUtils
{
- return 1000000ll;
-}
+public:
+ virtual SystemDialogResult SystemDialog(SystemDialogType type, const std::string& title, const std::string& message) override;
-long long TimeStampExactDiff_Other(SystemTimeStamp *before, SystemTimeStamp *after)
-{
- return (after->sdlTicks - before->sdlTicks) * 1000000ll;
-}
+ virtual void GetCurrentTimeStamp(SystemTimeStamp *stamp) override;
+ virtual long long GetTimeStampExactResolution() override;
+ virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) override;
+};