PolycodePlayer.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * TauTestApp.h
  3. * tauTest
  4. *
  5. * Created by Ivan Safrin on 5/8/08.
  6. * Copyright 2008 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. #pragma once
  10. #include <iostream>
  11. #include <fstream>
  12. #include "Polycode.h"
  13. #include "PolycodeLUA.h"
  14. extern "C" {
  15. #include <stdio.h>
  16. #include "lua.h"
  17. #include "lualib.h"
  18. #include "lauxlib.h"
  19. // #include "lapi.h"
  20. using namespace Polycode;
  21. class PolycodeDebugEvent : public Event {
  22. public:
  23. PolycodeDebugEvent();
  24. ~PolycodeDebugEvent();
  25. int lineNumber;
  26. String errorString;
  27. int xRes;
  28. int yRes;
  29. static const int EVENT_ERROR = 0;
  30. static const int EVENT_PRINT = 1;
  31. static const int EVENT_RESIZE = 2;
  32. static const int EVENT_REMOVE = 3;
  33. };
  34. class PolycodePlayer : public EventDispatcher {
  35. public:
  36. PolycodePlayer(String fileName, bool knownArchive);
  37. virtual ~PolycodePlayer();
  38. void runPlayer();
  39. void loadFile(const char *fileName);
  40. void runFile(String fileName);
  41. int report (lua_State *L, int status);
  42. void handleEvent(Event *event);
  43. bool Update();
  44. virtual void createCore() = 0;
  45. Core *getCore() { return core; }
  46. int xRes;
  47. int yRes;
  48. int aaLevel;
  49. bool fullScreen;
  50. int frameRate;
  51. void *windowData;
  52. bool doneLoading;
  53. Core *core;
  54. protected:
  55. lua_State *L;
  56. bool _knownArchive;
  57. String fileToRun;
  58. };
  59. }