2
0

PolyiPhoneCore.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * PolyiPhoneCore.cpp
  3. * Poly
  4. *
  5. * Created by Ivan Safrin on 2/1/10.
  6. * Copyright 2010 Ivan Safrin. All rights reserved.
  7. *
  8. */
  9. #include "PolyiPhoneCore.h"
  10. using namespace Polycode;
  11. long getThreadID() {
  12. return (long)pthread_self();
  13. }
  14. IPhoneCore::IPhoneCore(int frameRate) : Core(480, 320, true, 0, frameRate) {
  15. }
  16. IPhoneCore::~IPhoneCore() {
  17. }
  18. void IPhoneCore::enableMouse(bool newval) {
  19. }
  20. unsigned int IPhoneCore::getTicks() {
  21. return 0;
  22. }
  23. bool IPhoneCore::Update() {
  24. return running;
  25. }
  26. void IPhoneCore::setVideoMode(int xRes, int yRes, bool fullScreen, int aaLevel) {
  27. }
  28. void *PosixThreadFunc(void *data) {
  29. Threaded *target = static_cast<Threaded*>(data);
  30. target->runThread();
  31. return NULL;
  32. }
  33. void IPhoneCore::createThread(Threaded *target) {
  34. pthread_t thread;
  35. pthread_create( &thread, NULL, PosixThreadFunc, (void*)target);
  36. }
  37. void IPhoneCore::lockMutex(CoreMutex *mutex) {
  38. PosixMutex *m = (PosixMutex*) mutex;
  39. pthread_mutex_lock(&m->pMutex);
  40. }
  41. void IPhoneCore::unlockMutex(CoreMutex *mutex) {
  42. PosixMutex *m = (PosixMutex*) mutex;
  43. pthread_mutex_unlock(&m->pMutex);
  44. }
  45. CoreMutex *IPhoneCore::createMutex() {
  46. PosixMutex *mutex = new PosixMutex();
  47. pthread_mutex_init(&mutex->pMutex, NULL);
  48. return mutex;
  49. }
  50. void IPhoneCore::checkEvents() {
  51. }
  52. vector<Rectangle> IPhoneCore::getVideoModes() {
  53. vector<Rectangle> modes;
  54. return modes;
  55. }