summaryrefslogtreecommitdiffstats
path: root/src/app/system_other.h
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2013-03-19 23:07:39 +0100
committerPiotr Dziwinski <piotrdz@gmail.com>2013-03-19 23:07:39 +0100
commit025bedecfb2c264b1f3d6a04de72160001173cc1 (patch)
treee6dc3af619e479c556153735c021d2f5e54d1fa7 /src/app/system_other.h
parent4abcaae0f718ab861fcde194250b7ffe3bf1c521 (diff)
downloadcolobot-025bedecfb2c264b1f3d6a04de72160001173cc1.tar.gz
colobot-025bedecfb2c264b1f3d6a04de72160001173cc1.tar.bz2
colobot-025bedecfb2c264b1f3d6a04de72160001173cc1.zip
Refactored platform-specific code
Moved functions from .h to .cpp files
Diffstat (limited to 'src/app/system_other.h')
-rw-r--r--src/app/system_other.h114
1 files changed, 5 insertions, 109 deletions
diff --git a/src/app/system_other.h b/src/app/system_other.h
index eff0c8a..6fb4b86 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 <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;
@@ -45,105 +38,8 @@ 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()
-{
- return 1000000ll;
-}
+SystemDialogResult SystemDialog_Other(SystemDialogType type, const std::string& title, const std::string& message);
-long long TimeStampExactDiff_Other(SystemTimeStamp *before, SystemTimeStamp *after)
-{
- return (after->sdlTicks - before->sdlTicks) * 1000000ll;
-}
+void GetCurrentTimeStamp_Other(SystemTimeStamp *stamp);
+long long GetTimeStampExactResolution_Other();
+long long TimeStampExactDiff_Other(SystemTimeStamp *before, SystemTimeStamp *after);