main.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include "PolycodeWindowsPlayer.h"
  2. #include <Polycode.h>
  3. #include "PolycodeView.h"
  4. #include "windows.h"
  5. #include "resource.h"
  6. #define STANDALONE_MODE
  7. using namespace Polycode;
  8. extern Win32Core *core;
  9. void wtoc(char* Dest, TCHAR* Source, int SourceSize)
  10. {
  11. for(int i = 0; i < SourceSize; ++i)
  12. Dest[i] = (char)Source[i];
  13. }
  14. int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  15. {
  16. int nArgs;
  17. LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
  18. String fileName = "";
  19. if(nArgs > 1) {
  20. fileName = String(szArglist[1]);
  21. }
  22. PolycodeView *view = new PolycodeView(hInstance, nCmdShow, L"Polycode Player", false, false);
  23. PolycodeWindowsPlayer *player = new PolycodeWindowsPlayer(view, fileName.c_str(), false, true);
  24. // player->addEventListener(view, PolycodeDebugEvent::EVENT_ERROR);
  25. // player->addEventListener(view, PolycodeDebugEvent::EVENT_PRINT);
  26. player->runPlayer();
  27. core = (Win32Core*)player->getCore();
  28. MSG Msg;
  29. do {
  30. if(PeekMessage(&Msg, NULL, 0,0,PM_REMOVE)) {
  31. TranslateMessage(&Msg);
  32. DispatchMessage(&Msg);
  33. }
  34. } while(player->Update());
  35. return Msg.wParam;
  36. }