diff --git a/.gitignore b/.gitignore index c5909136f..6cc007a44 100644 --- a/.gitignore +++ b/.gitignore @@ -254,8 +254,6 @@ tmp !*.nsi # and others to exclude -*.filters -*.vcxitems plugins/LPeg/source/makefile /.project /Default/ diff --git a/libgid/include/winrt/ghttp-winrt.h b/libgid/include/winrt/ghttp-winrt.h new file mode 100644 index 000000000..290168913 --- /dev/null +++ b/libgid/include/winrt/ghttp-winrt.h @@ -0,0 +1,45 @@ +#ifndef GHTTPQT_H +#define GHTTPQT_H + +#include +#include +#include +class QAuthenticator; +class QNetworkProxy; +#include +#include + +#include + +class HTTPManager : public QObject +{ + Q_OBJECT + +public: + HTTPManager(); + ~HTTPManager(); + + g_id Get(const char* url, const ghttp_Header *header, gevent_Callback callback, void* udata); + g_id Post(const char* url, const ghttp_Header *header, const void* data, size_t size, gevent_Callback callback, void* udata); + g_id Delete(const char* url, const ghttp_Header *header, gevent_Callback callback, void* udata); + g_id Put(const char* url, const ghttp_Header *header, const void* data, size_t size, gevent_Callback callback, void* udata); + void Close(g_id id); + void CloseAll(); + +private slots: + void finished(QNetworkReply *reply); + void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); + +private: + QNetworkAccessManager *manager_; + + struct NetworkReply + { + g_id id; + gevent_Callback callback; + void *udata; + }; + std::map map_; +}; + +#endif diff --git a/libgid/include/winrt/ginput-winrt.h b/libgid/include/winrt/ginput-winrt.h new file mode 100644 index 000000000..820378265 --- /dev/null +++ b/libgid/include/winrt/ginput-winrt.h @@ -0,0 +1,20 @@ +#ifndef _GINPUT_WINRT_H_ +#define _GINPUT_WINRT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +G_API void ginputp_mouseDown(int x, int y, int button); +G_API void ginputp_mouseMove(int x, int y); +G_API void ginputp_mouseUp(int x, int y, int button); +G_API void ginputp_keyDown(int keyCode); +G_API void ginputp_keyUp(int keyCode); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libgid/include/winrt/gui-winrt.h b/libgid/include/winrt/gui-winrt.h new file mode 100644 index 000000000..6b73191bd --- /dev/null +++ b/libgid/include/winrt/gui-winrt.h @@ -0,0 +1,86 @@ +#ifndef _GUI_QT_H_ +#define _GUI_QT_H_ + +#include +#include +#include + +class QAbstractButton; +class QStringList; +class UIManager; +class QLineEdit; + +class AlertDialog : public QDialog +{ + Q_OBJECT + +public: + AlertDialog(const char *title, + const char *message, + const char *cancelButton, + const char *button1, + const char *button2, + gevent_Callback callback, + void *udata, + g_id gid, + QWidget *parent = 0); + +protected: + virtual void closeEvent(QCloseEvent *); + +private slots: + void clicked(QAbstractButton *button); + +private: + gevent_Callback callback_; + void *udata_; + g_id gid_; + +private: + QMap buttonIndices_; + QAbstractButton *cancelButton_; +}; + +class TextInputDialog : public QDialog +{ + Q_OBJECT + +public: + TextInputDialog(const char *title, + const char *message, + const char *text, + const char *cancelButton, + const char *button1, + const char *button2, + gevent_Callback callback, + void *udata, + g_id gid, + QWidget *parent = 0); + +public: + void setText(const char* text); + const char *getText() const; + void setInputType(int inputType); + int getInputType() const; + void setSecureInput(bool secureInput); + bool isSecureInput() const; + +protected: + virtual void closeEvent(QCloseEvent *); + +private slots: + void clicked(QAbstractButton *button); + +private: + gevent_Callback callback_; + void *udata_; + g_id gid_; + QLineEdit *lineEdit_; + mutable QByteArray lineEditBuffer_; + +private: + QMap buttonIndices_; + QAbstractButton *cancelButton_; +}; + +#endif diff --git a/libgid/src/winrt/gapplication-winrt.cpp b/libgid/src/winrt/gapplication-winrt.cpp new file mode 100644 index 000000000..c7247038a --- /dev/null +++ b/libgid/src/winrt/gapplication-winrt.cpp @@ -0,0 +1,36 @@ +#include + + +extern "C" { + +void gapplication_init() +{ + +} + +void gapplication_cleanup() +{ + +} + +int gapplication_getScreenDensity() +{ + return -1; +} + +g_id gapplication_addCallback(gevent_Callback callback, void *udata) +{ + return 0; +} + +void gapplication_removeCallback(gevent_Callback callback, void *udata) +{ + +} + +void gapplication_removeCallbackWithGid(g_id gid) +{ + +} + +} diff --git a/libgid/src/winrt/gaudio-winrt.cpp b/libgid/src/winrt/gaudio-winrt.cpp new file mode 100644 index 000000000..25610b289 --- /dev/null +++ b/libgid/src/winrt/gaudio-winrt.cpp @@ -0,0 +1,63 @@ +#include +#include +#include "../ggaudiomanager.h" + +extern "C" { +GGSampleInterface *GGSampleXAudio2ManagerCreate(); +void GGSampleXAudio2ManagerDelete(GGSampleInterface *manager); + +GGStreamInterface *GGStreamXAudio2ManagerCreate(); +void GGStreamXAudio2ManagerDelete(GGStreamInterface *manager); +} + +void GGAudioManager::systemInit() +{ + mpg123_init(); +} + +void GGAudioManager::systemCleanup() +{ + mpg123_exit(); +} + +void GGAudioManager::createBackgroundMusicInterface() +{ + backgroundMusicInterface_ = NULL; +} + +void GGAudioManager::deleteBackgroundMusicInterface() +{ +} + +void GGAudioManager::beginInterruption() +{ +} + +void GGAudioManager::endInterruption() +{ +} + +void GGAudioManager::AdvanceStreamBuffers() +{ + soundManager_->AdvanceStreamBuffers(); +} + +void GGSoundManager::interfacesInit() +{ + loaders_["wav"] = GGAudioLoader(gaudio_WavOpen, gaudio_WavClose, gaudio_WavRead, gaudio_WavSeek, gaudio_WavTell); + loaders_["mp3"] = GGAudioLoader(gaudio_Mp3Open, gaudio_Mp3Close, gaudio_Mp3Read, gaudio_Mp3Seek, gaudio_Mp3Tell); + + sampleInterface_ = GGSampleXAudio2ManagerCreate(); + streamInterface_ = GGStreamXAudio2ManagerCreate(); +} + +void GGSoundManager::interfacesCleanup() +{ + GGSampleXAudio2ManagerDelete(sampleInterface_); + GGStreamXAudio2ManagerDelete(streamInterface_); +} + +void GGSoundManager::AdvanceStreamBuffers() +{ + streamInterface_->AdvanceStreamBuffers(); +} diff --git a/libgid/src/winrt/ggeolocation-winrt.cpp b/libgid/src/winrt/ggeolocation-winrt.cpp new file mode 100644 index 000000000..65b72eade --- /dev/null +++ b/libgid/src/winrt/ggeolocation-winrt.cpp @@ -0,0 +1,84 @@ +#include "ggeolocation.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void ggeolocation_init() +{ + +} + +void ggeolocation_cleanup() +{ + +} + +int ggeolocation_isAvailable() +{ + return 0; +} + +int ggeolocation_isHeadingAvailable() +{ + return 0; +} + +void ggeolocation_setAccuracy(double accuracy) +{ + +} + +double ggeolocation_getAccuracy() +{ + return 0; +} + +void ggeolocation_setThreshold(double threshold) +{ + +} + +double ggeolocation_getThreshold() +{ + return 0; +} + +void ggeolocation_startUpdatingLocation() +{ + +} + +void ggeolocation_stopUpdatingLocation() +{ + +} + +void ggeolocation_startUpdatingHeading() +{ + +} + +void ggeolocation_stopUpdatingHeading() +{ + +} + +g_id ggeolocation_addCallback(gevent_Callback callback, void *udata) +{ + return 0; +} + +void ggeolocation_removeCallback(gevent_Callback callback, void *udata) +{ + +} + +void ggeolocation_removeCallbackWithGid(g_id gid) +{ + +} + +#ifdef __cplusplus +} +#endif diff --git a/libgid/src/winrt/ghttp-winrt.cpp b/libgid/src/winrt/ghttp-winrt.cpp new file mode 100644 index 000000000..52f7b9dad --- /dev/null +++ b/libgid/src/winrt/ghttp-winrt.cpp @@ -0,0 +1,50 @@ +#include + +extern "C" { + +void ghttp_Init() +{ +// s_manager = new HTTPManager(); +} + +void ghttp_Cleanup() +{ +// delete s_manager; +// s_manager = NULL; +} + +g_id ghttp_Get(const char* url, const ghttp_Header *header, gevent_Callback callback, void* udata) +{ +// return s_manager->Get(url, header, callback, udata); + return 0; +} + +g_id ghttp_Post(const char* url, const ghttp_Header *header, const void* data, size_t size, gevent_Callback callback, void* udata) +{ +// return s_manager->Post(url, header, data, size, callback, udata); + return 0; +} + +g_id ghttp_Delete(const char* url, const ghttp_Header *header, gevent_Callback callback, void* udata) +{ +// return s_manager->Delete(url, header, callback, udata); + return 0; +} + +g_id ghttp_Put(const char* url, const ghttp_Header *header, const void* data, size_t size, gevent_Callback callback, void* udata) +{ +// return s_manager->Put(url, header, data, size, callback, udata); + return 0; +} + +void ghttp_Close(g_id id) +{ +// s_manager->Close(id); +} + +void ghttp_CloseAll() +{ +// s_manager->CloseAll(); +} + +} diff --git a/libgid/src/winrt/ginput-winrt.cpp b/libgid/src/winrt/ginput-winrt.cpp new file mode 100644 index 000000000..1359e9d76 --- /dev/null +++ b/libgid/src/winrt/ginput-winrt.cpp @@ -0,0 +1,559 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +namespace ginput { + +class InputManager +{ +public: + InputManager() + { + isMouseToTouchEnabled_ = 0; + isTouchToMouseEnabled_ = 0; + mouseTouchOrder_= 0; + + keyMap_[GINPUT_KEY_LEFT] = GINPUT_KEY_LEFT; + keyMap_[GINPUT_KEY_RIGHT] = GINPUT_KEY_RIGHT; + keyMap_[GINPUT_KEY_UP] = GINPUT_KEY_UP; + keyMap_[GINPUT_KEY_DOWN] = GINPUT_KEY_DOWN; + + keyMap_[GINPUT_KEY_0] = GINPUT_KEY_0; + keyMap_[GINPUT_KEY_1] = GINPUT_KEY_1; + keyMap_[GINPUT_KEY_2] = GINPUT_KEY_2; + keyMap_[GINPUT_KEY_3] = GINPUT_KEY_3; + keyMap_[GINPUT_KEY_4] = GINPUT_KEY_4; + keyMap_[GINPUT_KEY_5] = GINPUT_KEY_5; + keyMap_[GINPUT_KEY_6] = GINPUT_KEY_6; + keyMap_[GINPUT_KEY_7] = GINPUT_KEY_7; + keyMap_[GINPUT_KEY_8] = GINPUT_KEY_8; + keyMap_[GINPUT_KEY_9] = GINPUT_KEY_9; + + keyMap_[GINPUT_KEY_A] = GINPUT_KEY_A; + keyMap_[GINPUT_KEY_B] = GINPUT_KEY_B; + keyMap_[GINPUT_KEY_C] = GINPUT_KEY_C; + keyMap_[GINPUT_KEY_D] = GINPUT_KEY_D; + keyMap_[GINPUT_KEY_E] = GINPUT_KEY_E; + keyMap_[GINPUT_KEY_F] = GINPUT_KEY_F; + keyMap_[GINPUT_KEY_G] = GINPUT_KEY_G; + keyMap_[GINPUT_KEY_H] = GINPUT_KEY_H; + keyMap_[GINPUT_KEY_I] = GINPUT_KEY_I; + keyMap_[GINPUT_KEY_J] = GINPUT_KEY_J; + keyMap_[GINPUT_KEY_K] = GINPUT_KEY_K; + keyMap_[GINPUT_KEY_L] = GINPUT_KEY_L; + keyMap_[GINPUT_KEY_M] = GINPUT_KEY_M; + keyMap_[GINPUT_KEY_N] = GINPUT_KEY_N; + keyMap_[GINPUT_KEY_O] = GINPUT_KEY_O; + keyMap_[GINPUT_KEY_P] = GINPUT_KEY_P; + keyMap_[GINPUT_KEY_Q] = GINPUT_KEY_Q; + keyMap_[GINPUT_KEY_R] = GINPUT_KEY_R; + keyMap_[GINPUT_KEY_S] = GINPUT_KEY_S; + keyMap_[GINPUT_KEY_T] = GINPUT_KEY_T; + keyMap_[GINPUT_KEY_U] = GINPUT_KEY_U; + keyMap_[GINPUT_KEY_V] = GINPUT_KEY_V; + keyMap_[GINPUT_KEY_W] = GINPUT_KEY_W; + keyMap_[GINPUT_KEY_X] = GINPUT_KEY_X; + keyMap_[GINPUT_KEY_Y] = GINPUT_KEY_Y; + keyMap_[GINPUT_KEY_Z] = GINPUT_KEY_Z; + + pthread_mutex_init(&touchPoolMutex_, NULL); + + gevent_AddCallback(posttick_s, this); + + gid_ = g_NextId(); + } + + ~InputManager() + { + gevent_RemoveCallbackWithGid(gid_); + + gevent_RemoveCallback(posttick_s, this); + + for (size_t i = 0; i < mousePool1_.size(); ++i) + delete mousePool1_[i]; + for (size_t i = 0; i < mousePool2_.size(); ++i) + delete mousePool2_[i]; + + for (size_t i = 0; i < keyPool1_.size(); ++i) + delete keyPool1_[i]; + for (size_t i = 0; i < keyPool2_.size(); ++i) + delete keyPool2_[i]; + + + pthread_mutex_lock(&touchPoolMutex_); + std::map >::iterator iter; + for (iter = touchPool1_.begin(); iter != touchPool1_.end(); ++iter) + { + const std::vector &v = iter->second; + for (size_t i = 0; i < v.size(); ++i) + { + delete [] v[i]->allTouches; + delete v[i]; + } + } + for (iter = touchPool2_.begin(); iter != touchPool2_.end(); ++iter) + { + const std::vector &v = iter->second; + for (size_t i = 0; i < v.size(); ++i) + { + delete [] v[i]->allTouches; + delete v[i]; + } + } + pthread_mutex_unlock(&touchPoolMutex_); + + pthread_mutex_destroy(&touchPoolMutex_); + } + + static void posttick_s(int type, void *event, void *udata) + { + if (type == GEVENT_POST_TICK_EVENT) + static_cast(udata)->posttick(); + } + + void posttick() + { + for (size_t i = 0; i < mousePool2_.size(); ++i) + mousePool1_.push_back(mousePool2_[i]); + mousePool2_.clear(); + + for (size_t i = 0; i < keyPool2_.size(); ++i) + keyPool1_.push_back(keyPool2_[i]); + keyPool2_.clear(); + + + pthread_mutex_lock(&touchPoolMutex_); + std::map >::iterator iter; + for (iter = touchPool2_.begin(); iter != touchPool2_.end(); ++iter) + { + const std::vector &v = iter->second; + for (size_t i = 0; i < v.size(); ++i) + touchPool1_[iter->first].push_back(v[i]); + } + touchPool2_.clear(); + pthread_mutex_unlock(&touchPoolMutex_); + } + + void mouseDown(int x, int y, int button) + { + ginput_MouseEvent *mouseEvent = newMouseEvent(x, y, button); + + ginput_TouchEvent *touchEvent = NULL; + if (isMouseToTouchEnabled_) + { + touchEvent = newTouchEvent(1); + touchEvent->touch.x = x; + touchEvent->touch.y = y; + touchEvent->touch.id = 0; + touchEvent->allTouches[0].x = x; + touchEvent->allTouches[0].y = y; + touchEvent->allTouches[0].id = 0; + } + + if (mouseTouchOrder_ == 0) + { + gevent_EnqueueEvent(gid_, callback_s, GINPUT_MOUSE_DOWN_EVENT, mouseEvent, 0, this); + deleteMouseEvent(mouseEvent); + if (touchEvent) + { + gevent_EnqueueEvent(gid_, callback_s, GINPUT_TOUCH_BEGIN_EVENT, touchEvent, 0, this); + deleteTouchEvent(touchEvent); + } + + } + else + { + if (touchEvent) + { + gevent_EnqueueEvent(gid_, callback_s, GINPUT_TOUCH_BEGIN_EVENT, touchEvent, 0, this); + deleteTouchEvent(touchEvent); + } + gevent_EnqueueEvent(gid_, callback_s, GINPUT_MOUSE_DOWN_EVENT, mouseEvent, 0, this); + deleteMouseEvent(mouseEvent); + } + } + + void mouseMove(int x, int y) + { + ginput_MouseEvent *mouseEvent = newMouseEvent(x, y, GINPUT_NO_BUTTON); + + ginput_TouchEvent *touchEvent = NULL; + if (isMouseToTouchEnabled_) + { + touchEvent = newTouchEvent(1); + touchEvent->touch.x = x; + touchEvent->touch.y = y; + touchEvent->touch.id = 0; + touchEvent->allTouches[0].x = x; + touchEvent->allTouches[0].y = y; + touchEvent->allTouches[0].id = 0; + } + + if (mouseTouchOrder_ == 0) + { + gevent_EnqueueEvent(gid_, callback_s, GINPUT_MOUSE_MOVE_EVENT, mouseEvent, 0, this); + deleteMouseEvent(mouseEvent); + if (touchEvent) + { + gevent_EnqueueEvent(gid_, callback_s, GINPUT_TOUCH_MOVE_EVENT, touchEvent, 0, this); + deleteTouchEvent(touchEvent); + } + + } + else + { + if (touchEvent) + { + gevent_EnqueueEvent(gid_, callback_s, GINPUT_TOUCH_MOVE_EVENT, touchEvent, 0, this); + deleteTouchEvent(touchEvent); + } + gevent_EnqueueEvent(gid_, callback_s, GINPUT_MOUSE_MOVE_EVENT, mouseEvent, 0, this); + deleteMouseEvent(mouseEvent); + } + } + + void mouseUp(int x, int y, int button) + { + ginput_MouseEvent *mouseEvent = newMouseEvent(x, y, button); + + ginput_TouchEvent *touchEvent = NULL; + if (isMouseToTouchEnabled_) + { + touchEvent = newTouchEvent(1); + touchEvent->touch.x = x; + touchEvent->touch.y = y; + touchEvent->touch.id = 0; + touchEvent->allTouches[0].x = x; + touchEvent->allTouches[0].y = y; + touchEvent->allTouches[0].id = 0; + } + + if (mouseTouchOrder_ == 0) + { + gevent_EnqueueEvent(gid_, callback_s, GINPUT_MOUSE_UP_EVENT, mouseEvent, 0, this); + deleteMouseEvent(mouseEvent); + if (touchEvent) + { + gevent_EnqueueEvent(gid_, callback_s, GINPUT_TOUCH_END_EVENT, touchEvent, 0, this); + deleteTouchEvent(touchEvent); + } + + } + else + { + if (touchEvent) + { + gevent_EnqueueEvent(gid_, callback_s, GINPUT_TOUCH_END_EVENT, touchEvent, 0, this); + deleteTouchEvent(touchEvent); + } + gevent_EnqueueEvent(gid_, callback_s, GINPUT_MOUSE_UP_EVENT, mouseEvent, 0, this); + deleteMouseEvent(mouseEvent); + } + } + + void keyDown(int keyCode) + { + keyCode = convertKeyCode(keyCode); + if (keyCode == 0) + return; + + ginput_KeyEvent *event = newKeyEvent(keyCode); + gevent_EnqueueEvent(gid_, callback_s, GINPUT_KEY_DOWN_EVENT, event, 0, this); + deleteKeyEvent(event); + } + + void keyUp(int keyCode) + { + keyCode = convertKeyCode(keyCode); + if (keyCode == 0) + return; + + ginput_KeyEvent *event = newKeyEvent(keyCode); + gevent_EnqueueEvent(gid_, callback_s, GINPUT_KEY_UP_EVENT, event, 0, this); + deleteKeyEvent(event); + } + + void setMouseToTouchEnabled(int enabled) + { + isMouseToTouchEnabled_ = enabled; + } + + void setTouchToMouseEnabled(int enabled) + { + isTouchToMouseEnabled_ = enabled; + } + + void setMouseTouchOrder(int order) + { + mouseTouchOrder_ = order; + } + +private: + ginput_MouseEvent *newMouseEvent(int x, int y, int button) + { + ginput_MouseEvent *event; + + if (mousePool1_.empty()) + { + event = new ginput_MouseEvent; + } + else + { + event = mousePool1_.back(); + mousePool1_.pop_back(); + } + + event->x = x; + event->y = y; + event->button = button; + + return event; + } + + void deleteMouseEvent(ginput_MouseEvent *event) + { + mousePool2_.push_back(event); + } + + ginput_KeyEvent *newKeyEvent(int keyCode) + { + ginput_KeyEvent *event; + + if (keyPool1_.empty()) + { + event = new ginput_KeyEvent; + } + else + { + event = keyPool1_.back(); + keyPool1_.pop_back(); + } + + event->keyCode = keyCode; + + return event; + } + + void deleteKeyEvent(ginput_KeyEvent *event) + { + keyPool2_.push_back(event); + } + + int convertKeyCode(int keyCode) + { + std::map::const_iterator iter = keyMap_.find(keyCode); + + if (iter == keyMap_.end()) + return 0; + + return iter->second; + } + + ginput_TouchEvent *newTouchEvent(size_t allTouchesCount) + { + pthread_mutex_lock(&touchPoolMutex_); + std::vector &pool = touchPool1_[allTouchesCount]; + + ginput_TouchEvent *event; + + if (pool.empty()) + { + event = new ginput_TouchEvent; + event->allTouches = new ginput_Touch[allTouchesCount]; + } + else + { + event = pool.back(); + pool.pop_back(); + } + pthread_mutex_unlock(&touchPoolMutex_); + + event->allTouchesCount = allTouchesCount; + + return event; + } + + void deleteTouchEvent(ginput_TouchEvent *event) + { + pthread_mutex_lock(&touchPoolMutex_); + touchPool2_[event->allTouchesCount].push_back(event); + pthread_mutex_unlock(&touchPoolMutex_); + } + +private: + std::vector mousePool1_; + std::vector mousePool2_; + std::vector keyPool1_; + std::vector keyPool2_; + std::map > touchPool1_; + std::map > touchPool2_; + + std::map keyMap_; + + pthread_mutex_t touchPoolMutex_; + + int isMouseToTouchEnabled_; + int isTouchToMouseEnabled_; + int mouseTouchOrder_; + +public: + g_id addCallback(gevent_Callback callback, void *udata) + { + return callbackList_.addCallback(callback, udata); + } + + void removeCallback(gevent_Callback callback, void *udata) + { + callbackList_.removeCallback(callback, udata); + } + + void removeCallbackWithGid(g_id gid) + { + callbackList_.removeCallbackWithGid(gid); + } + + static void callback_s(int type, void *event, void *udata) + { + static_cast(udata)->callbackList_.dispatchEvent(type, event); + } + +private: + gevent_CallbackList callbackList_; + g_id gid_; +}; + +} + +using namespace ginput; + +static InputManager *s_manager = NULL; + +extern "C" { + +void ginput_init() +{ + s_manager = new InputManager; +} + +void ginput_cleanup() +{ + delete s_manager; + s_manager = NULL; +} + +int ginput_isAccelerometerAvailable() +{ + return 0; +} + +void ginput_startAccelerometer() +{ + +} + +void ginput_stopAccelerometer() +{ + +} + +void ginput_getAcceleration(double *x, double *y, double *z) +{ + if (x) + *x = 0; + if (y) + *y = 0; + if (z) + *z = 0; +} + +int ginput_isGyroscopeAvailable() +{ + return 0; +} + +void ginput_startGyroscope() +{ + +} + +void ginput_stopGyroscope() +{ + +} + +void ginput_getGyroscopeRotationRate(double *x, double *y, double *z) +{ + if (x) + *x = 0; + if (y) + *y = 0; + if (z) + *z = 0; +} + +void ginputp_mouseDown(int x, int y, int button) +{ + if (s_manager) + s_manager->mouseDown(x, y, button); +} + +void ginputp_mouseMove(int x, int y) +{ + if (s_manager) + s_manager->mouseMove(x, y); +} + +void ginputp_mouseUp(int x, int y, int button) +{ + if (s_manager) + s_manager->mouseUp(x, y, button); +} + +void ginputp_keyDown(int keyCode) +{ + if (s_manager) + s_manager->keyDown(keyCode); +} + +void ginputp_keyUp(int keyCode) +{ + if (s_manager) + s_manager->keyUp(keyCode); +} + +void ginput_setMouseToTouchEnabled(int enabled) +{ + s_manager->setMouseToTouchEnabled(enabled); +} + +void ginput_setTouchToMouseEnabled(int enabled) +{ + s_manager->setTouchToMouseEnabled(enabled); +} + +void ginput_setMouseTouchOrder(int order) +{ + s_manager->setMouseTouchOrder(order); +} + +g_id ginput_addCallback(gevent_Callback callback, void *udata) +{ + return s_manager->addCallback(callback, udata); +} + +void ginput_removeCallback(gevent_Callback callback, void *udata) +{ + s_manager->removeCallback(callback, udata); +} + +void ginput_removeCallbackWithGid(g_id gid) +{ + s_manager->removeCallbackWithGid(gid); +} + +} diff --git a/libgid/src/winrt/gui-winrt.cpp b/libgid/src/winrt/gui-winrt.cpp new file mode 100644 index 000000000..3d71f331b --- /dev/null +++ b/libgid/src/winrt/gui-winrt.cpp @@ -0,0 +1,96 @@ +#include +#include + +extern "C" { + +G_API void gui_init() +{ + // s_manager = new UIManager; +} + +G_API void gui_cleanup() +{ + // delete s_manager; + // s_manager = NULL; +} + +G_API g_id gui_createAlertDialog(const char *title, + const char *message, + const char *cancelButton, + const char *button1, + const char *button2, + gevent_Callback callback, + void *udata) +{ + // return s_manager->createAlertDialog(title, message, cancelButton, button1, button2, callback, udata); + return 0; +} + +G_API g_id gui_createTextInputDialog(const char *title, + const char *message, + const char *text, + const char *cancelButton, + const char *button1, + const char *button2, + gevent_Callback callback, + void *udata) +{ + // return s_manager->createTextInputDialog(title, message, text, cancelButton, button1, button2, callback, udata); + return 0; +} + +G_API void gui_show(g_id gid) +{ + // s_manager->show(gid); +} + +G_API void gui_hide(g_id gid) +{ + // s_manager->hide(gid); +} + +G_API void gui_delete(g_id gid) +{ + // s_manager->deleteWidget(gid); +} + +G_API int gui_isVisible(g_id gid) +{ + // return s_manager->isVisible(gid); + return 0; +} + +G_API void gui_setText(g_id gid, const char* text) +{ + // s_manager->setText(gid, text); +} + +G_API const char *gui_getText(g_id gid) +{ + // return s_manager->getText(gid); + return "gui_getText stub"; +} + +G_API void gui_setInputType(g_id gid, int inputType) +{ + // s_manager->setInputType(gid, inputType); +} + +G_API int gui_getInputType(g_id gid) +{ + // return s_manager->getInputType(gid); + return 0; +} + +G_API void gui_setSecureInput(g_id gid, int secureInput) +{ + // s_manager->setSecureInput(gid, secureInput); +} + +G_API int gui_isSecureInput(g_id gid) +{ + // return s_manager->isSecureInput(gid); + return 0; +} + +} diff --git a/libgid/src/winrt/wave.h b/libgid/src/winrt/wave.h new file mode 100644 index 000000000..f63b55115 --- /dev/null +++ b/libgid/src/winrt/wave.h @@ -0,0 +1,220 @@ +#ifndef WAVE_H +#define WAVE_H + +#include +#include +#include + +// The Wave class contains all information needed about a buffer including WAVEFORMATEX (bits per second, channels) +// and XAUDIO2_BUFFER (the actual XAUDIO2 buffer): essentially just a pointer to the raw data in memory (duplicated as m_waveData) +// The WAVEFORMATEX is used when createing a Source Voice. The XAUDIO2_BUFFER is used when submitting a buffer to the voice +// To play WAV files, we use Create to get all info then create a source voice and submit a buffer immediately so using all info +// To play MP3 files, we use Create but ignore the WAVEFORMATEX stuff. Only the XAUDIO2_BUFFER info is used. +// Also has a load method to load a WAV file off disk but this is not used in Gideros. + +class Wave +{ +private: + WAVEFORMATEX m_wf; + XAUDIO2_BUFFER m_xa; + BYTE* m_waveData; + int m_capacity; +public: + Wave(const char* szFile = NULL) : m_waveData(NULL) + { + ZeroMemory(&m_wf, sizeof(m_wf)); + ZeroMemory(&m_xa, sizeof(m_xa)); + + load(szFile); + } + + Wave(const Wave& c) : m_waveData(NULL) + { + m_wf = c.m_wf; + m_xa = c.m_xa; + if(c.m_waveData) + { + m_waveData = new BYTE[m_xa.AudioBytes]; + memcpy( m_waveData, c.m_waveData, m_xa.AudioBytes ); + m_xa.pAudioData = m_waveData; + } + } + + ~Wave() + { + if(m_waveData) + delete [] m_waveData; + + m_waveData = NULL; + m_xa.pAudioData = NULL; + } + + void Destroy() + { + if (m_waveData) + delete [] m_waveData; + m_waveData=NULL; + } + + void Create(const void *data, int numChannels, int sampleRate, int bitsPerSample, int numSamples, int size=0) + { + m_wf.wFormatTag = WAVE_FORMAT_PCM; + m_wf.nChannels = numChannels; + m_wf.nSamplesPerSec = sampleRate; + m_wf.nAvgBytesPerSec = numChannels * sampleRate * bitsPerSample / 8; + m_wf.nBlockAlign = bitsPerSample * numChannels / 8; + m_wf.wBitsPerSample = bitsPerSample; + m_wf.cbSize = 0; + + int dsize; + if (size == 0) + dsize = numSamples * numChannels * (bitsPerSample / 8); + else + dsize = size; + + if (m_waveData == NULL){ // non-NULL means it is already allocated + m_waveData = new BYTE[dsize]; + m_xa.pAudioData = m_waveData; + m_capacity = dsize; + } + else { + assert(dsize <= m_capacity); + } + + memcpy(m_waveData, data, dsize); + m_xa.AudioBytes = dsize; + m_xa.PlayBegin = 0; + m_xa.PlayLength = 0; + m_xa.pContext = this; + } + + const XAUDIO2_BUFFER* xaBuffer() const + { + return &m_xa; + } + + const WAVEFORMATEX* wf() const + { + return &m_wf; + } + + bool load(const char* szFile) + { + if(szFile == NULL) + return false; + + std::ifstream inFile(szFile, std::ios::binary | std::ios::in); + if(inFile.bad()) + return false; + + DWORD dwChunkId = 0, dwFileSize = 0, dwChunkSize = 0, dwExtra = 0; + + //look for 'RIFF' chunk identifier + inFile.seekg(0, std::ios::beg); + inFile.read(reinterpret_cast(&dwChunkId), sizeof(dwChunkId)); + if(dwChunkId != 'FFIR') + { + inFile.close(); + return false; + } + inFile.seekg(4, std::ios::beg); //get file size + inFile.read(reinterpret_cast(&dwFileSize), sizeof(dwFileSize)); + if(dwFileSize <= 16) + { + inFile.close(); + return false; + } + inFile.seekg(8, std::ios::beg); //get file format + inFile.read(reinterpret_cast(&dwExtra), sizeof(dwExtra)); + if(dwExtra != 'EVAW') + { + inFile.close(); + return false; + } + + //look for 'fmt ' chunk id + bool bFilledFormat = false; + for(unsigned int i = 12; i < dwFileSize; ) + { + inFile.seekg(i, std::ios::beg); + inFile.read(reinterpret_cast(&dwChunkId), sizeof(dwChunkId)); + inFile.seekg(i + 4, std::ios::beg); + inFile.read(reinterpret_cast(&dwChunkSize), sizeof(dwChunkSize)); + if(dwChunkId == ' tmf') + { + //I don't know what I was thinking with the following code, but I + //never did solve it back 6 months, and didn't touch it since; oh well... :S + + //switch(dwChunkSize) + //{ + //case sizeof(WAVEFORMATEX): + // { + // inFile.seekg(i + 8, std::ios::beg); + // inFile.read(reinterpret_cast(&m_wf), sizeof(m_wf)); + // } + // break; + //case sizeof(WAVEFORMATEXTENSIBLE): + // { + // WAVEFORMATEXTENSIBLE wfe; + // inFile.seekg(i + 8, std::ios::beg); + // inFile.read(reinterpret_cast(&wfe), sizeof(wfe)); + // m_wf = wfe.Format; + // } + // break; + //default: + // inFile.close(); + // return; + //} + inFile.seekg(i + 8, std::ios::beg); + inFile.read(reinterpret_cast(&m_wf), sizeof(m_wf)); + bFilledFormat = true; + break; + } + dwChunkSize += 8; //add offsets of the chunk id, and chunk size data entries + dwChunkSize += 1; + dwChunkSize &= 0xfffffffe; //guarantees WORD padding alignment + i += dwChunkSize; + } + if(!bFilledFormat) + { + inFile.close(); + return false; + } + + //look for 'data' chunk id + bool bFilledData = false; + for(unsigned int i = 12; i < dwFileSize; ) + { + inFile.seekg(i, std::ios::beg); + inFile.read(reinterpret_cast(&dwChunkId), sizeof(dwChunkId)); + inFile.seekg(i + 4, std::ios::beg); + inFile.read(reinterpret_cast(&dwChunkSize), sizeof(dwChunkSize)); + if(dwChunkId == 'atad') + { + m_waveData = new BYTE[dwChunkSize]; + inFile.seekg(i + 8, std::ios::beg); + inFile.read(reinterpret_cast(m_waveData), dwChunkSize); + m_xa.AudioBytes = dwChunkSize; + m_xa.pAudioData = m_waveData; + m_xa.PlayBegin = 0; + m_xa.PlayLength = 0; + bFilledData = true; + break; + } + dwChunkSize += 8; //add offsets of the chunk id, and chunk size data entries + dwChunkSize += 1; + dwChunkSize &= 0xfffffffe; //guarantees WORD padding alignment + i += dwChunkSize; + } + if(!bFilledData) + { + inFile.close(); + return false; + } + + inFile.close(); + return true; + } +}; + +#endif diff --git a/libgvfs/libgvfswinrt/libgvfswinrt.sln b/libgvfs/libgvfswinrt/libgvfswinrt.sln new file mode 100644 index 000000000..fc1fc8b0a --- /dev/null +++ b/libgvfs/libgvfswinrt/libgvfswinrt.sln @@ -0,0 +1,60 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libgvfswinrt", "libgvfswinrt", "{59762D79-D485-48B2-9201-48EA580B4BFD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgvfswinrt.Shared", "libgvfswinrt\libgvfswinrt.Shared\libgvfswinrt.Shared.vcxitems", "{8C3B6EEF-51E1-4593-AF79-3EF50E1B1BCC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgvfswinrt.Windows", "libgvfswinrt\libgvfswinrt.Windows\libgvfswinrt.Windows.vcxproj", "{EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgvfswinrt.WindowsPhone", "libgvfswinrt\libgvfswinrt.WindowsPhone\libgvfswinrt.WindowsPhone.vcxproj", "{91C7AAA1-A5FF-4916-93C0-B2E8606B4502}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + libgvfswinrt\libgvfswinrt.Shared\libgvfswinrt.Shared.vcxitems*{91c7aaa1-a5ff-4916-93c0-b2e8606b4502}*SharedItemsImports = 4 + libgvfswinrt\libgvfswinrt.Shared\libgvfswinrt.Shared.vcxitems*{8c3b6eef-51e1-4593-af79-3ef50e1b1bcc}*SharedItemsImports = 9 + libgvfswinrt\libgvfswinrt.Shared\libgvfswinrt.Shared.vcxitems*{edfc73b9-ada1-4555-bee5-b82eaf8a1df7}*SharedItemsImports = 4 + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|ARM = Release|ARM + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Debug|ARM.ActiveCfg = Debug|ARM + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Debug|ARM.Build.0 = Debug|ARM + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Debug|Win32.ActiveCfg = Debug|Win32 + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Debug|Win32.Build.0 = Debug|Win32 + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Debug|x64.ActiveCfg = Debug|x64 + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Debug|x64.Build.0 = Debug|x64 + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Release|ARM.ActiveCfg = Release|ARM + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Release|ARM.Build.0 = Release|ARM + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Release|Win32.ActiveCfg = Release|Win32 + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Release|Win32.Build.0 = Release|Win32 + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Release|x64.ActiveCfg = Release|x64 + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7}.Release|x64.Build.0 = Release|x64 + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502}.Debug|ARM.ActiveCfg = Debug|ARM + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502}.Debug|ARM.Build.0 = Debug|ARM + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502}.Debug|Win32.ActiveCfg = Debug|Win32 + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502}.Debug|Win32.Build.0 = Debug|Win32 + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502}.Debug|x64.ActiveCfg = Debug|Win32 + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502}.Release|ARM.ActiveCfg = Release|ARM + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502}.Release|ARM.Build.0 = Release|ARM + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502}.Release|Win32.ActiveCfg = Release|Win32 + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502}.Release|Win32.Build.0 = Release|Win32 + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {8C3B6EEF-51E1-4593-AF79-3EF50E1B1BCC} = {59762D79-D485-48B2-9201-48EA580B4BFD} + {EDFC73B9-ADA1-4555-BEE5-B82EAF8A1DF7} = {59762D79-D485-48B2-9201-48EA580B4BFD} + {91C7AAA1-A5FF-4916-93C0-B2E8606B4502} = {59762D79-D485-48B2-9201-48EA580B4BFD} + EndGlobalSection +EndGlobal diff --git a/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Shared/libgvfswinrt.Shared.vcxitems b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Shared/libgvfswinrt.Shared.vcxitems new file mode 100644 index 000000000..2624aac64 --- /dev/null +++ b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Shared/libgvfswinrt.Shared.vcxitems @@ -0,0 +1,75 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {8c3b6eef-51e1-4593-af79-3ef50e1b1bcc} + libgvfswinrt + libgvfswinrt.Shared + 248F659F-DAC5-46E8-AC09-60EC9FC95053 + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Shared/libgvfswinrt.Shared.vcxitems.filters b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Shared/libgvfswinrt.Shared.vcxitems.filters new file mode 100644 index 000000000..b50af6159 --- /dev/null +++ b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Shared/libgvfswinrt.Shared.vcxitems.filters @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Windows/libgvfswinrt.Windows.vcxproj b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Windows/libgvfswinrt.Windows.vcxproj new file mode 100644 index 000000000..27c1d4da3 --- /dev/null +++ b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Windows/libgvfswinrt.Windows.vcxproj @@ -0,0 +1,195 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + {edfc73b9-ada1-4555-bee5-b82eaf8a1df7} + libgvfswinrt + en-US + 12.0 + true + Windows Store + 8.1 + CodeSharingStaticLibrary + + + + StaticLibrary + true + v120 + + + StaticLibrary + true + v120 + + + StaticLibrary + true + v120 + + + StaticLibrary + false + true + v120 + + + StaticLibrary + false + true + v120 + + + StaticLibrary + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + false + + + false + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgvfs\;c:\gideros_liberton\gideros\libgvfs\private;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + PTW32_STATIC_LIB;WINSTORE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgvfs\;c:\gideros_liberton\gideros\libgvfs\private;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;%(AdditionalIncludeDirectories) + PTW32_STATIC_LIB;WINSTORE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgvfs\;c:\gideros_liberton\gideros\libgvfs\private;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + PTW32_STATIC_LIB;WINSTORE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgvfs\;c:\gideros_liberton\gideros\libgvfs\private;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + PTW32_STATIC_LIB;WINSTORE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + Console + false + false + + + + + Use + false + true + + + Console + false + false + + + + + Use + false + true + + + Console + false + false + + + + + + \ No newline at end of file diff --git a/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Windows/libgvfswinrt.Windows.vcxproj.filters b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Windows/libgvfswinrt.Windows.vcxproj.filters new file mode 100644 index 000000000..a7761ab01 --- /dev/null +++ b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.Windows/libgvfswinrt.Windows.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + diff --git a/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.WindowsPhone/libgvfswinrt.WindowsPhone.vcxproj b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.WindowsPhone/libgvfswinrt.WindowsPhone.vcxproj new file mode 100644 index 000000000..4aa65c278 --- /dev/null +++ b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.WindowsPhone/libgvfswinrt.WindowsPhone.vcxproj @@ -0,0 +1,140 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Release + ARM + + + Release + Win32 + + + + {91c7aaa1-a5ff-4916-93c0-b2e8606b4502} + libgvfswinrt + en-US + 12.0 + true + Windows Phone + 8.1 + CodeSharingStaticLibrary + + + + StaticLibrary + true + v120_wp81 + + + StaticLibrary + true + v120_wp81 + + + StaticLibrary + false + true + v120_wp81 + + + StaticLibrary + false + true + v120_wp81 + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgvfs\;c:\gideros_liberton\gideros\libgvfs\private;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + PTW32_STATIC_LIB;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgvfs\;c:\gideros_liberton\gideros\libgvfs\private;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;%(AdditionalIncludeDirectories) + PTW32_STATIC_LIB;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgvfs\;c:\gideros_liberton\gideros\libgvfs\private;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + PTW32_STATIC_LIB;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgvfs\;c:\gideros_liberton\gideros\libgvfs\private;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + PTW32_STATIC_LIB;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + Console + false + false + + + + + + \ No newline at end of file diff --git a/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.WindowsPhone/libgvfswinrt.WindowsPhone.vcxproj.filters b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.WindowsPhone/libgvfswinrt.WindowsPhone.vcxproj.filters new file mode 100644 index 000000000..a7761ab01 --- /dev/null +++ b/libgvfs/libgvfswinrt/libgvfswinrt/libgvfswinrt.WindowsPhone/libgvfswinrt.WindowsPhone.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + diff --git a/libplatform/deviceinfo-winrt.cpp b/libplatform/deviceinfo-winrt.cpp new file mode 100644 index 000000000..b1e079306 --- /dev/null +++ b/libplatform/deviceinfo-winrt.cpp @@ -0,0 +1,11 @@ +#include +#include + +std::vector getDeviceInfo() +{ + std::vector result; + + result.push_back("WinRT"); + + return result; +} diff --git a/libplatform/locale-winrt.cpp b/libplatform/locale-winrt.cpp new file mode 100644 index 000000000..297e9d247 --- /dev/null +++ b/libplatform/locale-winrt.cpp @@ -0,0 +1,11 @@ +#include + +std::string getLocale() +{ + return "Gallifrey"; +} + +std::string getLanguage() +{ + return "en"; +} diff --git a/libplatform/openurl-winrt.cpp b/libplatform/openurl-winrt.cpp new file mode 100644 index 000000000..5e62707ec --- /dev/null +++ b/libplatform/openurl-winrt.cpp @@ -0,0 +1,9 @@ +void openUrl(const char* url) +{ + // put code here +} + +bool canOpenUrl(const char *url) +{ + return true; +} diff --git a/lua/luawinrt/luawinrt.sln b/lua/luawinrt/luawinrt.sln new file mode 100644 index 000000000..dae486b02 --- /dev/null +++ b/lua/luawinrt/luawinrt.sln @@ -0,0 +1,60 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "luawinrt", "luawinrt", "{AE8CDC17-3CD3-4003-BCD3-5A244AA6D2E3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "luawinrt.Shared", "luawinrt\luawinrt.Shared\luawinrt.Shared.vcxitems", "{212298A0-62C1-48CB-85C0-00D2AFD482CD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "luawinrt.Windows", "luawinrt\luawinrt.Windows\luawinrt.Windows.vcxproj", "{F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "luawinrt.WindowsPhone", "luawinrt\luawinrt.WindowsPhone\luawinrt.WindowsPhone.vcxproj", "{0466C708-60CA-45FA-9A51-569041204D31}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + luawinrt\luawinrt.Shared\luawinrt.Shared.vcxitems*{f3a7dfcc-506a-4800-9df7-beb0541b21f2}*SharedItemsImports = 4 + luawinrt\luawinrt.Shared\luawinrt.Shared.vcxitems*{0466c708-60ca-45fa-9a51-569041204d31}*SharedItemsImports = 4 + luawinrt\luawinrt.Shared\luawinrt.Shared.vcxitems*{212298a0-62c1-48cb-85c0-00d2afd482cd}*SharedItemsImports = 9 + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|ARM = Release|ARM + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Debug|ARM.ActiveCfg = Debug|ARM + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Debug|ARM.Build.0 = Debug|ARM + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Debug|Win32.ActiveCfg = Debug|Win32 + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Debug|Win32.Build.0 = Debug|Win32 + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Debug|x64.ActiveCfg = Debug|x64 + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Debug|x64.Build.0 = Debug|x64 + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Release|ARM.ActiveCfg = Release|ARM + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Release|ARM.Build.0 = Release|ARM + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Release|Win32.ActiveCfg = Release|Win32 + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Release|Win32.Build.0 = Release|Win32 + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Release|x64.ActiveCfg = Release|x64 + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2}.Release|x64.Build.0 = Release|x64 + {0466C708-60CA-45FA-9A51-569041204D31}.Debug|ARM.ActiveCfg = Debug|ARM + {0466C708-60CA-45FA-9A51-569041204D31}.Debug|ARM.Build.0 = Debug|ARM + {0466C708-60CA-45FA-9A51-569041204D31}.Debug|Win32.ActiveCfg = Debug|Win32 + {0466C708-60CA-45FA-9A51-569041204D31}.Debug|Win32.Build.0 = Debug|Win32 + {0466C708-60CA-45FA-9A51-569041204D31}.Debug|x64.ActiveCfg = Debug|Win32 + {0466C708-60CA-45FA-9A51-569041204D31}.Release|ARM.ActiveCfg = Release|ARM + {0466C708-60CA-45FA-9A51-569041204D31}.Release|ARM.Build.0 = Release|ARM + {0466C708-60CA-45FA-9A51-569041204D31}.Release|Win32.ActiveCfg = Release|Win32 + {0466C708-60CA-45FA-9A51-569041204D31}.Release|Win32.Build.0 = Release|Win32 + {0466C708-60CA-45FA-9A51-569041204D31}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {212298A0-62C1-48CB-85C0-00D2AFD482CD} = {AE8CDC17-3CD3-4003-BCD3-5A244AA6D2E3} + {F3A7DFCC-506A-4800-9DF7-BEB0541B21F2} = {AE8CDC17-3CD3-4003-BCD3-5A244AA6D2E3} + {0466C708-60CA-45FA-9A51-569041204D31} = {AE8CDC17-3CD3-4003-BCD3-5A244AA6D2E3} + EndGlobalSection +EndGlobal diff --git a/lua/luawinrt/luawinrt/luawinrt.Shared/luawinrt.Shared.vcxitems b/lua/luawinrt/luawinrt/luawinrt.Shared/luawinrt.Shared.vcxitems new file mode 100644 index 000000000..280365462 --- /dev/null +++ b/lua/luawinrt/luawinrt/luawinrt.Shared/luawinrt.Shared.vcxitems @@ -0,0 +1,22 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {212298a0-62c1-48cb-85c0-00d2afd482cd} + luawinrt + luawinrt.Shared + 248F659F-DAC5-46E8-AC09-60EC9FC95053 + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + + \ No newline at end of file diff --git a/lua/luawinrt/luawinrt/luawinrt.Shared/luawinrt.Shared.vcxitems.filters b/lua/luawinrt/luawinrt/luawinrt.Shared/luawinrt.Shared.vcxitems.filters new file mode 100644 index 000000000..2315efdb4 --- /dev/null +++ b/lua/luawinrt/luawinrt/luawinrt.Shared/luawinrt.Shared.vcxitems.filters @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lua/luawinrt/luawinrt/luawinrt.Windows/luawinrt.Windows.vcxproj b/lua/luawinrt/luawinrt/luawinrt.Windows/luawinrt.Windows.vcxproj new file mode 100644 index 000000000..ea57be1f4 --- /dev/null +++ b/lua/luawinrt/luawinrt/luawinrt.Windows/luawinrt.Windows.vcxproj @@ -0,0 +1,196 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + {f3a7dfcc-506a-4800-9df7-beb0541b21f2} + luawinrt + en-US + 12.0 + true + Windows Store + 8.1 + CodeSharingStaticLibrary + + + + StaticLibrary + true + v120 + + + StaticLibrary + true + v120 + + + StaticLibrary + true + v120 + + + StaticLibrary + false + true + v120 + + + StaticLibrary + false + true + v120 + + + StaticLibrary + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + false + + + false + + + + NotUsing + false + false + ..\..\..\src;..\..\..\..\libgvfs;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + WINSTORE;LUA_ANSI;LUA_COMPAT_ALL;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + WINSTORE;LUA_ANSI;LUA_COMPAT_ALL;_UNICODE;UNICODE;%(PreprocessorDefinitions) + true + ..\..\..\src;..\..\..\..\libgvfs;%(AdditionalIncludeDirectories) + + + Console + false + false + + + + + NotUsing + false + false + ..\..\..\src;..\..\..\..\libgvfs;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + WINSTORE;LUA_ANSI;LUA_COMPAT_ALL;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + ..\..\..\src;..\..\..\..\libgvfs;%(AdditionalIncludeDirectories) + WINSTORE;LUA_ANSI;LUA_COMPAT_ALL;%(PreprocessorDefinitions) + + + Console + false + false + + + + + Use + false + true + + + Console + false + false + + + + + Use + false + true + + + Console + false + false + + + + + + \ No newline at end of file diff --git a/lua/luawinrt/luawinrt/luawinrt.Windows/luawinrt.Windows.vcxproj.filters b/lua/luawinrt/luawinrt/luawinrt.Windows/luawinrt.Windows.vcxproj.filters new file mode 100644 index 000000000..a7761ab01 --- /dev/null +++ b/lua/luawinrt/luawinrt/luawinrt.Windows/luawinrt.Windows.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + diff --git a/lua/luawinrt/luawinrt/luawinrt.WindowsPhone/luawinrt.WindowsPhone.vcxproj b/lua/luawinrt/luawinrt/luawinrt.WindowsPhone/luawinrt.WindowsPhone.vcxproj new file mode 100644 index 000000000..27a7b8714 --- /dev/null +++ b/lua/luawinrt/luawinrt/luawinrt.WindowsPhone/luawinrt.WindowsPhone.vcxproj @@ -0,0 +1,141 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Release + ARM + + + Release + Win32 + + + + {0466c708-60ca-45fa-9a51-569041204d31} + luawinrt + en-US + 12.0 + true + Windows Phone + 8.1 + CodeSharingStaticLibrary + + + + StaticLibrary + true + v120_wp81 + + + StaticLibrary + true + v120_wp81 + + + StaticLibrary + false + true + v120_wp81 + + + StaticLibrary + false + true + v120_wp81 + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + NotUsing + false + false + ..\..\..\src;..\..\..\..\libgvfs;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + WINSTORE;LUA_COMPAT_ALL;LUA_ANSI;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + WINSTORE;LUA_ANSI;LUA_COMPAT_ALL;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + true + ..\..\..\src;..\..\..\..\libgvfs;%(AdditionalIncludeDirectories) + + + Console + false + false + + + + + NotUsing + false + false + ..\..\..\src;..\..\..\..\libgvfs;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + WINSTORE;LUA_ANSI;LUA_COMPAT_ALL;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + ..\..\..\src;..\..\..\..\libgvfs;%(AdditionalIncludeDirectories) + WINSTORE;LUA_ANSI;LUA_COMPAT_ALL;%(PreprocessorDefinitions) + + + Console + false + false + + + + + + \ No newline at end of file diff --git a/lua/luawinrt/luawinrt/luawinrt.WindowsPhone/luawinrt.WindowsPhone.vcxproj.filters b/lua/luawinrt/luawinrt/luawinrt.WindowsPhone/luawinrt.WindowsPhone.vcxproj.filters new file mode 100644 index 000000000..a7761ab01 --- /dev/null +++ b/lua/luawinrt/luawinrt/luawinrt.WindowsPhone/luawinrt.WindowsPhone.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + diff --git a/winrt/PixelShader.cso b/winrt/PixelShader.cso new file mode 100644 index 000000000..4286b277d Binary files /dev/null and b/winrt/PixelShader.cso differ diff --git a/winrt/VertexShader.cso b/winrt/VertexShader.cso new file mode 100644 index 000000000..00c0741d8 Binary files /dev/null and b/winrt/VertexShader.cso differ diff --git a/winrt/compileshaders.bat b/winrt/compileshaders.bat new file mode 100644 index 000000000..145f59ed1 --- /dev/null +++ b/winrt/compileshaders.bat @@ -0,0 +1,2 @@ +fxc /T vs_4_0_level_9_3 /E VShader /Fo VertexShader.cso texture.hlsl +fxc /T ps_4_0_level_9_3 /E PShader /Fo PixelShader.cso texture.hlsl diff --git a/winrt/dxcompat.cpp b/winrt/dxcompat.cpp new file mode 100644 index 000000000..4f1173a6a --- /dev/null +++ b/winrt/dxcompat.cpp @@ -0,0 +1,986 @@ +#include +//#include +#include +#include +#include +#include +//#include "globals.h" +#include "dxcompat.hpp" +//#include "util.h" + +// This is needed for WinRT apps +#ifdef WINSTORE +#include +#include "pch.h" +using namespace Microsoft::WRL; +#endif + +using namespace std; + +class Mat4 +{ +public: + float M[4][4]; + + Mat4() + { + int i,j; + for (i=0;i<4;i++) + for (j=0;j<4;j++) + M[i][j]=0; + } + + void loadIdentity() + { + int i,j; + for (i=0;i<4;i++){ + for (j=0;j<4;j++){ + if (i==j) + M[i][j]=1; + else + M[i][j]=0; + } + } + } + + void set(const GLfloat *m) + { + int i, j,ind; + + ind = 0; + for (j = 0; j < 4; j++){ + for (i = 0; i < 4; i++){ + M[i][j] = m[ind]; + ind++; + } + } + } + + void mulrightby(Mat4 A) + { + float B[4][4]; + int i,j,k; + + // B=M*A + for (i=0;i<4;i++){ + for (j=0;j<4;j++){ + B[i][j]=0; + for (k=0;k<4;k++){ + B[i][j]+=M[i][k]*A.M[k][j]; + } + } + } + + // M=B + for (i=0;i<4;i++) + for (j=0;j<4;j++) + M[i][j]=B[i][j]; + } + + void mulleftby(Mat4 A) + { + float B[4][4]; + int i,j,k; + + // B=A*M + for (i=0;i<4;i++){ + for (j=0;j<4;j++){ + B[i][j]=0; + for (k=0;k<4;k++){ + B[i][j]+=A.M[i][k]*M[k][j]; + } + } + } + + // M=B + for (i=0;i<4;i++) + for (j=0;j<4;j++) + M[i][j]=B[i][j]; + } +}; + +// ###################################################################### + +// The following parameters must be set by main program before we draw anything +// For Windows Store and WP8, we use 11.1 objects for g_dev, g_devcon, g_swapchain + +#ifdef WINSTORE +ComPtr g_dev; // the pointer to our Direct3D device interface (11.1) +ComPtr g_devcon; // the pointer to our Direct3D device context (11.1) +ComPtr g_swapchain; // the pointer to the swap chain interface (11.1) +ComPtr dxgiDevice; +#else +ID3D11Device *g_dev; // the pointer to our Direct3D device interface +ID3D11DeviceContext *g_devcon; // the pointer to our Direct3D device context +IDXGISwapChain *g_swapchain; // the pointer to the swap chain interface +#endif + +ID3D11RenderTargetView *g_backbuffer; +ID3D11InputLayout *g_pLayout; +ID3D11VertexShader *g_pVS; +ID3D11PixelShader *g_pPS; +ID3D11Buffer *g_pVBuffer; // Vertex buffer: we put our geometry here +ID3D11Buffer *g_CB; // Constant buffer: pass settings like whether to use textures or not +vector g_RSV; // list of textures. +vector g_RSVused; // true if texture index number has been assigned + +struct Backcol +{ + float red; + float green; + float blue; + float alpha; +}; + +vector g_renderTarget; +vector g_renderTargetused; +vector g_renderTargetCol; + +ID3D11SamplerState *g_samplerLinear; +ID3D11BlendState *g_pBlendState; + +bool dxcompat_force_lines=false; +bool dxcompat_zrange01 = true; + +// "OpenGL" state machine +static float g_r=1, g_g=1, g_b=1, g_a=1; +static bool g_color_array=false, g_tex_array=false; +static bool g_modelview=true; +static Mat4 modelmat,projectionmat; +static GLuint g_curr_texind, g_curr_framebuffer=0; +vector modelStack,projectionStack; + +float backcol[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + +static float *g_colors; +static float *g_vertices; +static float *g_tex_coord; + +void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) +{ + D3D11_VIEWPORT viewport; + ZeroMemory(&viewport,sizeof(D3D11_VIEWPORT)); + + viewport.TopLeftX=x; + viewport.TopLeftY=y; + viewport.Width=width; + viewport.Height=height; + g_devcon->RSSetViewports(1,&viewport); +} + +void glClear(GLbitfield mask){ + + if (mask != GL_COLOR_BUFFER_BIT) return; // no depth/stencil buffer yet + + if (g_curr_framebuffer == 0){ + g_devcon->ClearRenderTargetView(g_backbuffer, backcol); + } + else{ + float col[4]; + col[0] = g_renderTargetCol[g_curr_framebuffer].red; + col[1] = g_renderTargetCol[g_curr_framebuffer].green; + col[2] = g_renderTargetCol[g_curr_framebuffer].blue; + col[3] = g_renderTargetCol[g_curr_framebuffer].alpha; + + g_devcon->ClearRenderTargetView(g_renderTarget[g_curr_framebuffer], col); + } +} + +void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + if (g_curr_framebuffer == 0){ + backcol[0] = red; + backcol[1] = green; + backcol[2] = blue; + backcol[3] = alpha; + } + else { + g_renderTargetCol[g_curr_framebuffer].red = red; + g_renderTargetCol[g_curr_framebuffer].green = green; + g_renderTargetCol[g_curr_framebuffer].blue = blue; + g_renderTargetCol[g_curr_framebuffer].alpha = alpha; + } +} + +void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val) +{ + Mat4 O; + + O.loadIdentity(); + O.M[0][0] = 2.0 / (right - left); + O.M[1][1] = 2.0 / (top - bottom); + + O.M[0][3] = -(right + left) / (right - left); + O.M[1][3] = -(top + bottom) / (top - bottom); + + if (dxcompat_zrange01){ + O.M[2][2] = 1.0 /(far_val - near_val); + O.M[2][3] = -near_val / (far_val - near_val); + } + else { + O.M[2][2] = 2.0 / (far_val - near_val); // -2.0 used in OpenGL documentation but can't be right! + O.M[2][3] = -(far_val + near_val) / (far_val - near_val); + } + + if (g_modelview) + modelmat.mulrightby(O); + else + projectionmat.mulrightby(O); +} + +void glLoadIdentity() +{ + if (g_modelview){ + modelmat.loadIdentity(); + } + else { + projectionmat.loadIdentity(); + } +} + +void glMatrixMode(GLenum mode) +{ + if (mode==GL_MODELVIEW) // normal drawing matrix + g_modelview=true; + else + g_modelview=false; // matrix to use orthographic transform on +} + +void glTranslatef(GLfloat x,GLfloat y, GLfloat z) +{ + Mat4 T; + + T.loadIdentity(); + + T.M[0][3]=x; + T.M[1][3]=y; + T.M[2][3]=z; + + if (g_modelview) + modelmat.mulrightby(T); + else + projectionmat.mulrightby(T); +} + +void glRotatef(GLfloat angle,GLfloat x,GLfloat y, GLfloat z) +{ + Mat4 R; + const float pi=3.141592654; + + float ca=cos(angle*pi/180); + float sa=sin(angle*pi/180); + + R.loadIdentity(); + + R.M[0][0]=ca; R.M[0][1]=-sa; + R.M[1][0]=sa; R.M[1][1]= ca; + + if (g_modelview) + modelmat.mulrightby(R); + else + projectionmat.mulrightby(R); +} + +void glScalef(GLfloat x,GLfloat y, GLfloat z) +{ + Mat4 S; + + S.loadIdentity(); + S.M[0][0]=x; + S.M[1][1]=y; + + if (g_modelview) + modelmat.mulrightby(S); + else + projectionmat.mulrightby(S); +} + +void glPushMatrix() +{ + if (g_modelview) + modelStack.push_back(modelmat); + else + projectionStack.push_back(projectionmat); +} + +void glPopMatrix() +{ + if (g_modelview){ + modelmat=modelStack.back(); + modelStack.pop_back(); + } else { + projectionmat=modelStack.back(); + projectionStack.pop_back(); + } +} + +// GenTextures adds new texture RSV to list g_RSV and sets to NULL +// also sets g_RSVused to true so that the same index will not be reissued +// does not actually allocate any memory. Done in glTexImage2D +// glGenTextures(2,myarray); +// g_RSV: +// 0 NULL true +// 1 NULL true (myarray[0],myarray[1]=0,1) +// glTexImage2D (1=current) +// 0 = NULL true +// 1 = 0x111 true +// glDeleteTextures(1,&mytexind); mytexind=0 +// 0 = NULL false// deleted << CAN BE REUSED by another glGenTextures +// 1 = 0x111 true // keeps same number + +void glGenTextures(GLsizei n, GLuint *texinds) +{ + int i,j; // i: index in texinds, j: index in g_RSV + + i=0; + for (j=0;jRelease(); + g_RSV[mytexind] = NULL; + g_RSVused[mytexind] = false; + } + } + + // remove end of list if full of unused slots + count=0; + for (i=g_RSV.size()-1;i>=0;i--){ + if (g_RSVused[i]) break; + count++; + } + + for (i = 0; i < count; i++){ + g_RSV.pop_back(); + g_RSVused.pop_back(); + } +} + +void glBindTexture(GLenum target, GLuint texind) +{ + + if (target != GL_TEXTURE_2D){ + OutputDebugStringA("glBindTexture: wrong target\n"); + exit(1); + } + + if (texind >= g_RSV.size()) return; + if (!g_RSVused[texind]) return; + + g_curr_texind=texind; + +// if (g_RSV[texind]!=NULL) + g_devcon->PSSetShaderResources(0,1,&g_RSV[texind]); +} + +// bind current texture g_curr_texind +void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) +{ + + ID3D11Texture2D *tex; + D3D11_TEXTURE2D_DESC tdesc; + D3D11_SUBRESOURCE_DATA tbsd; + + char *pixels1,*pixels2; + int i; + + if (target != GL_TEXTURE_2D){ + OutputDebugStringA("glTexImage2D: unknown target\n"); + exit(1); + } + + if (level != 0) OutputDebugStringA("glTexImage2D: level not zero\n"); + + if (border != 0) { + OutputDebugStringA("glTexImage2D: border must be zero\n"); + exit(1); + } + + if (format != internalFormat) OutputDebugStringA("glTexImage2D: Warning format, internalFormat different\n"); + + if (type != GL_UNSIGNED_BYTE) OutputDebugStringA("glTexImage2D: unexpected pixel data type\n"); + + pixels1 = (char *)pixels; + +// for (int i = 0; i < 400;i++) +// pixels1[i] = 255; + + tbsd.SysMemPitch = width * 4; + tbsd.SysMemSlicePitch = width*height * 4; // not needed + + tdesc.Width = width; + tdesc.Height = height; + tdesc.MipLevels = 1; + tdesc.ArraySize = 1; + tdesc.SampleDesc.Count = 1; + tdesc.SampleDesc.Quality = 0; + tdesc.Usage = D3D11_USAGE_DEFAULT; + tdesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE; + tdesc.CPUAccessFlags = 0; + tdesc.MiscFlags = 0; + tdesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + + if (internalFormat==GL_RGBA){ + tbsd.pSysMem = pixels; + } + else if (internalFormat==GL_RGB){ + pixels2 = (char *)malloc(width*height * 4); + for (i = 0; i < width*height; i++){ + pixels2[i * 4] = pixels1[i * 3]; + pixels2[i * 4+1] = pixels1[i * 3+1]; + pixels2[i * 4+2] = pixels1[i * 3+2]; + pixels2[i * 4+3] = 255; + } + tbsd.pSysMem = pixels2; + } + else { + OutputDebugString(L"glTexImage2D: unknown internal format"); + exit(1); + } + + g_dev->CreateTexture2D(&tdesc,&tbsd,&tex); + g_dev->CreateShaderResourceView(tex,NULL,&g_RSV[g_curr_texind]); + tex->Release(); // We only need the resource view + + g_devcon->PSSetShaderResources(0,1,&g_RSV[g_curr_texind]); + + if (internalFormat == GL_RGB) free(pixels2); +} + +void glTexParameterf(GLenum target, GLenum pname, GLfloat param ) +{ +} + +void glPixelStorei(GLenum pname, GLint param) +{ +} + +void glColor4ub(GLubyte r,GLubyte g, GLubyte b, GLubyte a) +{ + g_r=r/255.0; + g_g=g/255.0; + g_b=b/255.0; + g_a=a/255.0; +} + +//###################################################################### +void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) +{ + g_r=r; + g_g=g; + g_b=b; + g_a=a; +} + +//###################################################################### +void glEnableClientState(GLenum type) +{ + struct const_buffer mycb; + + if (type==GL_COLOR_ARRAY) + g_color_array=true; + else if (type==GL_TEXTURE_COORD_ARRAY){ + g_tex_array=true; + mycb.use_tex=1; + g_devcon->UpdateSubresource(g_CB,0,NULL,&mycb,0,0); + g_devcon->PSSetConstantBuffers(0,1,&g_CB); + } +} + +//###################################################################### +void glDisableClientState(GLenum type) +{ + + struct const_buffer mycb; + + if (type==GL_COLOR_ARRAY) + g_color_array=false; + else if (type==GL_TEXTURE_COORD_ARRAY){ + g_tex_array=false; + mycb.use_tex=0; + g_devcon->UpdateSubresource(g_CB,0,NULL,&mycb,0,0); + g_devcon->PSSetConstantBuffers(0,1,&g_CB); + } +} + +void glEnable(GLenum type) +{ +} + +void glDisable(GLenum type) +{ +} + +//###################################################################### +void glDrawArrays(GLenum pattern, GLint zero, GLsizei npoints) +{ + + // temporary: loop over npoint vertices and transform manually using + // matrix multiplication + + int i,j,k; + float x,y,xp,yp,zp; + + static VERTEX DxVertices[256]; + D3D11_MAPPED_SUBRESOURCE ms; + + float mat[4][4]; + + for (i=0;i<4;i++){ + for (j=0;j<4;j++){ + mat[i][j]=0; + for (k=0;k<4;k++){ + mat[i][j]+=projectionmat.M[i][k]*modelmat.M[k][j]; + } + } + } + + for (i=0;iMap(g_pVBuffer, NULL, D3D11_MAP_WRITE_DISCARD, NULL, &ms); // map the buffer + memcpy(ms.pData, DxVertices, sizeof(VERTEX)*npoints); // copy the data + g_devcon->Unmap(g_pVBuffer, NULL); // unmap the buffer + + UINT stride=sizeof(VERTEX); + UINT offset=0; + + g_devcon->IASetVertexBuffers(0,1,&g_pVBuffer,&stride, &offset); + + if (dxcompat_force_lines) + pattern = GL_LINE_STRIP; + + if (pattern == GL_POINTS) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); + else if (pattern == GL_TRIANGLE_STRIP) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + else if (pattern == GL_TRIANGLES) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + else if (pattern == GL_LINE_STRIP) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP); + else if (pattern == GL_LINE_LOOP) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP); + else if (pattern==GL_LINES) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST); + else { + OutputDebugStringA("glDrawArrays unknown pattern\n"); + exit(1); + } + + g_devcon->Draw(npoints,0); +} + +void glLineWidth(GLfloat width) +{ +} + +// ================ NEW ========================= + +void glBlendFunc(GLenum sfactor, GLenum dfactor) +{ + +} + +void glLoadMatrixf(const GLfloat *m) +{ + if (g_modelview) + modelmat.set(m); + else + projectionmat.set(m); +} + +void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +{ + + if (size != 4){ + OutputDebugStringA("glColorPointer: size must be 4\n"); + exit(1); + } + + if (type == GL_FLOAT) + g_colors = (GLfloat*)ptr; + else { + OutputDebugString(L"glColorPointer: illegal type\n"); + exit(1); + } + + if (stride != 0) OutputDebugStringA("glColorPointer. Stride should be zero\n"); +} + +void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +{ + + if (size != 2){ + OutputDebugStringA("glVertexPointer: size must be 2\n"); + exit(1); + } + + if (type==GL_FLOAT) + g_vertices = (GLfloat*)ptr; + else { + OutputDebugStringA("glVertexPointer: illegal type\n"); + exit(1); + } + + if (stride != 0) OutputDebugStringA("glVertexPointer. Stride should be zero\n"); +} + +void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +{ + + if (size != 2){ + OutputDebugStringA("glTexCoordPointer: size must be 2\n"); + exit(1); + } + + if (type==GL_FLOAT) + g_tex_coord = (GLfloat*)ptr; + else { + OutputDebugStringA("glTexCoordPointer: illegal type\n"); + exit(1); + } + + if (stride != 0) OutputDebugStringA("glVertexTexCoordPointer. Stride should be zero\n"); + +} + +void glGetIntegerv(GLenum pname, GLint *params) +{ + if (pname == GL_TEXTURE_BINDING_2D) + *params = g_curr_texind; + else if (pname == GL_FRAMEBUFFER_BINDING) + *params = g_curr_framebuffer; + else { + OutputDebugString(L"Warning, glGetIntegerv pname not supported\n"); + *params = 0; + } +} + +const GLubyte *glGetString(GLenum name) +{ + OutputDebugStringA("glGetString not supported\n"); + return NULL; +} + +void glTexEnvi(GLenum target, GLenum pname, GLint param) +{ +// OutputDebugString(L"glTexEnvi not supported\n"); +} + +void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices) +{ + int i, j, k; + float x, y, xp, yp, zp; + + static VERTEX DxVertices[256]; + D3D11_MAPPED_SUBRESOURCE ms; + + float mat[4][4]; + + GLubyte *ub_indices; + GLushort *us_indices; + GLuint *ui_indices, ui_index; + + if (type == GL_UNSIGNED_BYTE) + ub_indices = (GLubyte *)indices; + else if (type==GL_UNSIGNED_SHORT) + us_indices = (GLushort *)indices; + else + ui_indices = (GLuint *)indices; + + for (i = 0; i<4; i++){ + for (j = 0; j<4; j++){ + mat[i][j] = 0; + for (k = 0; k<4; k++){ + mat[i][j] += projectionmat.M[i][k] * modelmat.M[k][j]; + } + } + } + + for (i = 0; iMap(g_pVBuffer, NULL, D3D11_MAP_WRITE_DISCARD, NULL, &ms); // map the buffer + memcpy(ms.pData, DxVertices, sizeof(VERTEX)*count); // copy the data + g_devcon->Unmap(g_pVBuffer, NULL); // unmap the buffer + + UINT stride = sizeof(VERTEX); + UINT offset = 0; + + g_devcon->IASetVertexBuffers(0, 1, &g_pVBuffer, &stride, &offset); + + if (dxcompat_force_lines) + mode = GL_LINE_STRIP; + + if (mode == GL_POINTS) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); + else if (mode == GL_TRIANGLE_STRIP) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + else if (mode == GL_TRIANGLES) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + else if (mode == GL_LINE_STRIP) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP); + else if (mode == GL_LINE_LOOP) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP); + else if (mode == GL_LINES) + g_devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST); + else { + OutputDebugStringA("glDrawElements: bad mode\n"); + exit(1); + } + + + g_devcon->Draw(count, 0); + +} + + +void glBindBuffer(GLenum target, GLuint buffer) +{ +} + +void glDeleteFramebuffers(GLsizei n, GLuint *framebuffers) +{ + int i, count; + + for (i = 0; iRelease(); // delete rendertarget + g_renderTarget[mytexind] = NULL; + g_renderTargetused[mytexind] = false; + } + } + + // remove end of list if full of unused slots + count = 0; + for (i = g_renderTarget.size() - 1; i >= 0; i--){ + if (g_renderTargetused[i]) break; + count++; + } + + for (i = 0; i < count; i++){ + g_renderTarget.pop_back(); + g_renderTargetused.pop_back(); + g_renderTargetCol.pop_back(); + } + +} + +void glGenFramebuffers(GLsizei n, GLuint *framebuffers) +{ + int i, j; // i: index in framebuffers, j: index in g_renderTarget + Backcol col = { 1.0f, 1.0f, 1.0f, 1.0f }; + + i = 0; + for (j = 0; jOMSetRenderTargets(1, &g_backbuffer, NULL); // draw on screen (actually back buffer) + g_curr_framebuffer = 0; + return; + } + + if (framebuffer >= g_renderTarget.size()) return; + if (!g_renderTargetused[framebuffer]) return; + + g_curr_framebuffer = framebuffer; + + if (g_renderTarget[g_curr_framebuffer]!=NULL) + g_devcon->OMSetRenderTargets(1, &g_renderTarget[g_curr_framebuffer], NULL); // draw on texture +} + +void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + + D3D11_SHADER_RESOURCE_VIEW_DESC desc; + ID3D11Resource *res; + + if (target != GL_FRAMEBUFFER){ + OutputDebugStringA("glFramebufferTexture2D: bad target\n"); + exit(1); + } + + if (attachment != GL_COLOR_ATTACHMENT0){ + OutputDebugStringA("glFramebufferTexture2D: bad attachment\n"); + exit(1); + } + + if (textarget != GL_TEXTURE_2D){ + OutputDebugStringA("glFramebufferTexture2D: bad textarget\n"); + exit(1); + } + + if (level != 0){ + OutputDebugStringA("glFramebufferTexture2D: bad level\n"); + exit(1); + } + + if (g_RSV[texture] == NULL) return; + + g_RSV[texture]->GetDesc(&desc); + g_RSV[texture]->GetResource(&res); + + D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc; + + ZeroMemory(&renderTargetViewDesc, sizeof(renderTargetViewDesc)); + + renderTargetViewDesc.Format = desc.Format; + renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + renderTargetViewDesc.Texture2D.MipSlice = 0; + + g_dev->CreateRenderTargetView(res, &renderTargetViewDesc, &g_renderTarget[g_curr_framebuffer]); // create rendertarget + g_devcon->OMSetRenderTargets(1, &g_renderTarget[g_curr_framebuffer], NULL); // draw on texture +} + +void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) +{ + +} + +void glTexParameteri(GLenum target, GLenum pname, GLint param) +{ + OutputDebugString(L"glTexParameteri not supported\n"); +} + + +// Empty for now +void glScissor(GLint x, GLint y, GLsizei width, GLsizei height) +{ + +} + +void glDepthFunc(GLenum func) +{ + +} + + +// ###################################################################### +// On WinRT these functions do not exist (headers are present for compiling) +// but they are needed by Lua so put do-nothing functions for link stage + +#ifdef WINSTORE +extern "C"{ + char *getenv(const char *string){ return NULL; } + int system(const char *string){ return 0; } +} +#endif diff --git a/winrt/dxcompat.hpp b/winrt/dxcompat.hpp new file mode 100644 index 000000000..23626def4 --- /dev/null +++ b/winrt/dxcompat.hpp @@ -0,0 +1,709 @@ +#ifndef DXCOMPAT_H +#define DXCOMPAT_H + +#include +//#include +//#include +//#include +#include + + +/************************************************************************ +* +* Constants +* +************************************************************************/ + +/* Boolean values */ +#define GL_FALSE 0x0 +#define GL_TRUE 0x1 + +/* Data types */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_DOUBLE 0x140A +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 + +/* Primitives */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 + +/* Vertex Arrays */ +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D + +/* Matrix Mode */ +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* Points */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_POINT_SIZE_RANGE 0x0B12 + +/* Lines */ +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_WIDTH_RANGE 0x0B22 + +/* Polygons */ +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 + +/* Display Lists */ +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_LIST_MODE 0x0B30 + +/* Depth buffer */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_BITS 0x0D56 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_COMPONENT 0x1902 + +/* Lighting */ +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_SHININESS 0x1601 +#define GL_EMISSION 0x1600 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_SHADE_MODEL 0x0B54 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_NORMALIZE 0x0BA1 + +/* User clipping planes */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* Accumulation buffer */ +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_ACCUM 0x0100 +#define GL_ADD 0x0104 +#define GL_LOAD 0x0101 +#define GL_MULT 0x0103 +#define GL_RETURN 0x0102 + +/* Alpha testing */ +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_ALPHA_TEST_FUNC 0x0BC1 + +/* Blending */ +#define GL_BLEND 0x0BE2 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND_DST 0x0BE0 +#define GL_ZERO 0x0 +#define GL_ONE 0x1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 + +/* Render Mode */ +#define GL_FEEDBACK 0x1C01 +#define GL_RENDER 0x1C00 +#define GL_SELECT 0x1C02 + +/* Feedback */ +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 + +/* Selection */ +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 + +/* Fog */ +#define GL_FOG 0x0B60 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_LINEAR 0x2601 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* Logic Ops */ +#define GL_LOGIC_OP 0x0BF1 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_CLEAR 0x1500 +#define GL_SET 0x150F +#define GL_COPY 0x1503 +#define GL_COPY_INVERTED 0x150C +#define GL_NOOP 0x1505 +#define GL_INVERT 0x150A +#define GL_AND 0x1501 +#define GL_NAND 0x150E +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_XOR 0x1506 +#define GL_EQUIV 0x1509 +#define GL_AND_REVERSE 0x1502 +#define GL_AND_INVERTED 0x1504 +#define GL_OR_REVERSE 0x150B +#define GL_OR_INVERTED 0x150D + +/* Stencil */ +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BITS 0x0D57 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_INDEX 0x1901 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 + +/* Buffers, Pixel Drawing/Reading */ +#define GL_NONE 0x0 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +/*GL_FRONT 0x0404 */ +/*GL_BACK 0x0405 */ +/*GL_FRONT_AND_BACK 0x0408 */ +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_COLOR_INDEX 0x1900 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_ALPHA_BITS 0x0D55 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_INDEX_BITS 0x0D51 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_READ_BUFFER 0x0C02 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_BITMAP 0x1A00 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_DITHER 0x0BD0 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 + +/* Implementation limits */ +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B + +/* Gets */ +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_RENDER_MODE 0x0C40 +#define GL_RGBA_MODE 0x0C31 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_VIEWPORT 0x0BA2 + +/* Evaluators */ +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_COEFF 0x0A00 +#define GL_DOMAIN 0x0A02 +#define GL_ORDER 0x0A01 + +/* Hints */ +#define GL_FOG_HINT 0x0C54 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* Scissor box */ +#define GL_SCISSOR_TEST 0x0C11 +#define GL_SCISSOR_BOX 0x0C10 + +/* Pixel Mode / Transfer */ +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 + +/* Texture mapping */ +#define GL_TEXTURE_ENV 0x2300 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_LINEAR 0x2400 +#define GL_EYE_PLANE 0x2502 +#define GL_SPHERE_MAP 0x2402 +#define GL_DECAL 0x2101 +#define GL_MODULATE 0x2100 +#define GL_NEAREST 0x2600 +#define GL_REPEAT 0x2901 +#define GL_CLAMP 0x2900 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 + +/* Utility */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* Errors */ +#define GL_NO_ERROR 0x0 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + +/* glPush/PopAttrib bits */ +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000FFFFF + + +/* OpenGL 1.1 */ +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF + +#define GL_CLAMP_TO_EDGE 0x812F + +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 + +// Higher version of OpenGL (above 1.3) +#define GL_FRAMEBUFFER 0 +#define GL_COLOR_ATTACHMENT0 0 +#define GL_FRAMEBUFFER_BINDING 0 +#define GL_DEPTH24_STENCIL8 0 + +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef signed char GLbyte; /* 1-byte signed */ +typedef short GLshort; /* 2-byte signed */ +typedef int GLint; /* 4-byte signed */ +typedef unsigned char GLubyte; /* 1-byte unsigned */ +typedef unsigned short GLushort; /* 2-byte unsigned */ +typedef unsigned int GLuint; /* 4-byte unsigned */ +typedef int GLsizei; /* 4-byte signed */ +typedef float GLfloat; /* single precision float */ +typedef float GLclampf; /* single precision float in [0,1] */ +typedef double GLdouble; /* double precision float */ +typedef double GLclampd; /* double precision float in [0,1] */ + +void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); +void glClear(GLbitfield mask); +void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val); +void glLoadIdentity(); +void glMatrixMode(GLenum mode); +void glTranslatef(GLfloat x,GLfloat y, GLfloat z); +void glRotatef(GLfloat angle,GLfloat x,GLfloat y, GLfloat z); +void glScalef(GLfloat x,GLfloat y, GLfloat z); +void glPushMatrix(); +void glPopMatrix(); +void glGenTextures(GLsizei n, GLuint *textures); +void glDeleteTextures(GLsizei n, GLuint *textures); +void glBindTextures(GLenum target, GLuint texture); +void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); +void glTexParameterf(GLenum target, GLenum pname, GLfloat param ); +void glPixelStorei(GLenum pname, GLint param); +void glColor4ub(GLubyte r,GLubyte g, GLubyte b, GLubyte a); +void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a); +void glEnableClientState(GLenum type); +void glDisableClientState(GLenum type); +void glEnable(GLenum type); +void glDisable(GLenum type); +void glBindTexture(GLenum target,GLuint texture); +void glDrawArrays(GLenum pattern, GLint zero, GLsizei npoints); +void glLineWidth(GLfloat width); + +// NEW +void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); +void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); +void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); +void glBlendFunc(GLenum sfactor, GLenum dfactor); +void glLoadMatrixf(const GLfloat *m); +void glGetIntegerv(GLenum pname, GLint *params); +const GLubyte *glGetString(GLenum name); +void glTexEnvi(GLenum target, GLenum pname, GLint param); +void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); +void glBindBuffer(GLenum target, GLuint buffer); // openGL 1.5 or later +void glBindFramebuffer(GLenum target, GLuint framebuffer); // openGL 1.5 or later +void glFramebufferTexture2D(GLenum targer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +void glTexParameteri(GLenum target, GLenum pname, GLint param); +void glDeleteFramebuffers(GLsizei n, GLuint *framebuffers); +void glGenFramebuffers(GLsizei n, GLuint *framebuffers); + +void glScissor(GLint x, GLint y, GLsizei width, GLsizei height); +void glDepthFunc(GLenum func); + +struct VERTEX{ + FLOAT X,Y,Z; + FLOAT r,g,b,a; + FLOAT u,v; +}; + +struct const_buffer{ + int use_tex,b2,b3,b4; +}; + +#endif diff --git a/winrt/dxglobals.h b/winrt/dxglobals.h new file mode 100644 index 000000000..1d1975f35 --- /dev/null +++ b/winrt/dxglobals.h @@ -0,0 +1,28 @@ +#ifndef DXGLOBALS_H +#define DXGLOBALS_H + +#include "pch.h" +using namespace Microsoft::WRL; + +#ifdef WINSTORE +extern ComPtr g_dev; // the pointer to our Direct3D device interface (11.1) +extern ComPtr g_devcon; // the pointer to our Direct3D device context (11.1) +extern ComPtr g_swapchain; // the pointer to the swap chain interface (11.1) +extern ComPtr dxgiDevice; +#else +extern IDXGISwapChain *g_swapchain; // the pointer to the swap chain interface +extern ID3D11Device *g_dev; // the pointer to our Direct3D device interface +extern ID3D11DeviceContext *g_devcon; // the pointer to our Direct3D device context +#endif + +extern ID3D11RenderTargetView *g_backbuffer; +extern ID3D11InputLayout *g_pLayout; +extern ID3D11VertexShader *g_pVS; +extern ID3D11PixelShader *g_pPS; +extern ID3D11Buffer *g_pVBuffer; +extern float backcol[]; +extern ID3D11Buffer *g_CB; +extern ID3D11SamplerState *g_samplerLinear; +extern ID3D11BlendState *g_pBlendState; + +#endif diff --git a/winrt/gideros.sln b/winrt/gideros.sln new file mode 100644 index 000000000..ad0b75f5d --- /dev/null +++ b/winrt/gideros.sln @@ -0,0 +1,60 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gideros", "gideros", "{70BD03CC-4DAE-41EB-B3C5-B50191C15C7E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gideros.Shared", "gideros\gideros.Shared\gideros.Shared.vcxitems", "{7E9098BD-4D17-4D07-86C3-2173966558C0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gideros.Windows", "gideros\gideros.Windows\gideros.Windows.vcxproj", "{0F2D797E-BECA-4B12-BBF9-3022083840E0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gideros.WindowsPhone", "gideros\gideros.WindowsPhone\gideros.WindowsPhone.vcxproj", "{59605108-97BE-403B-83D2-FB37F0FAEF72}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + gideros\gideros.Shared\gideros.Shared.vcxitems*{0f2d797e-beca-4b12-bbf9-3022083840e0}*SharedItemsImports = 4 + gideros\gideros.Shared\gideros.Shared.vcxitems*{7e9098bd-4d17-4d07-86c3-2173966558c0}*SharedItemsImports = 9 + gideros\gideros.Shared\gideros.Shared.vcxitems*{59605108-97be-403b-83d2-fb37f0faef72}*SharedItemsImports = 4 + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|ARM = Release|ARM + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Debug|ARM.ActiveCfg = Debug|ARM + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Debug|ARM.Build.0 = Debug|ARM + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Debug|Win32.ActiveCfg = Debug|Win32 + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Debug|Win32.Build.0 = Debug|Win32 + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Debug|x64.ActiveCfg = Debug|x64 + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Debug|x64.Build.0 = Debug|x64 + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Release|ARM.ActiveCfg = Release|ARM + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Release|ARM.Build.0 = Release|ARM + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Release|Win32.ActiveCfg = Release|Win32 + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Release|Win32.Build.0 = Release|Win32 + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Release|x64.ActiveCfg = Release|x64 + {0F2D797E-BECA-4B12-BBF9-3022083840E0}.Release|x64.Build.0 = Release|x64 + {59605108-97BE-403B-83D2-FB37F0FAEF72}.Debug|ARM.ActiveCfg = Debug|ARM + {59605108-97BE-403B-83D2-FB37F0FAEF72}.Debug|ARM.Build.0 = Debug|ARM + {59605108-97BE-403B-83D2-FB37F0FAEF72}.Debug|Win32.ActiveCfg = Debug|Win32 + {59605108-97BE-403B-83D2-FB37F0FAEF72}.Debug|Win32.Build.0 = Debug|Win32 + {59605108-97BE-403B-83D2-FB37F0FAEF72}.Debug|x64.ActiveCfg = Debug|Win32 + {59605108-97BE-403B-83D2-FB37F0FAEF72}.Release|ARM.ActiveCfg = Release|ARM + {59605108-97BE-403B-83D2-FB37F0FAEF72}.Release|ARM.Build.0 = Release|ARM + {59605108-97BE-403B-83D2-FB37F0FAEF72}.Release|Win32.ActiveCfg = Release|Win32 + {59605108-97BE-403B-83D2-FB37F0FAEF72}.Release|Win32.Build.0 = Release|Win32 + {59605108-97BE-403B-83D2-FB37F0FAEF72}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {7E9098BD-4D17-4D07-86C3-2173966558C0} = {70BD03CC-4DAE-41EB-B3C5-B50191C15C7E} + {0F2D797E-BECA-4B12-BBF9-3022083840E0} = {70BD03CC-4DAE-41EB-B3C5-B50191C15C7E} + {59605108-97BE-403B-83D2-FB37F0FAEF72} = {70BD03CC-4DAE-41EB-B3C5-B50191C15C7E} + EndGlobalSection +EndGlobal diff --git a/winrt/gideros/gideros.Shared/gideros.Shared.vcxitems b/winrt/gideros/gideros.Shared/gideros.Shared.vcxitems new file mode 100644 index 000000000..a90b2cf02 --- /dev/null +++ b/winrt/gideros/gideros.Shared/gideros.Shared.vcxitems @@ -0,0 +1,558 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {7e9098bd-4d17-4d07-86c3-2173966558c0} + gideros + gideros.Shared + 248F659F-DAC5-46E8-AC09-60EC9FC95053 + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OPT_GENERIC;REAL_IS_FLOAT;FT2_BUILD_LIBRARY;PYSTRING_LIBRARY;WINSTORE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/winrt/gideros/gideros.Shared/gideros.Shared.vcxitems.filters b/winrt/gideros/gideros.Shared/gideros.Shared.vcxitems.filters new file mode 100644 index 000000000..16df064c7 --- /dev/null +++ b/winrt/gideros/gideros.Shared/gideros.Shared.vcxitems.filters @@ -0,0 +1,1641 @@ + + + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + + libpystring + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgid + + + libgid + + + libgid + + + libgid + + + libgid + + + libgid + + + libgid + + + libgid + + + libgid + + + libgid + + + libgid + + + libgid + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + libnetwork + + + libpvrt + + + libpvrt + + + libpvrt + + + libpvrt + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libgid + + + libgid + + + libgid + + + libgid + + + libgid + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + jpeg + + + png + + + png + + + png + + + png + + + png + + + png + + + png + + + png + + + png + + + png + + + png + + + png + + + png + + + png + + + png + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + mpg + + + jpeg + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + zlib + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + freetype + + + minizip + + + minizip + + + minizip + + + minizip + + + minizip + + + snappy + + + snappy + + + snappy + + + snappy + + + mpg + + + mpg + + + libplatform + + + libgid + + + libgid + + + 2dsg + + + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + 2dsg + + + + + + libpystring + + + libpystring + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgideros + + + libgid + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + luabinding + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + Box2d + + + libnetwork + + + libnetwork + + + libpvrt + + + libpvrt + + + libpvrt + + + libpvrt + + + libpvrt + + + libpvrt + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libtess + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + libplatform + + + + + 2dsg + + + 2dsg + + + 2dsg + + + libtess + + + + + {5ecc3983-272f-49dd-9520-83a3eb525d97} + + + {c5215d9c-96bb-499a-ba16-daa9c7fa826d} + + + {b4f91601-84b4-4f2e-b6b4-5679d0648731} + + + {a3d57e4b-a1d7-4b8c-b1cb-241ca43831fb} + + + {4c6e63a1-fe68-4673-a301-b88f5de9cee2} + + + {c73c8fb1-743e-47aa-82de-63d2aafd26de} + + + {4071b96b-b168-41df-a830-240e2afec4ca} + + + {7b566ae6-83f0-4bd5-b717-c356bac3496e} + + + {1089be6a-83e8-472f-84de-c396d73a1413} + + + {98cf81c2-b5a7-4057-bfe5-937c5a490d7b} + + + {89687e64-7992-4b0c-8c20-8a1f1974705f} + + + {7ffb49fb-93e4-421e-b068-c12a2172e0a5} + + + {ecf468b6-f602-460e-b2a0-c42dafa2369e} + + + {a49154fa-d99b-40b6-9282-8ad0965db02e} + + + {d13ef968-e842-473e-a4da-e141ee7091e2} + + + {497dad76-40a0-4785-89a4-f0631b334d70} + + + {eeeb41ae-26bb-49f0-825d-70d39c0707c4} + + + \ No newline at end of file diff --git a/winrt/gideros/gideros.Windows/gideros.Windows.vcxproj b/winrt/gideros/gideros.Windows/gideros.Windows.vcxproj new file mode 100644 index 000000000..f12709afa --- /dev/null +++ b/winrt/gideros/gideros.Windows/gideros.Windows.vcxproj @@ -0,0 +1,197 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + {0f2d797e-beca-4b12-bbf9-3022083840e0} + gideros + en-US + 12.0 + true + Windows Store + 8.1 + CodeSharingStaticLibrary + + + + StaticLibrary + true + v120 + + + StaticLibrary + true + v120 + + + StaticLibrary + true + v120 + + + StaticLibrary + false + true + v120 + + + StaticLibrary + false + true + v120 + + + StaticLibrary + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + false + + + false + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\src;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\external\liquidfun-1.0.0\liquidfun\Box2D;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\external\snappy-1.1.0;c:\gideros_liberton\gideros\libgid\external\libpng-1.6.2;c:\gideros_liberton\gideros\libgid\external\jpeg-9;c:\gideros_liberton\gideros\libgid\external\openal-soft-1.16.0\include\AL;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src\libmpg123;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libgid\external\zlib-1.2.8;c:\gideros_liberton\gideros\external\glu;c:\gideros_liberton\gideros\libpystring;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\winrt;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\2dsg;C:\gideros_liberton\gideros\libgid\include;%(AdditionalIncludeDirectories) + GIDEROS_GL1;D3D_DEBUG_INFO;PTW32_STATIC_LIB;WIN32;OPT_GENERIC;REAL_IS_FLOAT;FT2_BUILD_LIBRARY;PYSTRING_LIBRARY;WINSTORE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\src;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\external\liquidfun-1.0.0\liquidfun\Box2D;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\external\snappy-1.1.0;c:\gideros_liberton\gideros\libgid\external\libpng-1.6.2;c:\gideros_liberton\gideros\libgid\external\jpeg-9;c:\gideros_liberton\gideros\libgid\external\openal-soft-1.16.0\include\AL;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src\libmpg123;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libgid\external\zlib-1.2.8;c:\gideros_liberton\gideros\external\glu;c:\gideros_liberton\gideros\libpystring;c:\gideros_liberton\gideros\winrt;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\2dsg;C:\gideros_liberton\gideros\libgid\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + GIDEROS_GL1;PTW32_STATIC_LIB;WIN32;OPT_GENERIC;REAL_IS_FLOAT;FT2_BUILD_LIBRARY;PYSTRING_LIBRARY;WINSTORE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\src;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\external\liquidfun-1.0.0\liquidfun\Box2D;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\external\snappy-1.1.0;c:\gideros_liberton\gideros\libgid\external\libpng-1.6.2;c:\gideros_liberton\gideros\libgid\external\jpeg-9;c:\gideros_liberton\gideros\libgid\external\openal-soft-1.16.0\include\AL;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src\libmpg123;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libgid\external\zlib-1.2.8;c:\gideros_liberton\gideros\external\glu;c:\gideros_liberton\gideros\libpystring;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\winrt;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\2dsg;C:\gideros_liberton\gideros\libgid\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + GIDEROS_GL1;D3D_DEBUG_INFO;PTW32_STATIC_LIB;WIN32;OPT_GENERIC;REAL_IS_FLOAT;FT2_BUILD_LIBRARY;PYSTRING_LIBRARY;WINSTORE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + GIDEROS_GL1;PTW32_STATIC_LIB;WIN32;OPT_GENERIC;REAL_IS_FLOAT;FT2_BUILD_LIBRARY;PYSTRING_LIBRARY;WINSTORE;_UNICODE;UNICODE;%(PreprocessorDefinitions) + c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\src;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\external\liquidfun-1.0.0\liquidfun\Box2D;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\external\snappy-1.1.0;c:\gideros_liberton\gideros\libgid\external\libpng-1.6.2;c:\gideros_liberton\gideros\libgid\external\jpeg-9;c:\gideros_liberton\gideros\libgid\external\openal-soft-1.16.0\include\AL;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src\libmpg123;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libgid\external\zlib-1.2.8;c:\gideros_liberton\gideros\external\glu;c:\gideros_liberton\gideros\libpystring;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\winrt;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\2dsg;C:\gideros_liberton\gideros\libgid\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + Console + false + false + + + + + Use + false + true + + + Console + false + false + + + + + Use + false + true + + + Console + false + false + + + + + + \ No newline at end of file diff --git a/winrt/gideros/gideros.Windows/gideros.Windows.vcxproj.filters b/winrt/gideros/gideros.Windows/gideros.Windows.vcxproj.filters new file mode 100644 index 000000000..a7761ab01 --- /dev/null +++ b/winrt/gideros/gideros.Windows/gideros.Windows.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + diff --git a/winrt/gideros/gideros.WindowsPhone/gideros.WindowsPhone.vcxproj b/winrt/gideros/gideros.WindowsPhone/gideros.WindowsPhone.vcxproj new file mode 100644 index 000000000..3888713e7 --- /dev/null +++ b/winrt/gideros/gideros.WindowsPhone/gideros.WindowsPhone.vcxproj @@ -0,0 +1,140 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Release + ARM + + + Release + Win32 + + + + {59605108-97be-403b-83d2-fb37f0faef72} + gideros + en-US + 12.0 + true + Windows Phone + 8.1 + CodeSharingStaticLibrary + + + + StaticLibrary + true + v120_wp81 + + + StaticLibrary + true + v120_wp81 + + + StaticLibrary + false + true + v120_wp81 + + + StaticLibrary + false + true + v120_wp81 + + + + + + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\src;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\external\liquidfun-1.0.0\liquidfun\Box2D;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\external\snappy-1.1.0;c:\gideros_liberton\gideros\libgid\external\libpng-1.6.2;c:\gideros_liberton\gideros\libgid\external\jpeg-9;c:\gideros_liberton\gideros\libgid\external\openal-soft-1.16.0\include\AL;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src\libmpg123;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libgid\external\zlib-1.2.8;c:\gideros_liberton\gideros\external\glu;c:\gideros_liberton\gideros\libpystring;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\winrt;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\2dsg;C:\gideros_liberton\gideros\libgid\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + GIDEROS_GL1;PTW32_STATIC_LIB;WIN32;OPT_GENERIC;REAL_IS_FLOAT;FT2_BUILD_LIBRARY;PYSTRING_LIBRARY;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\src;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\external\liquidfun-1.0.0\liquidfun\Box2D;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\external\snappy-1.1.0;c:\gideros_liberton\gideros\libgid\external\libpng-1.6.2;c:\gideros_liberton\gideros\libgid\external\jpeg-9;c:\gideros_liberton\gideros\libgid\external\openal-soft-1.16.0\include\AL;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src\libmpg123;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libgid\external\zlib-1.2.8;c:\gideros_liberton\gideros\external\glu;c:\gideros_liberton\gideros\libpystring;c:\gideros_liberton\gideros\winrt;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\2dsg;C:\gideros_liberton\gideros\libgid\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + GIDEROS_GL1;PTW32_STATIC_LIB;WIN32;OPT_GENERIC;REAL_IS_FLOAT;FT2_BUILD_LIBRARY;PYSTRING_LIBRARY;WINSTORE;WIN32;OPT_GENERIC;REAL_IS_FLOAT;FT2_BUILD_LIBRARY;PYSTRING_LIBRARY;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\src;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\external\liquidfun-1.0.0\liquidfun\Box2D;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\external\snappy-1.1.0;c:\gideros_liberton\gideros\libgid\external\libpng-1.6.2;c:\gideros_liberton\gideros\libgid\external\jpeg-9;c:\gideros_liberton\gideros\libgid\external\openal-soft-1.16.0\include\AL;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src\libmpg123;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libgid\external\zlib-1.2.8;c:\gideros_liberton\gideros\external\glu;c:\gideros_liberton\gideros\libpystring;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\winrt;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\2dsg;C:\gideros_liberton\gideros\libgid\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + GIDEROS_GL1;PTW32_STATIC_LIB;WIN32;OPT_GENERIC;REAL_IS_FLOAT;FT2_BUILD_LIBRARY;PYSTRING_LIBRARY;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + Console + false + false + + + + + NotUsing + false + false + c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\src;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src;c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\external\liquidfun-1.0.0\liquidfun\Box2D;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\external\snappy-1.1.0;c:\gideros_liberton\gideros\libgid\external\libpng-1.6.2;c:\gideros_liberton\gideros\libgid\external\jpeg-9;c:\gideros_liberton\gideros\libgid\external\openal-soft-1.16.0\include\AL;c:\gideros_liberton\gideros\libgid\external\mpg123-1.15.3\src\libmpg123;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libgid\external\zlib-1.2.8;c:\gideros_liberton\gideros\external\glu;c:\gideros_liberton\gideros\libpystring;c:\gideros_liberton\gideros\libgid\external\freetype-2.4.12\include;c:\gideros_liberton\gideros\winrt;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\2dsg;C:\gideros_liberton\gideros\libgid\include;%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + GIDEROS_GL1;PTW32_STATIC_LIB;WIN32;OPT_GENERIC;REAL_IS_FLOAT;FT2_BUILD_LIBRARY;PYSTRING_LIBRARY;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + Console + false + false + + + + + + \ No newline at end of file diff --git a/winrt/gideros/gideros.WindowsPhone/gideros.WindowsPhone.vcxproj.filters b/winrt/gideros/gideros.WindowsPhone/gideros.WindowsPhone.vcxproj.filters new file mode 100644 index 000000000..a7761ab01 --- /dev/null +++ b/winrt/gideros/gideros.WindowsPhone/gideros.WindowsPhone.vcxproj.filters @@ -0,0 +1,5 @@ + + + + + diff --git a/winrt/pch.cpp b/winrt/pch.cpp new file mode 100644 index 000000000..bcb5590be --- /dev/null +++ b/winrt/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/winrt/pch.h b/winrt/pch.h new file mode 100644 index 000000000..0427dc949 --- /dev/null +++ b/winrt/pch.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include \ No newline at end of file diff --git a/winrt/texture.hlsl b/winrt/texture.hlsl new file mode 100644 index 000000000..bfd3724b5 --- /dev/null +++ b/winrt/texture.hlsl @@ -0,0 +1,37 @@ +Texture2D myTexture : register(t0); +SamplerState samLinear : register(s0); + +cbuffer cb : register(b0) +{ + int use_tex; + int b2; + int b3; + int b4; +}; + +struct VOut +{ + float4 position : SV_POSITION; + float4 color : COLOR; + float2 texcoord : TEXCOORD; +}; + +VOut VShader(float4 position : POSITION, float4 color : COLOR, float2 texcoord : TEXCOORD) +{ + VOut output; + + output.position = position; + output.color = color; + output.texcoord = texcoord; + + return output; +} + + +float4 PShader(float4 position : SV_POSITION, float4 color : COLOR, float2 texcoord: TEXCOORD) : SV_TARGET +{ + if (use_tex==1) + return myTexture.Sample(samLinear,texcoord)*color; + else + return color; +} diff --git a/winrt_example/giderosgame.sln b/winrt_example/giderosgame.sln new file mode 100644 index 000000000..341db9df2 --- /dev/null +++ b/winrt_example/giderosgame.sln @@ -0,0 +1,70 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2013 for Windows +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "giderosgame", "giderosgame", "{1AEC5570-E899-4829-ACEB-7329AFB77449}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "giderosgame.Shared", "giderosgame\giderosgame.Shared\giderosgame.Shared.vcxitems", "{DEC10227-BABD-485A-9E25-F3720A23C496}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "giderosgame.Windows", "giderosgame\giderosgame.Windows\giderosgame.Windows.vcxproj", "{69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "giderosgame.WindowsPhone", "giderosgame\giderosgame.WindowsPhone\giderosgame.WindowsPhone.vcxproj", "{1024583A-3B31-4571-A69F-2215E3B7975C}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + giderosgame\giderosgame.Shared\giderosgame.Shared.vcxitems*{dec10227-babd-485a-9e25-f3720a23c496}*SharedItemsImports = 9 + giderosgame\giderosgame.Shared\giderosgame.Shared.vcxitems*{1024583a-3b31-4571-a69f-2215e3b7975c}*SharedItemsImports = 4 + giderosgame\giderosgame.Shared\giderosgame.Shared.vcxitems*{69d0dc6b-44c5-4d2e-a0ed-4ff49ce10786}*SharedItemsImports = 4 + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|ARM = Release|ARM + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Debug|ARM.ActiveCfg = Debug|ARM + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Debug|ARM.Build.0 = Debug|ARM + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Debug|ARM.Deploy.0 = Debug|ARM + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Debug|Win32.ActiveCfg = Debug|Win32 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Debug|Win32.Build.0 = Debug|Win32 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Debug|Win32.Deploy.0 = Debug|Win32 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Debug|x64.ActiveCfg = Debug|x64 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Debug|x64.Build.0 = Debug|x64 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Debug|x64.Deploy.0 = Debug|x64 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Release|ARM.ActiveCfg = Release|ARM + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Release|ARM.Build.0 = Release|ARM + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Release|ARM.Deploy.0 = Release|ARM + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Release|Win32.ActiveCfg = Release|Win32 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Release|Win32.Build.0 = Release|Win32 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Release|Win32.Deploy.0 = Release|Win32 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Release|x64.ActiveCfg = Release|x64 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Release|x64.Build.0 = Release|x64 + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786}.Release|x64.Deploy.0 = Release|x64 + {1024583A-3B31-4571-A69F-2215E3B7975C}.Debug|ARM.ActiveCfg = Debug|ARM + {1024583A-3B31-4571-A69F-2215E3B7975C}.Debug|ARM.Build.0 = Debug|ARM + {1024583A-3B31-4571-A69F-2215E3B7975C}.Debug|ARM.Deploy.0 = Debug|ARM + {1024583A-3B31-4571-A69F-2215E3B7975C}.Debug|Win32.ActiveCfg = Debug|Win32 + {1024583A-3B31-4571-A69F-2215E3B7975C}.Debug|Win32.Build.0 = Debug|Win32 + {1024583A-3B31-4571-A69F-2215E3B7975C}.Debug|Win32.Deploy.0 = Debug|Win32 + {1024583A-3B31-4571-A69F-2215E3B7975C}.Debug|x64.ActiveCfg = Debug|Win32 + {1024583A-3B31-4571-A69F-2215E3B7975C}.Release|ARM.ActiveCfg = Release|ARM + {1024583A-3B31-4571-A69F-2215E3B7975C}.Release|ARM.Build.0 = Release|ARM + {1024583A-3B31-4571-A69F-2215E3B7975C}.Release|ARM.Deploy.0 = Release|ARM + {1024583A-3B31-4571-A69F-2215E3B7975C}.Release|Win32.ActiveCfg = Release|Win32 + {1024583A-3B31-4571-A69F-2215E3B7975C}.Release|Win32.Build.0 = Release|Win32 + {1024583A-3B31-4571-A69F-2215E3B7975C}.Release|Win32.Deploy.0 = Release|Win32 + {1024583A-3B31-4571-A69F-2215E3B7975C}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {DEC10227-BABD-485A-9E25-F3720A23C496} = {1AEC5570-E899-4829-ACEB-7329AFB77449} + {69D0DC6B-44C5-4D2E-A0ED-4FF49CE10786} = {1AEC5570-E899-4829-ACEB-7329AFB77449} + {1024583A-3B31-4571-A69F-2215E3B7975C} = {1AEC5570-E899-4829-ACEB-7329AFB77449} + EndGlobalSection +EndGlobal diff --git a/winrt_example/giderosgame/giderosgame.Shared/Content/ShaderStructures.h b/winrt_example/giderosgame/giderosgame.Shared/Content/ShaderStructures.h new file mode 100644 index 000000000..d48d77a23 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Shared/Content/ShaderStructures.h @@ -0,0 +1,19 @@ +#pragma once + +namespace giderosgame +{ + // Constant buffer used to send MVP matrices to the vertex shader. + struct ModelViewProjectionConstantBuffer + { + DirectX::XMFLOAT4X4 model; + DirectX::XMFLOAT4X4 view; + DirectX::XMFLOAT4X4 projection; + }; + + // Used to send per-vertex data to the vertex shader. + struct VertexPositionColor + { + DirectX::XMFLOAT3 pos; + DirectX::XMFLOAT3 color; + }; +} \ No newline at end of file diff --git a/winrt_example/giderosgame/giderosgame.Shared/giderosgame.Shared.vcxitems b/winrt_example/giderosgame/giderosgame.Shared/giderosgame.Shared.vcxitems new file mode 100644 index 000000000..c79af6aa8 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Shared/giderosgame.Shared.vcxitems @@ -0,0 +1,23 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {dec10227-babd-485a-9e25-f3720a23c496} + giderosgame + giderosgame.Shared + e1d47819-f1ff-4e88-ac02-1cd12cd2000d + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + + + \ No newline at end of file diff --git a/winrt_example/giderosgame/giderosgame.Shared/giderosgame.Shared.vcxitems.filters b/winrt_example/giderosgame/giderosgame.Shared/giderosgame.Shared.vcxitems.filters new file mode 100644 index 000000000..b51a12841 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Shared/giderosgame.Shared.vcxitems.filters @@ -0,0 +1,17 @@ + + + + + + + + + + + {e1d47819-f1ff-4e88-ac02-1cd12cd2000d} + + + {7930b97f-44db-4bbd-b54c-c7a30a42f62a} + + + \ No newline at end of file diff --git a/winrt_example/giderosgame/giderosgame.Shared/pch.cpp b/winrt_example/giderosgame/giderosgame.Shared/pch.cpp new file mode 100644 index 000000000..bcb5590be --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Shared/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/winrt_example/giderosgame/giderosgame.Shared/pch.h b/winrt_example/giderosgame/giderosgame.Shared/pch.h new file mode 100644 index 000000000..bc01a1e6d --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Shared/pch.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include \ No newline at end of file diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/1-down.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/1-down.png new file mode 100644 index 000000000..0a9223d28 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/1-down.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/1-up.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/1-up.png new file mode 100644 index 000000000..610fe2d75 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/1-up.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/1.wav b/winrt_example/giderosgame/giderosgame.Windows/Assets/1.wav new file mode 100644 index 000000000..c2c2a128d Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/1.wav differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/2-down.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/2-down.png new file mode 100644 index 000000000..193090501 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/2-down.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/2-up.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/2-up.png new file mode 100644 index 000000000..c1d5e5d42 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/2-up.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/2.wav b/winrt_example/giderosgame/giderosgame.Windows/Assets/2.wav new file mode 100644 index 000000000..e3d6141ec Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/2.wav differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/3-down.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/3-down.png new file mode 100644 index 000000000..0d8c2b201 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/3-down.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/3-up.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/3-up.png new file mode 100644 index 000000000..ce1c2cd75 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/3-up.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/3.wav b/winrt_example/giderosgame/giderosgame.Windows/Assets/3.wav new file mode 100644 index 000000000..9b5182734 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/3.wav differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/Audio Example.gproj b/winrt_example/giderosgame/giderosgame.Windows/Assets/Audio Example.gproj new file mode 100644 index 000000000..30688ff46 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/Audio Example.gproj @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/Logo.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/Logo.png new file mode 100644 index 000000000..e26771cb3 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/Logo.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/PixelShader.cso b/winrt_example/giderosgame/giderosgame.Windows/Assets/PixelShader.cso new file mode 100644 index 000000000..b1db10609 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/PixelShader.cso differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/SmallLogo.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/SmallLogo.png new file mode 100644 index 000000000..1eb0d9d52 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/SmallLogo.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/SplashScreen.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/SplashScreen.png new file mode 100644 index 000000000..c951e031b Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/SplashScreen.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/StoreLogo.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/StoreLogo.png new file mode 100644 index 000000000..dcb672712 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/StoreLogo.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/VertexShader.cso b/winrt_example/giderosgame/giderosgame.Windows/Assets/VertexShader.cso new file mode 100644 index 000000000..79056027e Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/VertexShader.cso differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/arial.ttf b/winrt_example/giderosgame/giderosgame.Windows/Assets/arial.ttf new file mode 100644 index 000000000..ff0815cd8 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/arial.ttf differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/ball.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/ball.png new file mode 100644 index 000000000..b62f57e3c Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/ball.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/billo.fnt b/winrt_example/giderosgame/giderosgame.Windows/Assets/billo.fnt new file mode 100644 index 000000000..af67d6db2 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/billo.fnt @@ -0,0 +1,99 @@ +info face="Billo" size=50 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2 +common lineHeight=75 base=41 scaleW=512 scaleH=512 pages=1 packed=0 +page id=0 file="billo.png" +chars count=95 +char id=32 x=320 y=306 width=0 height=0 xoffset=0 yoffset=48 xadvance=18 page=0 chnl=0 letter="space" +char id=33 x=180 y=139 width=19 height=44 xoffset=2 yoffset=6 xadvance=11 page=0 chnl=0 letter="!" +char id=34 x=132 y=306 width=27 height=22 xoffset=2 yoffset=5 xadvance=22 page=0 chnl=0 letter=""" +char id=35 x=434 y=233 width=32 height=32 xoffset=2 yoffset=16 xadvance=26 page=0 chnl=0 letter="#" +char id=36 x=78 y=139 width=32 height=46 xoffset=2 yoffset=8 xadvance=27 page=0 chnl=0 letter="$" +char id=37 x=222 y=139 width=37 height=43 xoffset=1 yoffset=5 xadvance=31 page=0 chnl=0 letter="%" +char id=38 x=298 y=233 width=32 height=32 xoffset=2 yoffset=10 xadvance=26 page=0 chnl=0 letter="&" +char id=39 x=180 y=306 width=17 height=22 xoffset=2 yoffset=5 xadvance=11 page=0 chnl=0 letter="'" +char id=40 x=398 y=188 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="(" +char id=41 x=193 y=188 width=50 height=40 xoffset=2 yoffset=7 xadvance=44 page=0 chnl=0 letter=")" +char id=42 x=222 y=306 width=19 height=20 xoffset=2 yoffset=20 xadvance=16 page=0 chnl=0 letter="*" +char id=43 x=36 y=272 width=32 height=32 xoffset=2 yoffset=10 xadvance=26 page=0 chnl=0 letter="+" +char id=44 x=161 y=306 width=17 height=22 xoffset=2 yoffset=31 xadvance=11 page=0 chnl=0 letter="," +char id=45 x=277 y=306 width=22 height=17 xoffset=2 yoffset=22 xadvance=16 page=0 chnl=0 letter="-" +char id=46 x=301 y=306 width=17 height=17 xoffset=2 yoffset=31 xadvance=11 page=0 chnl=0 letter="." +char id=47 x=36 y=188 width=28 height=43 xoffset=-0 yoffset=5 xadvance=19 page=0 chnl=0 letter="/" +char id=48 x=332 y=233 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="0" +char id=49 x=65 y=306 width=17 height=32 xoffset=2 yoffset=16 xadvance=11 page=0 chnl=0 letter="1" +char id=50 x=468 y=233 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="2" +char id=51 x=34 y=306 width=29 height=32 xoffset=2 yoffset=16 xadvance=23 page=0 chnl=0 letter="3" +char id=52 x=400 y=233 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="4" +char id=53 x=2 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="5" +char id=54 x=410 y=272 width=30 height=32 xoffset=2 yoffset=16 xadvance=24 page=0 chnl=0 letter="6" +char id=55 x=474 y=272 width=30 height=32 xoffset=2 yoffset=16 xadvance=25 page=0 chnl=0 letter="7" +char id=56 x=366 y=233 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="8" +char id=57 x=442 y=272 width=30 height=32 xoffset=2 yoffset=16 xadvance=24 page=0 chnl=0 letter="9" +char id=58 x=84 y=306 width=17 height=32 xoffset=2 yoffset=16 xadvance=11 page=0 chnl=0 letter=":" +char id=59 x=149 y=233 width=17 height=37 xoffset=2 yoffset=16 xadvance=11 page=0 chnl=0 letter=";" +char id=60 x=2 y=233 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="<" +char id=61 x=103 y=306 width=27 height=27 xoffset=2 yoffset=16 xadvance=22 page=0 chnl=0 letter="=" +char id=62 x=297 y=188 width=50 height=40 xoffset=2 yoffset=7 xadvance=44 page=0 chnl=0 letter=">" +char id=63 x=115 y=188 width=24 height=41 xoffset=2 yoffset=9 xadvance=19 page=0 chnl=0 letter="?" +char id=64 x=264 y=233 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="@" +char id=65 x=190 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="A" +char id=66 x=380 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="B" +char id=67 x=268 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="C" +char id=68 x=224 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="D" +char id=69 x=41 y=139 width=35 height=47 xoffset=-0 yoffset=14 xadvance=24 page=0 chnl=0 letter="E" +char id=70 x=458 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="F" +char id=71 x=43 y=2 width=37 height=61 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="G" +char id=72 x=263 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="H" +char id=73 x=121 y=2 width=27 height=61 xoffset=-2 yoffset=0 xadvance=11 page=0 chnl=0 letter="I" +char id=74 x=2 y=2 width=39 height=75 xoffset=-14 yoffset=0 xadvance=11 page=0 chnl=0 letter="J" +char id=75 x=302 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="K" +char id=76 x=2 y=79 width=22 height=58 xoffset=-0 yoffset=3 xadvance=11 page=0 chnl=0 letter="L" +char id=77 x=98 y=79 width=51 height=47 xoffset=-0 yoffset=14 xadvance=40 page=0 chnl=0 letter="M" +char id=78 x=307 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="N" +char id=79 x=151 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="O" +char id=80 x=419 y=2 width=37 height=58 xoffset=-0 yoffset=13 xadvance=27 page=0 chnl=0 letter="P" +char id=81 x=185 y=2 width=37 height=58 xoffset=-0 yoffset=13 xadvance=27 page=0 chnl=0 letter="Q" +char id=82 x=463 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="R" +char id=83 x=2 y=139 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="S" +char id=84 x=341 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="T" +char id=85 x=385 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="U" +char id=86 x=229 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="V" +char id=87 x=45 y=79 width=51 height=47 xoffset=-0 yoffset=14 xadvance=40 page=0 chnl=0 letter="W" +char id=88 x=346 y=79 width=37 height=47 xoffset=-1 yoffset=14 xadvance=27 page=0 chnl=0 letter="X" +char id=89 x=82 y=2 width=37 height=61 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="Y" +char id=90 x=424 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="Z" +char id=91 x=447 y=188 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="[" +char id=92 x=66 y=188 width=28 height=43 xoffset=-0 yoffset=5 xadvance=19 page=0 chnl=0 letter="\" +char id=93 x=245 y=188 width=50 height=40 xoffset=2 yoffset=7 xadvance=44 page=0 chnl=0 letter="]" +char id=94 x=51 y=233 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="^" +char id=95 x=243 y=306 width=32 height=17 xoffset=2 yoffset=31 xadvance=26 page=0 chnl=0 letter="_" +char id=96 x=199 y=306 width=21 height=21 xoffset=8 yoffset=1 xadvance=27 page=0 chnl=0 letter="`" +char id=97 x=104 y=272 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="a" +char id=98 x=261 y=139 width=32 height=43 xoffset=2 yoffset=6 xadvance=27 page=0 chnl=0 letter="b" +char id=99 x=138 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="c" +char id=100 x=295 y=139 width=32 height=43 xoffset=2 yoffset=6 xadvance=27 page=0 chnl=0 letter="d" +char id=101 x=2 y=306 width=30 height=32 xoffset=2 yoffset=16 xadvance=24 page=0 chnl=0 letter="e" +char id=102 x=397 y=139 width=32 height=43 xoffset=2 yoffset=5 xadvance=27 page=0 chnl=0 letter="f" +char id=103 x=112 y=139 width=32 height=46 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="g" +char id=104 x=329 y=139 width=32 height=43 xoffset=2 yoffset=5 xadvance=27 page=0 chnl=0 letter="h" +char id=105 x=201 y=139 width=19 height=44 xoffset=2 yoffset=4 xadvance=11 page=0 chnl=0 letter="i" +char id=106 x=150 y=2 width=33 height=59 xoffset=-12 yoffset=3 xadvance=11 page=0 chnl=0 letter="j" +char id=107 x=363 y=139 width=32 height=43 xoffset=2 yoffset=5 xadvance=27 page=0 chnl=0 letter="k" +char id=108 x=96 y=188 width=17 height=43 xoffset=2 yoffset=5 xadvance=11 page=0 chnl=0 letter="l" +char id=109 x=216 y=233 width=46 height=32 xoffset=2 yoffset=16 xadvance=40 page=0 chnl=0 letter="m" +char id=110 x=274 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="n" +char id=111 x=70 y=272 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="o" +char id=112 x=431 y=139 width=32 height=43 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="p" +char id=113 x=465 y=139 width=32 height=43 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="q" +char id=114 x=376 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="r" +char id=115 x=172 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="s" +char id=116 x=2 y=188 width=32 height=43 xoffset=2 yoffset=5 xadvance=27 page=0 chnl=0 letter="t" +char id=117 x=308 y=272 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="u" +char id=118 x=206 y=272 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="v" +char id=119 x=168 y=233 width=46 height=32 xoffset=2 yoffset=17 xadvance=40 page=0 chnl=0 letter="w" +char id=120 x=240 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="x" +char id=121 x=146 y=139 width=32 height=46 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="y" +char id=122 x=342 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="z" +char id=123 x=349 y=188 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="{" +char id=124 x=26 y=79 width=17 height=53 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=0 letter="|" +char id=125 x=141 y=188 width=50 height=40 xoffset=2 yoffset=7 xadvance=44 page=0 chnl=0 letter="}" +char id=126 x=100 y=233 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="~" diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/billo.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/billo.png new file mode 100644 index 000000000..9f4c050be Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/billo.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/billo.ttf b/winrt_example/giderosgame/giderosgame.Windows/Assets/billo.ttf new file mode 100644 index 000000000..a7283cb79 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/billo.ttf differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/bird.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird.lua new file mode 100644 index 000000000..8b416298f --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird.lua @@ -0,0 +1,68 @@ +--[[ +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile +--]] + +Bird = Core.class(Sprite) + +function Bird:init(frameList) + -- create a Bitmap for each frame + self.frames = {} + for i = 1, #frameList do + self.frames[i] = Bitmap.new(Texture.new(frameList[i])) + end + + self.nframes = #frameList + + -- add first Bitmap as a child + self.frame = 1 + self:addChild(self.frames[1]) + + -- subframe is used to adjust the speed of animation + self.subframe = 0 + + -- set initial position + self:setPosition(540, math.random(160) + 40) + + -- set the speed of the bird + self.speedy = math.random(-500, 500) / 1000 + self.speedx = math.random(2000, 4000) / 1000 + + self:addEventListener(Event.ENTER_FRAME, self.onEnterFrame, self) +end + +function Bird:onEnterFrame() + self.subframe = self.subframe + 1 + + -- for every 10 frames, we remove the old frame and add the new frame as a child + if self.subframe > 10 then + self:removeChild(self.frames[self.frame]) + + self.frame = self.frame + 1 + if self.frame > self.nframes then + self.frame = 1 + end + + self:addChild(self.frames[self.frame]) + + self.subframe = 0 + end + + -- get the current position + local x,y = self:getPosition() + + -- change the position according to the speed + x = x - self.speedx + y = y + self.speedy + + -- if the bird is out of the screen, set new speed and position + if x < -100 then + self.speedy = math.random(-500, 500) / 1000 + self.speedx = math.random(2000, 4000) / 1000 + x = 540 + y = math.random(160) + 40 + end + + -- set the new position + self:setPosition(x, y) +end diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_black_01.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_black_01.png new file mode 100644 index 000000000..10fda8acb Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_black_01.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_black_02.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_black_02.png new file mode 100644 index 000000000..7ec699179 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_black_02.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_black_03.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_black_03.png new file mode 100644 index 000000000..acfcaa969 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_black_03.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_white_01.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_white_01.png new file mode 100644 index 000000000..be8358cfe Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_white_01.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_white_02.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_white_02.png new file mode 100644 index 000000000..abbbb8f85 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_white_02.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_white_03.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_white_03.png new file mode 100644 index 000000000..8cce5a705 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/bird_white_03.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/button.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/button.lua new file mode 100644 index 000000000..97837880c --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/button.lua @@ -0,0 +1,106 @@ +--[[ +A generic button class + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile +]] + +Button = Core.class(Sprite) + +function Button:init(upState, downState) + self.upState = upState + self.downState = downState + + self.focus = false + + -- set the visual state as "up" + self:updateVisualState(false) + + -- register to all mouse and touch events + self:addEventListener(Event.MOUSE_DOWN, self.onMouseDown, self) + self:addEventListener(Event.MOUSE_MOVE, self.onMouseMove, self) + self:addEventListener(Event.MOUSE_UP, self.onMouseUp, self) + + self:addEventListener(Event.TOUCHES_BEGIN, self.onTouchesBegin, self) + self:addEventListener(Event.TOUCHES_MOVE, self.onTouchesMove, self) + self:addEventListener(Event.TOUCHES_END, self.onTouchesEnd, self) + self:addEventListener(Event.TOUCHES_CANCEL, self.onTouchesCancel, self) +end + +function Button:onMouseDown(event) + if self:hitTestPoint(event.x, event.y) then + self.focus = true + self:updateVisualState(true) + event:stopPropagation() + end +end + +function Button:onMouseMove(event) + if self.focus then + if not self:hitTestPoint(event.x, event.y) then + self.focus = false + self:updateVisualState(false) + end + event:stopPropagation() + end +end + +function Button:onMouseUp(event) + if self.focus then + self.focus = false + self:updateVisualState(false) + self:dispatchEvent(Event.new("click")) -- button is clicked, dispatch "click" event + event:stopPropagation() + end +end + +-- if button is on focus, stop propagation of touch events +function Button:onTouchesBegin(event) + if self.focus then + event:stopPropagation() + end +end + +-- if button is on focus, stop propagation of touch events +function Button:onTouchesMove(event) + if self.focus then + event:stopPropagation() + end +end + +-- if button is on focus, stop propagation of touch events +function Button:onTouchesEnd(event) + if self.focus then + event:stopPropagation() + end +end + +-- if touches are cancelled, reset the state of the button +function Button:onTouchesCancel(event) + if self.focus then + self.focus = false; + self:updateVisualState(false) + event:stopPropagation() + end +end + +-- if state is true show downState else show upState +function Button:updateVisualState(state) + if state then + if self:contains(self.upState) then + self:removeChild(self.upState) + end + + if not self:contains(self.downState) then + self:addChild(self.downState) + end + else + if self:contains(self.downState) then + self:removeChild(self.downState) + end + + if not self:contains(self.upState) then + self:addChild(self.upState) + end + end +end diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/button_down.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/button_down.png new file mode 100644 index 000000000..1bcb1a754 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/button_down.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/button_up.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/button_up.png new file mode 100644 index 000000000..d0fa50c92 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/button_up.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/diving_turtle.mp3 b/winrt_example/giderosgame/giderosgame.Windows/Assets/diving_turtle.mp3 new file mode 100644 index 000000000..0a27fda58 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/diving_turtle.mp3 differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/ego.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/ego.png new file mode 100644 index 000000000..c075e6a22 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/ego.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/luafiles.txt b/winrt_example/giderosgame/giderosgame.Windows/Assets/luafiles.txt new file mode 100644 index 000000000..5bddc53f6 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/luafiles.txt @@ -0,0 +1 @@ +main.lua diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/main.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/main.lua new file mode 100644 index 000000000..6905d0a9c --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/main.lua @@ -0,0 +1,58 @@ + +t=0 + +function update() + t=t+1 + application:setBackgroundColor(0xff00+t%256) + + local x,y=rect:getPosition() + x=x+math.sin(0.01*t) + y=y+math.cos(0.01*t) + rect:setPosition(x,y) + rect:setRotation(t) + + ego:setScale(2*math.sin(0.01*t)) +end + +application:setBackgroundColor(0) + +rect=Shape.new() + +rect:setFillStyle(Shape.SOLID,0xff00ff) +rect:setLineStyle(20,0x0000ff) + +rect:beginPath() +rect:moveTo(-50,-50) +rect:lineTo(50,-50) +rect:lineTo(50,50) +rect:lineTo(-50,50) +rect:closePath() +rect:endPath() + +stage:addChild(rect) + +rect:setPosition(450,300) + +ego=Bitmap.new(Texture.new("ball.png")) +stage:addChild(ego) +ego:setPosition(600,200) +--ego:setAnchorPoint(0.5,0.5) + +text=TextField.new(nil,"Gideros on WinRT!") +stage:addChild(text) +text:setPosition(20,20) +text:setScale(2) +text:setRotation(45) +text:setTextColor(0xff00ff) + +local rt1 = RenderTarget.new(500, 500, true) +rt1:clear(0xff0000,1) +brt1 = Bitmap.new(rt1) +stage:addChild(brt1) +brt1:setPosition(50,50) + +local bitmap = Bitmap.new(Texture.new("ball.png")) +bitmap:setPosition(0,0) +rt1:draw(bitmap) + +stage:addEventListener(Event.ENTER_FRAME,update) diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/main1.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/main1.lua new file mode 100644 index 000000000..59d4fb357 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/main1.lua @@ -0,0 +1,49 @@ + +t=0 + +function update() + t=t+1 + application:setBackgroundColor(0xff00+t%256) + + local x,y=rect:getPosition() + x=x+math.sin(0.01*t) + y=y+math.cos(0.01*t) + rect:setPosition(x,y) + rect:setRotation(t) + + ego:setScale(2*math.sin(0.01*t)) +end + +application:setBackgroundColor(0) + +rect=Shape.new() + +rect:setFillStyle(Shape.SOLID,0xff0000) +rect:setLineStyle(20,0x0000ff) + +rect:beginPath() +rect:moveTo(-50,-50) +rect:lineTo(50,-50) +rect:lineTo(50,50) +rect:lineTo(-50,50) +rect:closePath() +rect:endPath() + +stage:addChild(rect) + +rect:setPosition(150,150) +rect:setScale(2) + +ego=Bitmap.new(Texture.new("ego.png")) +stage:addChild(ego) +ego:setPosition(100,100) +ego:setAnchorPoint(0.5,0.5) + +text=TextField.new(nil,"Gideros on WinRT!") +stage:addChild(text) +text:setPosition(20,20) +text:setScale(2) +text:setRotation(45) +text:setTextColor(0xff00ff) + +stage:addEventListener(Event.ENTER_FRAME,update) diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/main2.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/main2.lua new file mode 100644 index 000000000..e5e38ba82 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/main2.lua @@ -0,0 +1,38 @@ +--[[ + +A frame by frame bird animation example +The old frame is removed by Sprite:removeChild and the new frame is added by Sprite:addChild + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile + +]] + +application:setBackgroundColor(255) + +-- load texture, create bitmap from it and set as background +local background = Bitmap.new(Texture.new("sky_world.png")) +stage:addChild(background) + +-- these arrays contain the image file names of each frame +local frames1 = { + "bird_black_01.png", + "bird_black_02.png", + "bird_black_03.png"} + +local frames2 = { + "bird_white_01.png", + "bird_white_02.png", + "bird_white_03.png"} + +-- create 2 white and 2 black birds +local bird1 = Bird.new(frames1) +local bird2 = Bird.new(frames1) +local bird3 = Bird.new(frames2) +local bird4 = Bird.new(frames2) + +-- add birds to the stage +stage:addChild(bird1) +stage:addChild(bird2) +stage:addChild(bird3) +stage:addChild(bird4) diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/mainaudio.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/mainaudio.lua new file mode 100644 index 000000000..dec5d6c3f --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/mainaudio.lua @@ -0,0 +1,25 @@ +--[[ + +This is an example of sound capabilities of Gideros Studio + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile + +]] + +local s1 = SoundButton.new("1-up.png", "1-down.png", "1.wav") +local s2 = SoundButton.new("2-up.png", "2-down.png", "2.wav") +local s3 = SoundButton.new("3-up.png", "3-down.png", "3.wav") + +s1:setPosition(10, 50) +s2:setPosition(110, 50) +s3:setPosition(210, 50) + +stage:addChild(s1) +stage:addChild(s2) +stage:addChild(s3) + + +local label = TextField.new(nil, "click buttons to play sounds") -- we pass first parameter as nil to use the system font +label:setPosition(86, 170) +stage:addChild(label) diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/mainbutton.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/mainbutton.lua new file mode 100644 index 000000000..43be0bfa5 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/mainbutton.lua @@ -0,0 +1,31 @@ +--[[ + +This example demonstrates a generic Button class + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile + +]] + +-- create a label to show number of clicks +local label = TextField.new(nil, "Clicked an amazing 0 time(s)") +label:setPosition(120, 240) +stage:addChild(label) + +-- create the up and down sprites for the button +local up = Bitmap.new(Texture.new("button_up.png")) +local down = Bitmap.new(Texture.new("button_down.png")) + +-- create the button +local button = Button.new(up, down) + +-- register to "click" event +local click = 0 +button:addEventListener("click", + function() + click = click + 1 + label:setText("Clicked dddd" .. click .. " time(s)") + end) + +button:setPosition(40, 150) +stage:addChild(button) diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/mainfont.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/mainfont.lua new file mode 100644 index 000000000..4b6165816 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/mainfont.lua @@ -0,0 +1,29 @@ +--[[ + +An example of loading and displaying custom fonts + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2013 Gideros Mobile + +]] + +local font1 = Font.new("billo.fnt", "billo.png") -- this is bitmap font +local font2 = TTFont.new("billo.ttf", 50, " !abcdefgh") -- this is TTFont with caching +local font3 = TTFont.new("arial.ttf", 20) -- this is TTFont without caching + +local text1 = TextField.new(font1, "!!abcdefgh!!") +local text2 = TextField.new(font2, "!!abcdefgh!!") +local text3 = TextField.new(font3, "Îñţérñåţîöñåļîžåţîöñ (UTF-8)") +local text4 = TextField.new(nil, "and this bottom line shows embedded system font") + +text2:setTextColor(0xff6090) + +text1:setPosition(10, 100) +text2:setPosition(10, 200) +text3:setPosition(10, 300) +text4:setPosition(10, 380) + +stage:addChild(text1) +stage:addChild(text2) +stage:addChild(text3) +stage:addChild(text4) diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/maininfballs.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/maininfballs.lua new file mode 100644 index 000000000..f6a479b99 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/maininfballs.lua @@ -0,0 +1,84 @@ +--[[ +Infinity balls +by Doctor Max +(c)2013-10-13 +--]] + +local rt1 = RenderTarget.new(320, 480, true) +local rt2 = RenderTarget.new(320, 480, true) +local rt3 = RenderTarget.new(320, 480, true) +local rt4 = RenderTarget.new(320, 480, true) +local rt5 = RenderTarget.new(320, 480, true) +local rt6 = RenderTarget.new(320, 480, true) +local rt7 = RenderTarget.new(320, 480, true) +local rt8 = RenderTarget.new(320, 480, true) + +brt1 = Bitmap.new(rt1); brt2 = Bitmap.new(rt2) +brt3 = Bitmap.new(rt3); brt4 = Bitmap.new(rt4) +brt5 = Bitmap.new(rt5); brt6 = Bitmap.new(rt6) +brt7 = Bitmap.new(rt7); brt8 = Bitmap.new(rt8) + +s1 = Sprite.new(); s2 = Sprite.new() +s3 = Sprite.new(); s4 = Sprite.new() +s5 = Sprite.new(); s6 = Sprite.new() +s7 = Sprite.new(); s8 = Sprite.new() + +s1:addChild(brt1); s2:addChild(brt2) +s3:addChild(brt3); s4:addChild(brt4) +s5:addChild(brt5); s6:addChild(brt6) +s7:addChild(brt7); s8:addChild(brt8) + +dx = 0; dy = 0; frame = 1 + +local function onEnterFrame(event) + local t = os.timer() + local x = math.sin((t/2) + dx) * 100 + 120 + local y = math.cos((t/3) + dy) * 200 + 210 + + dx = dx + 0.005 + dy = dy + 0.009 + local bitmap = Bitmap.new(Texture.new("ball.png")) + bitmap:setPosition(x, y) + + if frame == 1 then + rt1:draw(bitmap) + stage:removeChild(s1) + stage:addChild(s2) + elseif frame == 2 then + rt2:draw(bitmap) + stage:removeChild(s2) + stage:addChild(s3) + elseif frame == 3 then + rt3:draw(bitmap) + stage:removeChild(s3) + stage:addChild(s4) + elseif frame == 4 then + rt4:draw(bitmap) + stage:removeChild(s4) + stage:addChild(s5) + elseif frame == 5 then + rt5:draw(bitmap) + stage:removeChild(s5) + stage:addChild(s6) + elseif frame == 6 then + rt6:draw(bitmap) + stage:removeChild(s6) + stage:addChild(s7) + elseif frame == 7 then + rt7:draw(bitmap) + stage:removeChild(s7) + stage:addChild(s8) + elseif frame == 8 then + rt8:draw(bitmap) + stage:removeChild(s8) + stage:addChild(s1) +end + + frame = frame + 1 + if frame == 9 then + frame = 1 + end +end + +stage:addChild(s1) +stage:addEventListener(Event.ENTER_FRAME, onEnterFrame) diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/mainr2t.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/mainr2t.lua new file mode 100644 index 000000000..6aa456ace --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/mainr2t.lua @@ -0,0 +1,58 @@ + +t=0 + +function update() + t=t+1 + application:setBackgroundColor(0xff00+t%256) + + local x,y=rect:getPosition() + x=x+math.sin(0.01*t) + y=y+math.cos(0.01*t) + rect:setPosition(x,y) + rect:setRotation(t) + + ego:setScale(2*math.sin(0.01*t)) +end + +application:setBackgroundColor(0) + +rect=Shape.new() + +rect:setFillStyle(Shape.SOLID,0xff0000) +rect:setLineStyle(20,0x0000ff) + +rect:beginPath() +rect:moveTo(-50,-50) +rect:lineTo(50,-50) +rect:lineTo(50,50) +rect:lineTo(-50,50) +rect:closePath() +rect:endPath() + +--stage:addChild(rect) + +rect:setPosition(450,300) + +ego=Bitmap.new(Texture.new("ball.png")) +stage:addChild(ego) +ego:setPosition(600,200) +--ego:setAnchorPoint(0.5,0.5) + +--text=TextField.new(nil,"Gideros on WinRT!") +--stage:addChild(text) +--text:setPosition(20,20) +--text:setScale(2) +--text:setRotation(45) +--text:setTextColor(0xff00ff) + +local rt1 = RenderTarget.new(500, 500, true) +rt1:clear(0xff0000,1) +brt1 = Bitmap.new(rt1) +stage:addChild(brt1) +brt1:setPosition(50,50) + +local bitmap = Bitmap.new(Texture.new("ball.png")) +bitmap:setPosition(20,20) +rt1:draw(bitmap) + +stage:addEventListener(Event.ENTER_FRAME,update) diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/properties.bin b/winrt_example/giderosgame/giderosgame.Windows/Assets/properties.bin new file mode 100644 index 000000000..e6c2c6a9a Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/properties.bin differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/properties.bird.bin b/winrt_example/giderosgame/giderosgame.Windows/Assets/properties.bird.bin new file mode 100644 index 000000000..e6c2c6a9a Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/properties.bird.bin differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/properties.nebula.bin b/winrt_example/giderosgame/giderosgame.Windows/Assets/properties.nebula.bin new file mode 100644 index 000000000..ddbefb29d Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/properties.nebula.bin differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/sky_world.png b/winrt_example/giderosgame/giderosgame.Windows/Assets/sky_world.png new file mode 100644 index 000000000..5df6aa8c1 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.Windows/Assets/sky_world.png differ diff --git a/winrt_example/giderosgame/giderosgame.Windows/Assets/soundbutton.lua b/winrt_example/giderosgame/giderosgame.Windows/Assets/soundbutton.lua new file mode 100644 index 000000000..907b37472 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Assets/soundbutton.lua @@ -0,0 +1,19 @@ +--[[ +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile +]] + +SoundButton = Core.class(Sprite) + +function SoundButton:init(upimage, downimage, soundfile) + local up = Bitmap.new(Texture.new(upimage)) + local down = Bitmap.new(Texture.new(downimage)) + local button = Button.new(up, down) + + self:addChild(button) + + local sound = Sound.new(soundfile) + + button:addEventListener("click", function() sound:play() end) +end + diff --git a/winrt_example/giderosgame/giderosgame.Windows/Package.appxmanifest b/winrt_example/giderosgame/giderosgame.Windows/Package.appxmanifest new file mode 100644 index 000000000..7e7093144 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/Package.appxmanifest @@ -0,0 +1,42 @@ + + + + + + + giderosgame.Windows + John + Assets\StoreLogo.png + + + + 6.3.0 + 6.3.0 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/winrt_example/giderosgame/giderosgame.Windows/giderosgame.Windows.vcxproj b/winrt_example/giderosgame/giderosgame.Windows/giderosgame.Windows.vcxproj new file mode 100644 index 000000000..5b50f512f --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/giderosgame.Windows.vcxproj @@ -0,0 +1,267 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + + {69d0dc6b-44c5-4d2e-a0ed-4ff49ce10786} + giderosgame + en-US + 12.0 + true + Windows Store + 8.1 + + + + Application + true + v120 + + + Application + true + v120 + + + Application + true + v120 + + + Application + false + true + v120 + + + Application + false + true + v120 + + + Application + false + true + v120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + giderosgame.Windows_TemporaryKey.pfx + + + + + gideros.Windows.lib;libgvfswinrt.Windows.lib;luawinrt.Windows.lib;xaudio2.lib;d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + c:\gideros_liberton\gideros\winrt\ARM\Debug\gideros.Windows;c:\gideros_liberton\gideros\libgvfs\libgvfswinrt\ARM\Debug\libgvfswinrt.Windows;c:\gideros_liberton\gideros\lua\luawinrt\ARM\Debug\luawinrt.Windows;%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libnetwork;c:\gideros_liberton\gideros\2dsg;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\luabinding;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\include;c:\gideros_liberton\gideros\winrt;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + PTW32_STATIC_LIB;WINSTORE;_DEBUG;%(PreprocessorDefinitions) + false + NotUsing + + + + + gideros.Windows.lib;libgvfswinrt.Windows.lib;luawinrt.Windows.lib;xaudio2.lib;d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + c:\gideros_liberton\gideros\winrt\ARM\Release\gideros.Windows;c:\gideros_liberton\gideros\libgvfs\libgvfswinrt\ARM\Release\libgvfswinrt.Windows;c:\gideros_liberton\gideros\lua\luawinrt\ARM\Release\luawinrt.Windows;%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libnetwork;c:\gideros_liberton\gideros\2dsg;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\luabinding;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\include;c:\gideros_liberton\gideros\winrt;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + PTW32_STATIC_LIB;WINSTORE;NDEBUG;%(PreprocessorDefinitions) + false + NotUsing + + + + + gideros.Windows.lib;libgvfswinrt.Windows.lib;luawinrt.Windows.lib;xaudio2.lib;d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + ..\..\..\winrt\Debug\gideros.Windows;..\..\..\libgvfs\libgvfswinrt\Debug\libgvfswinrt.Windows;..\..\..\lua\luawinrt\Debug\luawinrt.Windows;%(AdditionalLibraryDirectories);$(VCInstallDir)\lib\store;$(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + ..\..\..\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;..\..\..\libgvfs;..\..\..\lua\src;..\..\..\libnetwork;..\..\..\2dsg;..\..\..\libplatform;..\..\..\luabinding;..\..\..\libgideros;..\..\..\libgid\include\winrt;..\..\..\libgid\include;..\..\..\winrt;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + PTW32_STATIC_LIB;WINSTORE;_DEBUG;%(PreprocessorDefinitions) + false + NotUsing + + + + + gideros.Windows.lib;libgvfswinrt.Windows.lib;luawinrt.Windows.lib;xaudio2.lib;d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + c:\gideros_liberton\gideros\winrt\Release\gideros.Windows;c:\gideros_liberton\gideros\libgvfs\libgvfswinrt\Release\libgvfswinrt.Windows;c:\gideros_liberton\gideros\lua\luawinrt\Release\luawinrt.Windows;%(AdditionalLibraryDirectories);$(VCInstallDir)\lib\store;$(VCInstallDir)\lib + false + + + pch.h + $(IntDir)pch.pch + c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libnetwork;c:\gideros_liberton\gideros\2dsg;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\luabinding;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\include;c:\gideros_liberton\gideros\winrt;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + PTW32_STATIC_LIB;WINSTORE;NDEBUG;%(PreprocessorDefinitions) + false + NotUsing + + + + + d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + _DEBUG;%(PreprocessorDefinitions) + + + + + d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + NDEBUG;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/winrt_example/giderosgame/giderosgame.Windows/giderosgame.Windows.vcxproj.filters b/winrt_example/giderosgame/giderosgame.Windows/giderosgame.Windows.vcxproj.filters new file mode 100644 index 000000000..edeec0711 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.Windows/giderosgame.Windows.vcxproj.filters @@ -0,0 +1,140 @@ + + + + + 69d0dc6b-44c5-4d2e-a0ed-4ff49ce10786 + + + 4c66aa92-b2c2-4b70-9365-c9bac236cfcc + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + 915fca05-76ad-4f6f-952b-e8f562507971 + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + Assets + + + + + Assets + + + Assets + + + + + Assets + + + Assets + + + Assets + + + Assets + + + \ No newline at end of file diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/1-down.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/1-down.png new file mode 100644 index 000000000..0a9223d28 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/1-down.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/1-up.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/1-up.png new file mode 100644 index 000000000..610fe2d75 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/1-up.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/1.wav b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/1.wav new file mode 100644 index 000000000..c2c2a128d Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/1.wav differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/2-down.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/2-down.png new file mode 100644 index 000000000..193090501 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/2-down.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/2-up.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/2-up.png new file mode 100644 index 000000000..c1d5e5d42 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/2-up.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/2.wav b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/2.wav new file mode 100644 index 000000000..e3d6141ec Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/2.wav differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/3-down.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/3-down.png new file mode 100644 index 000000000..0d8c2b201 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/3-down.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/3-up.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/3-up.png new file mode 100644 index 000000000..ce1c2cd75 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/3-up.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/3.wav b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/3.wav new file mode 100644 index 000000000..9b5182734 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/3.wav differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Audio Example.gproj b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Audio Example.gproj new file mode 100644 index 000000000..30688ff46 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Audio Example.gproj @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Logo.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Logo.png new file mode 100644 index 000000000..e26771cb3 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Logo.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Logo.scale-240.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Logo.scale-240.png new file mode 100644 index 000000000..76921ca99 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Logo.scale-240.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/PixelShader.cso b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/PixelShader.cso new file mode 100644 index 000000000..4286b277d Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/PixelShader.cso differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SmallLogo.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SmallLogo.png new file mode 100644 index 000000000..1eb0d9d52 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SmallLogo.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SmallLogo.scale-240.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SmallLogo.scale-240.png new file mode 100644 index 000000000..316630124 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SmallLogo.scale-240.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SplashScreen.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SplashScreen.png new file mode 100644 index 000000000..c951e031b Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SplashScreen.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SplashScreen.scale-240.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SplashScreen.scale-240.png new file mode 100644 index 000000000..33f26b331 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/SplashScreen.scale-240.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Square71x71Logo.scale-240.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Square71x71Logo.scale-240.png new file mode 100644 index 000000000..cfa54bee0 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/Square71x71Logo.scale-240.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/StoreLogo.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/StoreLogo.png new file mode 100644 index 000000000..dcb672712 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/StoreLogo.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/StoreLogo.scale-240.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/StoreLogo.scale-240.png new file mode 100644 index 000000000..47e084b59 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/StoreLogo.scale-240.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/VertexShader.cso b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/VertexShader.cso new file mode 100644 index 000000000..00c0741d8 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/VertexShader.cso differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/WideLogo.scale-240.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/WideLogo.scale-240.png new file mode 100644 index 000000000..6249d29db Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/WideLogo.scale-240.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/arial.ttf b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/arial.ttf new file mode 100644 index 000000000..ff0815cd8 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/arial.ttf differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/ball.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/ball.png new file mode 100644 index 000000000..b62f57e3c Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/ball.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/billo.fnt b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/billo.fnt new file mode 100644 index 000000000..af67d6db2 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/billo.fnt @@ -0,0 +1,99 @@ +info face="Billo" size=50 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2 +common lineHeight=75 base=41 scaleW=512 scaleH=512 pages=1 packed=0 +page id=0 file="billo.png" +chars count=95 +char id=32 x=320 y=306 width=0 height=0 xoffset=0 yoffset=48 xadvance=18 page=0 chnl=0 letter="space" +char id=33 x=180 y=139 width=19 height=44 xoffset=2 yoffset=6 xadvance=11 page=0 chnl=0 letter="!" +char id=34 x=132 y=306 width=27 height=22 xoffset=2 yoffset=5 xadvance=22 page=0 chnl=0 letter=""" +char id=35 x=434 y=233 width=32 height=32 xoffset=2 yoffset=16 xadvance=26 page=0 chnl=0 letter="#" +char id=36 x=78 y=139 width=32 height=46 xoffset=2 yoffset=8 xadvance=27 page=0 chnl=0 letter="$" +char id=37 x=222 y=139 width=37 height=43 xoffset=1 yoffset=5 xadvance=31 page=0 chnl=0 letter="%" +char id=38 x=298 y=233 width=32 height=32 xoffset=2 yoffset=10 xadvance=26 page=0 chnl=0 letter="&" +char id=39 x=180 y=306 width=17 height=22 xoffset=2 yoffset=5 xadvance=11 page=0 chnl=0 letter="'" +char id=40 x=398 y=188 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="(" +char id=41 x=193 y=188 width=50 height=40 xoffset=2 yoffset=7 xadvance=44 page=0 chnl=0 letter=")" +char id=42 x=222 y=306 width=19 height=20 xoffset=2 yoffset=20 xadvance=16 page=0 chnl=0 letter="*" +char id=43 x=36 y=272 width=32 height=32 xoffset=2 yoffset=10 xadvance=26 page=0 chnl=0 letter="+" +char id=44 x=161 y=306 width=17 height=22 xoffset=2 yoffset=31 xadvance=11 page=0 chnl=0 letter="," +char id=45 x=277 y=306 width=22 height=17 xoffset=2 yoffset=22 xadvance=16 page=0 chnl=0 letter="-" +char id=46 x=301 y=306 width=17 height=17 xoffset=2 yoffset=31 xadvance=11 page=0 chnl=0 letter="." +char id=47 x=36 y=188 width=28 height=43 xoffset=-0 yoffset=5 xadvance=19 page=0 chnl=0 letter="/" +char id=48 x=332 y=233 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="0" +char id=49 x=65 y=306 width=17 height=32 xoffset=2 yoffset=16 xadvance=11 page=0 chnl=0 letter="1" +char id=50 x=468 y=233 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="2" +char id=51 x=34 y=306 width=29 height=32 xoffset=2 yoffset=16 xadvance=23 page=0 chnl=0 letter="3" +char id=52 x=400 y=233 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="4" +char id=53 x=2 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="5" +char id=54 x=410 y=272 width=30 height=32 xoffset=2 yoffset=16 xadvance=24 page=0 chnl=0 letter="6" +char id=55 x=474 y=272 width=30 height=32 xoffset=2 yoffset=16 xadvance=25 page=0 chnl=0 letter="7" +char id=56 x=366 y=233 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="8" +char id=57 x=442 y=272 width=30 height=32 xoffset=2 yoffset=16 xadvance=24 page=0 chnl=0 letter="9" +char id=58 x=84 y=306 width=17 height=32 xoffset=2 yoffset=16 xadvance=11 page=0 chnl=0 letter=":" +char id=59 x=149 y=233 width=17 height=37 xoffset=2 yoffset=16 xadvance=11 page=0 chnl=0 letter=";" +char id=60 x=2 y=233 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="<" +char id=61 x=103 y=306 width=27 height=27 xoffset=2 yoffset=16 xadvance=22 page=0 chnl=0 letter="=" +char id=62 x=297 y=188 width=50 height=40 xoffset=2 yoffset=7 xadvance=44 page=0 chnl=0 letter=">" +char id=63 x=115 y=188 width=24 height=41 xoffset=2 yoffset=9 xadvance=19 page=0 chnl=0 letter="?" +char id=64 x=264 y=233 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="@" +char id=65 x=190 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="A" +char id=66 x=380 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="B" +char id=67 x=268 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="C" +char id=68 x=224 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="D" +char id=69 x=41 y=139 width=35 height=47 xoffset=-0 yoffset=14 xadvance=24 page=0 chnl=0 letter="E" +char id=70 x=458 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="F" +char id=71 x=43 y=2 width=37 height=61 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="G" +char id=72 x=263 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="H" +char id=73 x=121 y=2 width=27 height=61 xoffset=-2 yoffset=0 xadvance=11 page=0 chnl=0 letter="I" +char id=74 x=2 y=2 width=39 height=75 xoffset=-14 yoffset=0 xadvance=11 page=0 chnl=0 letter="J" +char id=75 x=302 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="K" +char id=76 x=2 y=79 width=22 height=58 xoffset=-0 yoffset=3 xadvance=11 page=0 chnl=0 letter="L" +char id=77 x=98 y=79 width=51 height=47 xoffset=-0 yoffset=14 xadvance=40 page=0 chnl=0 letter="M" +char id=78 x=307 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="N" +char id=79 x=151 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="O" +char id=80 x=419 y=2 width=37 height=58 xoffset=-0 yoffset=13 xadvance=27 page=0 chnl=0 letter="P" +char id=81 x=185 y=2 width=37 height=58 xoffset=-0 yoffset=13 xadvance=27 page=0 chnl=0 letter="Q" +char id=82 x=463 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="R" +char id=83 x=2 y=139 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="S" +char id=84 x=341 y=2 width=37 height=58 xoffset=-0 yoffset=3 xadvance=27 page=0 chnl=0 letter="T" +char id=85 x=385 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="U" +char id=86 x=229 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="V" +char id=87 x=45 y=79 width=51 height=47 xoffset=-0 yoffset=14 xadvance=40 page=0 chnl=0 letter="W" +char id=88 x=346 y=79 width=37 height=47 xoffset=-1 yoffset=14 xadvance=27 page=0 chnl=0 letter="X" +char id=89 x=82 y=2 width=37 height=61 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="Y" +char id=90 x=424 y=79 width=37 height=47 xoffset=-0 yoffset=14 xadvance=27 page=0 chnl=0 letter="Z" +char id=91 x=447 y=188 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="[" +char id=92 x=66 y=188 width=28 height=43 xoffset=-0 yoffset=5 xadvance=19 page=0 chnl=0 letter="\" +char id=93 x=245 y=188 width=50 height=40 xoffset=2 yoffset=7 xadvance=44 page=0 chnl=0 letter="]" +char id=94 x=51 y=233 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="^" +char id=95 x=243 y=306 width=32 height=17 xoffset=2 yoffset=31 xadvance=26 page=0 chnl=0 letter="_" +char id=96 x=199 y=306 width=21 height=21 xoffset=8 yoffset=1 xadvance=27 page=0 chnl=0 letter="`" +char id=97 x=104 y=272 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="a" +char id=98 x=261 y=139 width=32 height=43 xoffset=2 yoffset=6 xadvance=27 page=0 chnl=0 letter="b" +char id=99 x=138 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="c" +char id=100 x=295 y=139 width=32 height=43 xoffset=2 yoffset=6 xadvance=27 page=0 chnl=0 letter="d" +char id=101 x=2 y=306 width=30 height=32 xoffset=2 yoffset=16 xadvance=24 page=0 chnl=0 letter="e" +char id=102 x=397 y=139 width=32 height=43 xoffset=2 yoffset=5 xadvance=27 page=0 chnl=0 letter="f" +char id=103 x=112 y=139 width=32 height=46 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="g" +char id=104 x=329 y=139 width=32 height=43 xoffset=2 yoffset=5 xadvance=27 page=0 chnl=0 letter="h" +char id=105 x=201 y=139 width=19 height=44 xoffset=2 yoffset=4 xadvance=11 page=0 chnl=0 letter="i" +char id=106 x=150 y=2 width=33 height=59 xoffset=-12 yoffset=3 xadvance=11 page=0 chnl=0 letter="j" +char id=107 x=363 y=139 width=32 height=43 xoffset=2 yoffset=5 xadvance=27 page=0 chnl=0 letter="k" +char id=108 x=96 y=188 width=17 height=43 xoffset=2 yoffset=5 xadvance=11 page=0 chnl=0 letter="l" +char id=109 x=216 y=233 width=46 height=32 xoffset=2 yoffset=16 xadvance=40 page=0 chnl=0 letter="m" +char id=110 x=274 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="n" +char id=111 x=70 y=272 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="o" +char id=112 x=431 y=139 width=32 height=43 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="p" +char id=113 x=465 y=139 width=32 height=43 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="q" +char id=114 x=376 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="r" +char id=115 x=172 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="s" +char id=116 x=2 y=188 width=32 height=43 xoffset=2 yoffset=5 xadvance=27 page=0 chnl=0 letter="t" +char id=117 x=308 y=272 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="u" +char id=118 x=206 y=272 width=32 height=32 xoffset=2 yoffset=17 xadvance=27 page=0 chnl=0 letter="v" +char id=119 x=168 y=233 width=46 height=32 xoffset=2 yoffset=17 xadvance=40 page=0 chnl=0 letter="w" +char id=120 x=240 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="x" +char id=121 x=146 y=139 width=32 height=46 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="y" +char id=122 x=342 y=272 width=32 height=32 xoffset=2 yoffset=16 xadvance=27 page=0 chnl=0 letter="z" +char id=123 x=349 y=188 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="{" +char id=124 x=26 y=79 width=17 height=53 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=0 letter="|" +char id=125 x=141 y=188 width=50 height=40 xoffset=2 yoffset=7 xadvance=44 page=0 chnl=0 letter="}" +char id=126 x=100 y=233 width=47 height=37 xoffset=2 yoffset=10 xadvance=42 page=0 chnl=0 letter="~" diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/billo.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/billo.png new file mode 100644 index 000000000..9f4c050be Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/billo.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/billo.ttf b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/billo.ttf new file mode 100644 index 000000000..a7283cb79 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/billo.ttf differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird.lua new file mode 100644 index 000000000..8b416298f --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird.lua @@ -0,0 +1,68 @@ +--[[ +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile +--]] + +Bird = Core.class(Sprite) + +function Bird:init(frameList) + -- create a Bitmap for each frame + self.frames = {} + for i = 1, #frameList do + self.frames[i] = Bitmap.new(Texture.new(frameList[i])) + end + + self.nframes = #frameList + + -- add first Bitmap as a child + self.frame = 1 + self:addChild(self.frames[1]) + + -- subframe is used to adjust the speed of animation + self.subframe = 0 + + -- set initial position + self:setPosition(540, math.random(160) + 40) + + -- set the speed of the bird + self.speedy = math.random(-500, 500) / 1000 + self.speedx = math.random(2000, 4000) / 1000 + + self:addEventListener(Event.ENTER_FRAME, self.onEnterFrame, self) +end + +function Bird:onEnterFrame() + self.subframe = self.subframe + 1 + + -- for every 10 frames, we remove the old frame and add the new frame as a child + if self.subframe > 10 then + self:removeChild(self.frames[self.frame]) + + self.frame = self.frame + 1 + if self.frame > self.nframes then + self.frame = 1 + end + + self:addChild(self.frames[self.frame]) + + self.subframe = 0 + end + + -- get the current position + local x,y = self:getPosition() + + -- change the position according to the speed + x = x - self.speedx + y = y + self.speedy + + -- if the bird is out of the screen, set new speed and position + if x < -100 then + self.speedy = math.random(-500, 500) / 1000 + self.speedx = math.random(2000, 4000) / 1000 + x = 540 + y = math.random(160) + 40 + end + + -- set the new position + self:setPosition(x, y) +end diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_black_01.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_black_01.png new file mode 100644 index 000000000..10fda8acb Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_black_01.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_black_02.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_black_02.png new file mode 100644 index 000000000..7ec699179 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_black_02.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_black_03.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_black_03.png new file mode 100644 index 000000000..acfcaa969 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_black_03.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_white_01.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_white_01.png new file mode 100644 index 000000000..be8358cfe Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_white_01.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_white_02.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_white_02.png new file mode 100644 index 000000000..abbbb8f85 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_white_02.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_white_03.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_white_03.png new file mode 100644 index 000000000..8cce5a705 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/bird_white_03.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/button.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/button.lua new file mode 100644 index 000000000..97837880c --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/button.lua @@ -0,0 +1,106 @@ +--[[ +A generic button class + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile +]] + +Button = Core.class(Sprite) + +function Button:init(upState, downState) + self.upState = upState + self.downState = downState + + self.focus = false + + -- set the visual state as "up" + self:updateVisualState(false) + + -- register to all mouse and touch events + self:addEventListener(Event.MOUSE_DOWN, self.onMouseDown, self) + self:addEventListener(Event.MOUSE_MOVE, self.onMouseMove, self) + self:addEventListener(Event.MOUSE_UP, self.onMouseUp, self) + + self:addEventListener(Event.TOUCHES_BEGIN, self.onTouchesBegin, self) + self:addEventListener(Event.TOUCHES_MOVE, self.onTouchesMove, self) + self:addEventListener(Event.TOUCHES_END, self.onTouchesEnd, self) + self:addEventListener(Event.TOUCHES_CANCEL, self.onTouchesCancel, self) +end + +function Button:onMouseDown(event) + if self:hitTestPoint(event.x, event.y) then + self.focus = true + self:updateVisualState(true) + event:stopPropagation() + end +end + +function Button:onMouseMove(event) + if self.focus then + if not self:hitTestPoint(event.x, event.y) then + self.focus = false + self:updateVisualState(false) + end + event:stopPropagation() + end +end + +function Button:onMouseUp(event) + if self.focus then + self.focus = false + self:updateVisualState(false) + self:dispatchEvent(Event.new("click")) -- button is clicked, dispatch "click" event + event:stopPropagation() + end +end + +-- if button is on focus, stop propagation of touch events +function Button:onTouchesBegin(event) + if self.focus then + event:stopPropagation() + end +end + +-- if button is on focus, stop propagation of touch events +function Button:onTouchesMove(event) + if self.focus then + event:stopPropagation() + end +end + +-- if button is on focus, stop propagation of touch events +function Button:onTouchesEnd(event) + if self.focus then + event:stopPropagation() + end +end + +-- if touches are cancelled, reset the state of the button +function Button:onTouchesCancel(event) + if self.focus then + self.focus = false; + self:updateVisualState(false) + event:stopPropagation() + end +end + +-- if state is true show downState else show upState +function Button:updateVisualState(state) + if state then + if self:contains(self.upState) then + self:removeChild(self.upState) + end + + if not self:contains(self.downState) then + self:addChild(self.downState) + end + else + if self:contains(self.downState) then + self:removeChild(self.downState) + end + + if not self:contains(self.upState) then + self:addChild(self.upState) + end + end +end diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/button_down.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/button_down.png new file mode 100644 index 000000000..1bcb1a754 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/button_down.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/button_up.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/button_up.png new file mode 100644 index 000000000..d0fa50c92 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/button_up.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/diving_turtle.mp3 b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/diving_turtle.mp3 new file mode 100644 index 000000000..0a27fda58 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/diving_turtle.mp3 differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/ego.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/ego.png new file mode 100644 index 000000000..c075e6a22 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/ego.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/luafiles.txt b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/luafiles.txt new file mode 100644 index 000000000..bbecc7893 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/luafiles.txt @@ -0,0 +1,3 @@ +button.lua +soundbutton.lua +main.lua diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/main.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/main.lua new file mode 100644 index 000000000..84fd14b77 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/main.lua @@ -0,0 +1,27 @@ +--[[ + +This is an example of sound capabilities of Gideros Studio + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile + +]] + +local s1 = SoundButton.new("1-up.png", "1-down.png", "1.wav") +local s2 = SoundButton.new("2-up.png", "2-down.png", "2.wav") +local s3 = SoundButton.new("3-up.png", "3-down.png", "3.wav") + +s1:setPosition(10, 50) +s2:setPosition(110, 50) +s3:setPosition(210, 50) + +stage:addChild(s1) +stage:addChild(s2) +stage:addChild(s3) + + +local label = TextField.new(nil, "click buttons to play sounds") -- we pass first parameter as nil to use the system font +label:setPosition(86, 170) +stage:addChild(label) + +print ("hello world!") diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/main1.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/main1.lua new file mode 100644 index 000000000..59d4fb357 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/main1.lua @@ -0,0 +1,49 @@ + +t=0 + +function update() + t=t+1 + application:setBackgroundColor(0xff00+t%256) + + local x,y=rect:getPosition() + x=x+math.sin(0.01*t) + y=y+math.cos(0.01*t) + rect:setPosition(x,y) + rect:setRotation(t) + + ego:setScale(2*math.sin(0.01*t)) +end + +application:setBackgroundColor(0) + +rect=Shape.new() + +rect:setFillStyle(Shape.SOLID,0xff0000) +rect:setLineStyle(20,0x0000ff) + +rect:beginPath() +rect:moveTo(-50,-50) +rect:lineTo(50,-50) +rect:lineTo(50,50) +rect:lineTo(-50,50) +rect:closePath() +rect:endPath() + +stage:addChild(rect) + +rect:setPosition(150,150) +rect:setScale(2) + +ego=Bitmap.new(Texture.new("ego.png")) +stage:addChild(ego) +ego:setPosition(100,100) +ego:setAnchorPoint(0.5,0.5) + +text=TextField.new(nil,"Gideros on WinRT!") +stage:addChild(text) +text:setPosition(20,20) +text:setScale(2) +text:setRotation(45) +text:setTextColor(0xff00ff) + +stage:addEventListener(Event.ENTER_FRAME,update) diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/main2.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/main2.lua new file mode 100644 index 000000000..5b5b45d9c --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/main2.lua @@ -0,0 +1,38 @@ +--[[ + +A frame by frame bird animation example +The old frame is removed by Sprite:removeChild and the new frame is added by Sprite:addChild + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile + +]] + +application:setBackgroundColor(255) + +-- load texture, create bitmap from it and set as background +local background = Bitmap.new(Texture.new("ego.png")) +stage:addChild(background) + +-- these arrays contain the image file names of each frame +local frames1 = { + "bird_black_01.png", + "bird_black_02.png", + "bird_black_03.png"} + +local frames2 = { + "bird_white_01.png", + "bird_white_02.png", + "bird_white_03.png"} + +-- create 2 white and 2 black birds +local bird1 = Bird.new(frames1) +local bird2 = Bird.new(frames1) +local bird3 = Bird.new(frames2) +local bird4 = Bird.new(frames2) + +-- add birds to the stage +stage:addChild(bird1) +stage:addChild(bird2) +stage:addChild(bird3) +stage:addChild(bird4) diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainaudio.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainaudio.lua new file mode 100644 index 000000000..dec5d6c3f --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainaudio.lua @@ -0,0 +1,25 @@ +--[[ + +This is an example of sound capabilities of Gideros Studio + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile + +]] + +local s1 = SoundButton.new("1-up.png", "1-down.png", "1.wav") +local s2 = SoundButton.new("2-up.png", "2-down.png", "2.wav") +local s3 = SoundButton.new("3-up.png", "3-down.png", "3.wav") + +s1:setPosition(10, 50) +s2:setPosition(110, 50) +s3:setPosition(210, 50) + +stage:addChild(s1) +stage:addChild(s2) +stage:addChild(s3) + + +local label = TextField.new(nil, "click buttons to play sounds") -- we pass first parameter as nil to use the system font +label:setPosition(86, 170) +stage:addChild(label) diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainbutton.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainbutton.lua new file mode 100644 index 000000000..43be0bfa5 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainbutton.lua @@ -0,0 +1,31 @@ +--[[ + +This example demonstrates a generic Button class + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile + +]] + +-- create a label to show number of clicks +local label = TextField.new(nil, "Clicked an amazing 0 time(s)") +label:setPosition(120, 240) +stage:addChild(label) + +-- create the up and down sprites for the button +local up = Bitmap.new(Texture.new("button_up.png")) +local down = Bitmap.new(Texture.new("button_down.png")) + +-- create the button +local button = Button.new(up, down) + +-- register to "click" event +local click = 0 +button:addEventListener("click", + function() + click = click + 1 + label:setText("Clicked dddd" .. click .. " time(s)") + end) + +button:setPosition(40, 150) +stage:addChild(button) diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainfont.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainfont.lua new file mode 100644 index 000000000..4b6165816 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainfont.lua @@ -0,0 +1,29 @@ +--[[ + +An example of loading and displaying custom fonts + +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2013 Gideros Mobile + +]] + +local font1 = Font.new("billo.fnt", "billo.png") -- this is bitmap font +local font2 = TTFont.new("billo.ttf", 50, " !abcdefgh") -- this is TTFont with caching +local font3 = TTFont.new("arial.ttf", 20) -- this is TTFont without caching + +local text1 = TextField.new(font1, "!!abcdefgh!!") +local text2 = TextField.new(font2, "!!abcdefgh!!") +local text3 = TextField.new(font3, "Îñţérñåţîöñåļîžåţîöñ (UTF-8)") +local text4 = TextField.new(nil, "and this bottom line shows embedded system font") + +text2:setTextColor(0xff6090) + +text1:setPosition(10, 100) +text2:setPosition(10, 200) +text3:setPosition(10, 300) +text4:setPosition(10, 380) + +stage:addChild(text1) +stage:addChild(text2) +stage:addChild(text3) +stage:addChild(text4) diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/maininfballs.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/maininfballs.lua new file mode 100644 index 000000000..f6a479b99 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/maininfballs.lua @@ -0,0 +1,84 @@ +--[[ +Infinity balls +by Doctor Max +(c)2013-10-13 +--]] + +local rt1 = RenderTarget.new(320, 480, true) +local rt2 = RenderTarget.new(320, 480, true) +local rt3 = RenderTarget.new(320, 480, true) +local rt4 = RenderTarget.new(320, 480, true) +local rt5 = RenderTarget.new(320, 480, true) +local rt6 = RenderTarget.new(320, 480, true) +local rt7 = RenderTarget.new(320, 480, true) +local rt8 = RenderTarget.new(320, 480, true) + +brt1 = Bitmap.new(rt1); brt2 = Bitmap.new(rt2) +brt3 = Bitmap.new(rt3); brt4 = Bitmap.new(rt4) +brt5 = Bitmap.new(rt5); brt6 = Bitmap.new(rt6) +brt7 = Bitmap.new(rt7); brt8 = Bitmap.new(rt8) + +s1 = Sprite.new(); s2 = Sprite.new() +s3 = Sprite.new(); s4 = Sprite.new() +s5 = Sprite.new(); s6 = Sprite.new() +s7 = Sprite.new(); s8 = Sprite.new() + +s1:addChild(brt1); s2:addChild(brt2) +s3:addChild(brt3); s4:addChild(brt4) +s5:addChild(brt5); s6:addChild(brt6) +s7:addChild(brt7); s8:addChild(brt8) + +dx = 0; dy = 0; frame = 1 + +local function onEnterFrame(event) + local t = os.timer() + local x = math.sin((t/2) + dx) * 100 + 120 + local y = math.cos((t/3) + dy) * 200 + 210 + + dx = dx + 0.005 + dy = dy + 0.009 + local bitmap = Bitmap.new(Texture.new("ball.png")) + bitmap:setPosition(x, y) + + if frame == 1 then + rt1:draw(bitmap) + stage:removeChild(s1) + stage:addChild(s2) + elseif frame == 2 then + rt2:draw(bitmap) + stage:removeChild(s2) + stage:addChild(s3) + elseif frame == 3 then + rt3:draw(bitmap) + stage:removeChild(s3) + stage:addChild(s4) + elseif frame == 4 then + rt4:draw(bitmap) + stage:removeChild(s4) + stage:addChild(s5) + elseif frame == 5 then + rt5:draw(bitmap) + stage:removeChild(s5) + stage:addChild(s6) + elseif frame == 6 then + rt6:draw(bitmap) + stage:removeChild(s6) + stage:addChild(s7) + elseif frame == 7 then + rt7:draw(bitmap) + stage:removeChild(s7) + stage:addChild(s8) + elseif frame == 8 then + rt8:draw(bitmap) + stage:removeChild(s8) + stage:addChild(s1) +end + + frame = frame + 1 + if frame == 9 then + frame = 1 + end +end + +stage:addChild(s1) +stage:addEventListener(Event.ENTER_FRAME, onEnterFrame) diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainr2t.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainr2t.lua new file mode 100644 index 000000000..6aa456ace --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/mainr2t.lua @@ -0,0 +1,58 @@ + +t=0 + +function update() + t=t+1 + application:setBackgroundColor(0xff00+t%256) + + local x,y=rect:getPosition() + x=x+math.sin(0.01*t) + y=y+math.cos(0.01*t) + rect:setPosition(x,y) + rect:setRotation(t) + + ego:setScale(2*math.sin(0.01*t)) +end + +application:setBackgroundColor(0) + +rect=Shape.new() + +rect:setFillStyle(Shape.SOLID,0xff0000) +rect:setLineStyle(20,0x0000ff) + +rect:beginPath() +rect:moveTo(-50,-50) +rect:lineTo(50,-50) +rect:lineTo(50,50) +rect:lineTo(-50,50) +rect:closePath() +rect:endPath() + +--stage:addChild(rect) + +rect:setPosition(450,300) + +ego=Bitmap.new(Texture.new("ball.png")) +stage:addChild(ego) +ego:setPosition(600,200) +--ego:setAnchorPoint(0.5,0.5) + +--text=TextField.new(nil,"Gideros on WinRT!") +--stage:addChild(text) +--text:setPosition(20,20) +--text:setScale(2) +--text:setRotation(45) +--text:setTextColor(0xff00ff) + +local rt1 = RenderTarget.new(500, 500, true) +rt1:clear(0xff0000,1) +brt1 = Bitmap.new(rt1) +stage:addChild(brt1) +brt1:setPosition(50,50) + +local bitmap = Bitmap.new(Texture.new("ball.png")) +bitmap:setPosition(20,20) +rt1:draw(bitmap) + +stage:addEventListener(Event.ENTER_FRAME,update) diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/properties.bin b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/properties.bin new file mode 100644 index 000000000..ddbefb29d Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/properties.bin differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/properties.bird.bin b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/properties.bird.bin new file mode 100644 index 000000000..e6c2c6a9a Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/properties.bird.bin differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/properties.nebula.bin b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/properties.nebula.bin new file mode 100644 index 000000000..ddbefb29d Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/properties.nebula.bin differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/sky_world.png b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/sky_world.png new file mode 100644 index 000000000..5df6aa8c1 Binary files /dev/null and b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/sky_world.png differ diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/soundbutton.lua b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/soundbutton.lua new file mode 100644 index 000000000..907b37472 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Assets/soundbutton.lua @@ -0,0 +1,19 @@ +--[[ +This code is MIT licensed, see http://www.opensource.org/licenses/mit-license.php +(C) 2010 - 2011 Gideros Mobile +]] + +SoundButton = Core.class(Sprite) + +function SoundButton:init(upimage, downimage, soundfile) + local up = Bitmap.new(Texture.new(upimage)) + local down = Bitmap.new(Texture.new(downimage)) + local button = Button.new(up, down) + + self:addChild(button) + + local sound = Sound.new(soundfile) + + button:addEventListener("click", function() sound:play() end) +end + diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/Package.appxmanifest b/winrt_example/giderosgame/giderosgame.WindowsPhone/Package.appxmanifest new file mode 100644 index 000000000..af603e453 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/Package.appxmanifest @@ -0,0 +1,44 @@ + + + + + + + + + giderosgame.WindowsPhone + John + Assets\StoreLogo.png + + + + 6.3.1 + 6.3.1 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/giderosgame.WindowsPhone.vcxproj b/winrt_example/giderosgame/giderosgame.WindowsPhone/giderosgame.WindowsPhone.vcxproj new file mode 100644 index 000000000..562d07aa1 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/giderosgame.WindowsPhone.vcxproj @@ -0,0 +1,219 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Release + ARM + + + Release + Win32 + + + + {1024583a-3b31-4571-a69f-2215e3b7975c} + giderosgame + en-US + 12.0 + true + Windows Phone + 8.1 + + + + Application + true + v120_wp81 + + + Application + true + v120_wp81 + + + Application + false + true + v120_wp81 + + + Application + false + true + v120_wp81 + + + + + + + + + + + + + + + + + + + + + + + c:\gideros_liberton\gideros\winrt\Debug\gideros.WindowsPhone;c:\gideros_liberton\gideros\libgvfs\libgvfswinrt\Debug\libgvfswinrt.WindowsPhone;c:\gideros_liberton\gideros\lua\luawinrt\Debug\luawinrt.WindowsPhone;%(AdditionalLibraryDirectories);$(WindowsPhoneSDK_LibraryPath_x86) + gideros.WindowsPhone.lib;libgvfswinrt.WindowsPhone.lib;luawinrt.WindowsPhone.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;DXGI.lib;D3D11.lib;D2D1.lib;DWrite.lib;%(AdditionalDependencies) + false + + + PTW32_STATIC_LIB;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libnetwork;c:\gideros_liberton\gideros\2dsg;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\luabinding;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\include;c:\gideros_liberton\gideros\winrt;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + NotUsing + false + + + + + c:\gideros_liberton\gideros\winrt\Release\gideros.WindowsPhone;c:\gideros_liberton\gideros\libgvfs\libgvfswinrt\Release\libgvfswinrt.WindowsPhone;c:\gideros_liberton\gideros\lua\luawinrt\Release\luawinrt.WindowsPhone;$(VCInstallDir)\lib\store;$(VCInstallDir)\lib;%(AdditionalLibraryDirectories);$(WindowsPhoneSDK_LibraryPath_x86) + gideros.WindowsPhone.lib;libgvfswinrt.WindowsPhone.lib;luawinrt.WindowsPhone.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;DXGI.lib;D3D11.lib;D2D1.lib;DWrite.lib;%(AdditionalDependencies) + false + false + + + c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libnetwork;c:\gideros_liberton\gideros\2dsg;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\luabinding;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\include;c:\gideros_liberton\gideros\winrt;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + false + NotUsing + PTW32_STATIC_LIB;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + + + c:\gideros_liberton\gideros\winrt\ARM\Debug\gideros.WindowsPhone;c:\gideros_liberton\gideros\libgvfs\libgvfswinrt\ARM\Debug\libgvfswinrt.WindowsPhone;c:\gideros_liberton\gideros\lua\luawinrt\ARM\Debug\luawinrt.WindowsPhone;%(AdditionalLibraryDirectories);$(WindowsPhoneSDK_LibraryPath_arm) + gideros.WindowsPhone.lib;libgvfswinrt.WindowsPhone.lib;luawinrt.WindowsPhone.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;DXGI.lib;D3D11.lib;D2D1.lib;DWrite.lib;%(AdditionalDependencies) + false + + + c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libnetwork;c:\gideros_liberton\gideros\2dsg;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\luabinding;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\include;c:\gideros_liberton\gideros\winrt;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + false + NotUsing + PTW32_STATIC_LIB;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + + + c:\gideros_liberton\gideros\winrt\ARM\Release\gideros.WindowsPhone;c:\gideros_liberton\gideros\libgvfs\libgvfswinrt\ARM\Release\libgvfswinrt.WindowsPhone;c:\gideros_liberton\gideros\lua\luawinrt\ARM\Release\luawinrt.WindowsPhone;%(AdditionalLibraryDirectories);$(WindowsPhoneSDK_LibraryPath_arm) + gideros.WindowsPhone.lib;libgvfswinrt.WindowsPhone.lib;luawinrt.WindowsPhone.lib;xaudio2.lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;DXGI.lib;D3D11.lib;D2D1.lib;DWrite.lib;%(AdditionalDependencies) + false + + + c:\gideros_liberton\gideros\libgid\external\pthreads-w32-2-9-1-release\Pre-built.2\include;c:\gideros_liberton\gideros\libgvfs;c:\gideros_liberton\gideros\lua\src;c:\gideros_liberton\gideros\libnetwork;c:\gideros_liberton\gideros\2dsg;c:\gideros_liberton\gideros\libplatform;c:\gideros_liberton\gideros\luabinding;c:\gideros_liberton\gideros\libgideros;c:\gideros_liberton\gideros\libgid\include\winrt;c:\gideros_liberton\gideros\libgid\include;c:\gideros_liberton\gideros\winrt;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + false + NotUsing + PTW32_STATIC_LIB;WINSTORE;PSAPI_VERSION=2;WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;_UITHREADCTXT_SUPPORT=0;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + + + + + + + + + + true + + + true + + + true + + + true + + + + + + + + + + true + + + true + + + + + true + + + true + + + + + + + + + + + + \ No newline at end of file diff --git a/winrt_example/giderosgame/giderosgame.WindowsPhone/giderosgame.WindowsPhone.vcxproj.filters b/winrt_example/giderosgame/giderosgame.WindowsPhone/giderosgame.WindowsPhone.vcxproj.filters new file mode 100644 index 000000000..b99ac9ca3 --- /dev/null +++ b/winrt_example/giderosgame/giderosgame.WindowsPhone/giderosgame.WindowsPhone.vcxproj.filters @@ -0,0 +1,184 @@ + + + + + bd4a2c03-7582-4689-8f7e-8a9e3e7ed200 + + + 0fc27bf9-7581-4e49-ad12-2b32fa234b20 + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + 1024583a-3b31-4571-a69f-2215e3b7975c + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + + + Assets + + + Assets + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + Assets + + + \ No newline at end of file diff --git a/winrt_example/notes.txt b/winrt_example/notes.txt new file mode 100644 index 000000000..7be3f7e38 --- /dev/null +++ b/winrt_example/notes.txt @@ -0,0 +1,13 @@ +This folder will contain an example winrt project. Eventually Gideros will +be able to output directories of this sort. + +winrt.cpp is the main program for both the WP8 and Windows store app +(to be called gideros.Windows.exe and gideros.WindowsPhone.exe). +These EXEs are to be linked againsted two static libraries gideros.Windows.lib +and gideros.WindowsPhone.lib (in Visual Studio format) which are in turn generated +from the standard Gideros library code. + +We need to generate a SLN file with two projects (vcxproj) for Windows +and Windows phone. Both compile winrt.cpp but link against the appropriate +static library. VS can then package and deploy these EXEs along with the users +assets (including LUA files) and eventually upload to the Windows Store and Windows Phone Store. diff --git a/winrt_example/winrt.cpp b/winrt_example/winrt.cpp new file mode 100644 index 000000000..d0d00746e --- /dev/null +++ b/winrt_example/winrt.cpp @@ -0,0 +1,927 @@ +#include "pch.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "ginput-winrt.h" +#include "luaapplication.h" +#include "platform.h" +#include "refptr.h" +#include +#include +#include +#include +#include +#include +#include +#include "gpath.h" +#include "gvfs-native.h" +#include "ggeolocation.h" +#include "gapplication.h" +#include "gaudio.h" +#include "ghttp.h" + +#include "dxcompat.hpp" +#include "dxglobals.h" +//#include "gstdio.h" + +using namespace Microsoft::WRL; +using namespace DirectX; + +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Core; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Popups; +using namespace Windows::System; +using namespace Windows::Foundation; +using namespace Windows::Graphics::Display; +using namespace Platform; +using namespace Windows::Storage; + +extern bool dxcompat_force_lines; + +IXAudio2 *g_audioengine; +IXAudio2MasteringVoice *g_masteringvoice; + +LuaApplication *g_application; + +float screenw, screenh; + +struct ProjectProperties +{ + ProjectProperties() + { + clear(); + } + + void clear() + { + // graphics options + scaleMode = 0; + logicalWidth = 320; + logicalHeight = 480; + imageScales.clear(); + orientation = 0; + fps = 60; + + // iOS options + retinaDisplay = 0; + autorotation = 0; + + // input options + mouseToTouch = true; + touchToMouse = true; + mouseTouchOrder = 0; + + // export options + architecture = 0; + assetsOnly = false; + iosDevice = 0; + packageName = "com.yourdomain.yourapp"; + encryptCode = false; + encryptAssets = false; + } + + // graphics options + int scaleMode; + int logicalWidth; + int logicalHeight; + std::vector > imageScales; + int orientation; + int fps; + + // iOS options + int retinaDisplay; + int autorotation; + + // input options + int mouseToTouch; + int touchToMouse; + int mouseTouchOrder; + + // export options + int architecture; + bool assetsOnly; + int iosDevice; + std::string packageName; + bool encryptCode; + bool encryptAssets; +}; + +extern "C" +{ + wchar_t htonl(wchar_t w) + { + return w; + } + + void ExitProcess(int i) + { + } +} + +/* +* Mutex Functions +*/ + +#include "pthread.h" +//#define PTW32_DLLPORT +//#define PTW32_CDECL + +int PTW32_CDECL pthread_mutex_init(pthread_mutex_t * mutex, + const pthread_mutexattr_t * attr) +{ + return 0; +} + +int PTW32_CDECL pthread_mutex_destroy(pthread_mutex_t * mutex) +{ + return 0; +} + + +int PTW32_CDECL pthread_mutex_lock(pthread_mutex_t * mutex) +{ + return 0; +} + + +int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t * mutex, + const struct timespec *abstime) +{ + return 0; +} + + +int PTW32_CDECL pthread_mutex_trylock(pthread_mutex_t * mutex) +{ + return 0; +} + +int PTW32_CDECL pthread_mutex_unlock(pthread_mutex_t * mutex) +{ + return 0; +} + +int PTW32_CDECL pthread_mutex_consistent(pthread_mutex_t * mutex) +{ + return 0; +} + +int PTW32_CDECL pthread_create(pthread_t * tid, + const pthread_attr_t * attr, + void *(PTW32_CDECL *start) (void *), + void *arg) +{ + return 0; +} + +int PTW32_CDECL pthread_join(pthread_t thread, + void **value_ptr) +{ + return 0; +} + +void setWindowSize(LuaApplication *app, int width, int height) +{ +} + +void setFullScreen(LuaApplication *app, bool fullscreen) +{ +} + +void loadProperties() +{ + + ProjectProperties properties; + G_FILE* fis = g_fopen("properties.bin", "rb"); + + g_fseek(fis, 0, SEEK_END); + int len = g_ftell(fis); + g_fseek(fis, 0, SEEK_SET); + + std::vector buf(len); + g_fread(&buf[0], 1, len, fis); + g_fclose(fis); + + ByteBuffer buffer(&buf[0], buf.size()); + + buffer >> properties.scaleMode; + buffer >> properties.logicalWidth; + buffer >> properties.logicalHeight; + + int scaleCount; + buffer >> scaleCount; + properties.imageScales.resize(scaleCount); + for (int i = 0; i < scaleCount; ++i) + { + buffer >> properties.imageScales[i].first; + buffer >> properties.imageScales[i].second; + } + + buffer >> properties.orientation; + buffer >> properties.fps; + buffer >> properties.retinaDisplay; + buffer >> properties.autorotation; + buffer >> properties.mouseToTouch; + buffer >> properties.touchToMouse; + buffer >> properties.mouseTouchOrder; + +// bool phone = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone; +// bool notRetina = (properties.retinaDisplay == 0) || (properties.retinaDisplay == 1 && !phone) || (properties.retinaDisplay == 2 && phone); + + CoreWindow^ Window = CoreWindow::GetForCurrentThread(); + + float scaley; + +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + DisplayInformation ^dinfo = DisplayInformation::GetForCurrentView(); + scaley = dinfo->RawPixelsPerViewPixel; // Windows phone +#else + scaley = 1.0f; // Windows 8 PC +#endif + + + float contentScaleFactor = 1; +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + int height = Window->Bounds.Height*scaley; + int width = Window->Bounds.Width*scaley; +#else + int width = Window->Bounds.Height*scaley; + int height = Window->Bounds.Width*scaley; +#endif + + properties.scaleMode = 0; + +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + Orientation hardwareOrientation = Orientation::ePortrait; + Orientation deviceOrientation = Orientation::ePortrait; +#else + Orientation hardwareOrientation = Orientation::eLandscapeLeft; + Orientation deviceOrientation = Orientation::eLandscapeLeft; +#endif + + g_application->setResolution(width * contentScaleFactor, height * contentScaleFactor); + g_application->setHardwareOrientation(hardwareOrientation); + g_application->getApplication()->setDeviceOrientation(deviceOrientation); + g_application->setOrientation((Orientation)properties.orientation); + g_application->setLogicalDimensions(properties.logicalWidth, properties.logicalHeight); + g_application->setLogicalScaleMode((LogicalScaleMode)properties.scaleMode); + g_application->setImageScales(properties.imageScales); + +// g_setFps(properties.fps); + + ginput_setMouseToTouchEnabled(properties.mouseToTouch); + ginput_setTouchToMouseEnabled(properties.touchToMouse); + ginput_setMouseTouchOrder(properties.mouseTouchOrder); +} + + +// application.openUrl(application,uri) +int openUrl(lua_State *L) +{ + const char *orig = lua_tostring(L, -1); + size_t newsize = strlen(orig) + 1; + wchar_t *wcstring = new wchar_t[newsize]; + + size_t convertedChars = 0; + mbstowcs_s(&convertedChars, wcstring, newsize, orig, _TRUNCATE); + + Platform::String ^string = ref new String(wcstring); + auto uri = ref new Windows::Foundation::Uri(string); + Launcher::LaunchUriAsync(uri); + + delete[] wcstring; + return 0; +} + +IXAudio2SourceVoice* g_source; + +void getStdCoords(float xp, float yp, float &x, float &y) +{ +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + + DisplayInformation ^dinfo = DisplayInformation::GetForCurrentView(); + DisplayOrientations Orientation = dinfo->CurrentOrientation; + + if (Orientation == DisplayOrientations::Portrait){ + x = xp; + y = yp; + } + else if (Orientation == DisplayOrientations::Landscape){ + x = screenw - yp; + y = xp; + } + else if (Orientation == DisplayOrientations::LandscapeFlipped){ + x = yp; + y = screenh - xp; + } + else { + x = screenw - xp; + y = screenh - yp; + } +#else + x = xp; + y = yp; +#endif +} + +// ###################################################################### + +// OS specific function available as application:getDeviceInfo +int getDeviceInfo(lua_State *L) +{ + lua_pushstring(L,"windows rt"); + return 1; +} + +// ###################################################################### +// this function loads a file into an Array^ + +Array^ LoadShaderFile(std::string File){ + Array^ FileData = nullptr; + + // open the file + std::ifstream VertexFile(File, std::ios::in | std::ios::binary | std::ios::ate); + + // if open was successful + if(VertexFile.is_open()) { + // find the length of the file + int Length = (int)VertexFile.tellg(); + + // collect the file data + FileData = ref new Array(Length); + VertexFile.seekg(0, std::ios::beg); + VertexFile.read(reinterpret_cast(FileData->Data), Length); + VertexFile.close(); + } + return FileData; +} + +//###################################################################### +// this function initializes and prepares Direct3D for use +void InitD3D() +{ + + // ---------------------------------------------------------------------- + // Create swap chain, get g_dev, g_devcon + // ---------------------------------------------------------------------- + + ComPtr dev11; + ComPtr devcon11; + + D3D11CreateDevice( + nullptr, + D3D_DRIVER_TYPE_HARDWARE, + nullptr, + D3D11_CREATE_DEVICE_DEBUG, + nullptr, + 0, + D3D11_SDK_VERSION, + &dev11, + nullptr, + &devcon11); + + // Convert the pointers from Direct3D 11 to Direct3D 11.1 + dev11.As(&g_dev); + devcon11.As(&g_devcon); + + // Obtain the DXGI factory + // ComPtr dxgiDevice; + g_dev.As(&dxgiDevice); + ComPtr dxgiAdapter; + dxgiDevice->GetAdapter(&dxgiAdapter); + ComPtr dxgiFactory; + dxgiAdapter->GetParent(__uuidof(IDXGIFactory2), &dxgiFactory); + + // create a struct to hold information about the swap chain + DXGI_SWAP_CHAIN_DESC1 scd; + // clear out the struct for use + ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC1)); + + // fill the swap chain description struct + scd.Width = 0; + scd.Height = 0; + scd.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + scd.Stereo = false; + scd.SampleDesc.Count = 1; // DISABLE ANTI-ALIASING + scd.SampleDesc.Quality = 0; + scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // how swap chain is to be used + scd.BufferCount = 2; // one back buffer for WP8 (Windows 8: 2) + //scd.Scaling = DXGI_SCALING_STRETCH; // WP8 (Windows 8: not set) + scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // WP8 (Windows 8: DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL) + scd.Flags = 0; + + CoreWindow^ Window=CoreWindow::GetForCurrentThread(); + + dxgiFactory->CreateSwapChainForCoreWindow( + g_dev.Get(), + reinterpret_cast(Window), + &scd, + nullptr, + &g_swapchain); + + // ---------------------------------------------------------------------- + // Setup back buffer, get g_backbuffer + // ---------------------------------------------------------------------- + + ID3D11Texture2D *pBackBuffer; + g_swapchain->GetBuffer(0,__uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); + + g_dev->CreateRenderTargetView(pBackBuffer,NULL,&g_backbuffer); + pBackBuffer->Release(); + + g_devcon->OMSetRenderTargets(1,&g_backbuffer,NULL); // could call this "rendertarget" + + // ---------------------------------------------------------------------- + // Setup viewport, will also be reset using glViewport commands + // ---------------------------------------------------------------------- + + D3D11_VIEWPORT viewport; + ZeroMemory(&viewport,sizeof(D3D11_VIEWPORT)); + + float scaley; + +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP + DisplayInformation ^dinfo = DisplayInformation::GetForCurrentView(); + scaley = dinfo->RawPixelsPerViewPixel; // Windows phone +#else + scaley = 1.0f; // Windows 8 PC +#endif + + screenw = Window->Bounds.Width; + screenh = Window->Bounds.Height; + + float basex = 0; + float basey = 0; + float windoww = screenw; // default values means stretch to fit full screen + float windowh = screenh; // Lua can change later. Note that screenw/h are in scaled coords + + viewport.TopLeftX = basex*scaley; + viewport.TopLeftY = basey*scaley; + viewport.Width = screenw*scaley; // Direct3D needs actual pixels + viewport.Height = screenh*scaley; + + g_devcon->RSSetViewports(1,&viewport); + + // ---------------------------------------------------------------------- + // load and compile the two shaders + // Write erros to VC++ output + // create g_pVS, g_pPS and initialise + // ---------------------------------------------------------------------- + + Array^ VSFile=LoadShaderFile("assets\\VertexShader.cso"); + Array^ PSFile=LoadShaderFile("assets\\PixelShader.cso"); + + g_dev->CreateVertexShader(VSFile->Data, VSFile->Length, NULL, &g_pVS); + g_dev->CreatePixelShader (PSFile->Data, PSFile->Length, NULL, &g_pPS); + + g_devcon->VSSetShader(g_pVS, 0, 0); + g_devcon->PSSetShader(g_pPS, 0, 0); + + // ---------------------------------------------------------------------- + // create the input layout object. Set g_pLayout. There are 3 entries + // for position, colour and texture coord + // ---------------------------------------------------------------------- + + D3D11_INPUT_ELEMENT_DESC ied[] = { + {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}, + {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 28, D3D11_INPUT_PER_VERTEX_DATA, 0} + }; + + g_dev->CreateInputLayout(ied, 3, VSFile->Data, VSFile->Length, &g_pLayout); + g_devcon->IASetInputLayout(g_pLayout); + + // ---------------------------------------------------------------------- + // Create vertex buffer object g_pVBuffer. Data from this will be passed + // through to vertex shader, vertex by vertex. We will Map/Unmap this + // to tell D3D what to draw + // ---------------------------------------------------------------------- + + D3D11_BUFFER_DESC bd; + ZeroMemory(&bd, sizeof(bd)); + + bd.Usage = D3D11_USAGE_DYNAMIC; // write access access by CPU and GPU + bd.ByteWidth = sizeof(VERTEX) * 256; // size is the VERTEX struct * 256 + bd.BindFlags = D3D11_BIND_VERTEX_BUFFER; // use as a vertex buffer + bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; // allow CPU to write in buffer + + g_dev->CreateBuffer(&bd, NULL, &g_pVBuffer); // create the buffer + + // ---------------------------------------------------------------------- + // Create a constant buffer (NB must be multiple of 16 bytes) + // Important field is use_tex. If 1, pixel shader will use current texture + // UpdateSubresource fills with data and SetConstantBuffer xfers to shader + // ---------------------------------------------------------------------- + + D3D11_BUFFER_DESC bd2; + ZeroMemory(&bd2, sizeof(bd2)); + + bd2.Usage=D3D11_USAGE_DEFAULT; + bd2.ByteWidth=sizeof(const_buffer); + bd2.BindFlags=D3D11_BIND_CONSTANT_BUFFER; + bd2.CPUAccessFlags=0; + + struct const_buffer mycb; + mycb.use_tex=0; + + HRESULT hr; + hr=g_dev->CreateBuffer(&bd2,NULL,&g_CB); + + g_devcon->UpdateSubresource(g_CB,0,nullptr,&mycb,0,0); + g_devcon->PSSetConstantBuffers(0, 1, &g_CB); + + // ---------------------------------------------------------------------- + // Blend state + // ---------------------------------------------------------------------- + + D3D11_BLEND_DESC blendStateDesc; + ZeroMemory(&blendStateDesc, sizeof(D3D11_BLEND_DESC)); + + blendStateDesc.AlphaToCoverageEnable = FALSE; + blendStateDesc.IndependentBlendEnable = FALSE; + blendStateDesc.RenderTarget[0].BlendEnable = TRUE; + blendStateDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; + blendStateDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blendStateDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendStateDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; + blendStateDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_DEST_ALPHA; + blendStateDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendStateDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + + g_dev->CreateBlendState(&blendStateDesc, &g_pBlendState); + g_devcon->OMSetBlendState(g_pBlendState, NULL, 0xFFFFFF); + + // ---------------------------------------------------------------------- + // Create a sampler, this interpolates textures in the Pixel Shader + // This is just boiler plate + // ---------------------------------------------------------------------- + + D3D11_SAMPLER_DESC sampDesc; + ZeroMemory( &sampDesc, sizeof(sampDesc) ); + sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; + sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; + sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; + sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; + sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; + sampDesc.MinLOD = 0; + sampDesc.MaxLOD = D3D11_FLOAT32_MAX; + + g_dev->CreateSamplerState( &sampDesc, &g_samplerLinear ); + g_devcon->PSSetSamplers(0,1,&g_samplerLinear); // only do this once + + // Set rasterizer state to switch off backface culling + + D3D11_RASTERIZER_DESC rasterDesc; + + rasterDesc.AntialiasedLineEnable = false; + rasterDesc.CullMode = D3D11_CULL_NONE; + rasterDesc.DepthBias = 0; + rasterDesc.DepthBiasClamp = 0; + rasterDesc.DepthClipEnable = true; + rasterDesc.FillMode = D3D11_FILL_SOLID; + rasterDesc.FrontCounterClockwise = false; + rasterDesc.MultisampleEnable = false; + rasterDesc.ScissorEnable = false; + rasterDesc.SlopeScaledDepthBias = 0.0f; + + ID3D11RasterizerState *m_rasterState; + + HRESULT result = g_dev->CreateRasterizerState(&rasterDesc, &m_rasterState); + g_devcon->RSSetState(m_rasterState); + + // ---------------------------------------------------------------------- + // Finally do some "openGL" manipulations so that vertex coords are in + // pixels in a 2D surface with origin at top-left + // ---------------------------------------------------------------------- + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + float orient = 0, logicalw=320, logicalh=480; + glRotatef(orient, 0.0,0.0,1.0); + glOrtho(0.0, logicalw, logicalh, 0.0, -1.0, 1.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +// ###################################################################### +// this is the function that cleans up Direct3D and COM +void CleanD3D() +{ + // close and release all existing COM objects + g_pLayout->Release(); + g_pVS->Release(); + g_pPS->Release(); + g_pVBuffer->Release(); +// g_swapchain->Release(); + g_backbuffer->Release(); +// g_dev->Release(); +// g_devcon->Release(); + g_CB->Release(); + g_samplerLinear->Release(); +} + +// ###################################################################### +void InitXAudio2() +{ + XAudio2Create(&g_audioengine); + HRESULT hr = g_audioengine->CreateMasteringVoice(&g_masteringvoice); +} + +// ###################################################################### +void CleanXAudio2() +{ + g_audioengine->Release(); +} + +// ###################################################################### +// the class definition for the core "framework" of our app +ref class App sealed : public IFrameworkView +{ + bool WindowClosed; + ULONGLONG next_game_tick; + +public: + virtual void Initialize(CoreApplicationView^ AppView) + { + AppView->Activated += ref new TypedEventHandler + (this, &App::OnActivated); + CoreApplication::Suspending += + ref new EventHandler(this, &App::Suspending); + CoreApplication::Resuming += + ref new EventHandler(this, &App::Resuming); + WindowClosed = false; // initialize to false + } + + virtual void SetWindow(CoreWindow^ Window) + { + Window->Closed += ref new TypedEventHandler + (this, &App::Closed); + Window->PointerPressed += ref new TypedEventHandler + (this, &App::PointerPressed); + Window->PointerReleased += ref new TypedEventHandler + (this, &App::PointerReleased); + Window->PointerMoved += ref new TypedEventHandler + (this, &App::PointerMoved); + +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP + Window->SizeChanged += ref new TypedEventHandler + (this, &App::OnSizeChanged); + + Window->KeyDown += ref new TypedEventHandler + (this, &App::KeyDown); + Window->KeyUp += ref new TypedEventHandler + (this, &App::KeyUp); +#endif + } + + virtual void Load(String^ EntryPoint) {} + + virtual void Run() + { + + GStatus status; + + dxcompat_force_lines = false; + + InitD3D(); + InitXAudio2(); + + GLuint zero; + glGenTextures(1, &zero); + glBindTexture(GL_TEXTURE_2D,zero); + assert(zero == 0); + + glGenFramebuffers(1, &zero); + glBindFramebuffer(GL_FRAMEBUFFER, zero); + assert(zero == 0); + + gpath_init(); + + gpath_addDrivePrefix(0, "|R|"); + gpath_addDrivePrefix(0, "|r|"); + gpath_addDrivePrefix(1, "|D|"); + gpath_addDrivePrefix(1, "|d|"); + gpath_addDrivePrefix(2, "|T|"); + gpath_addDrivePrefix(2, "|t|"); + + gpath_setDriveFlags(0, GPATH_RO | GPATH_REAL); + gpath_setDriveFlags(1, GPATH_RW | GPATH_REAL); + gpath_setDriveFlags(2, GPATH_RW | GPATH_REAL); + + gpath_setAbsolutePathFlags(GPATH_RW | GPATH_REAL); + gpath_setDefaultDrive(0); + + const wchar_t *installedLocation = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data(); + + char fileStem[MAX_PATH]; + wcstombs(fileStem, installedLocation, MAX_PATH); + strcat(fileStem, "\\assets\\"); + + gpath_setDrivePath(0,fileStem); + + const wchar_t *docs = ApplicationData::Current->LocalFolder->Path->Data(); + + char docsPath[MAX_PATH]; + wcstombs(docsPath, docs, MAX_PATH); + strcat(docsPath, "\\"); + + gpath_setDrivePath(1,docsPath); + + gvfs_init(); + gevent_Init(); + gapplication_init(); + ginput_init(); + ggeolocation_init(); + ghttp_Init(); + // gui_init(); + gtexture_init(); + gaudio_Init(); + // loadPlugins(); + + g_application = new LuaApplication; + g_application->initialize(); + + loadProperties(); + + char line[MAX_PATH]; + G_FILE *fp = g_fopen("luafiles.txt", "r"); + + while (g_fgets(line, MAX_PATH-1, fp) != NULL){ + OutputDebugStringA(line); + for (int i = strlen(line); i > 0; i--) + if (line[i] == '\r' || line[i] == '\n') line[i] = '\0'; + g_application->loadFile(line, &status); + if (status.error()) break; + } + + g_fclose(fp); + + if (!status.error()) + { +// gapplication_enqueueEvent(GAPPLICATION_START_EVENT, NULL, 0); +// g_application->tick(&status); + } + + if (status.error()) + OutputDebugStringA(status.errorString()); + + CoreWindow^ Window = CoreWindow::GetForCurrentThread(); + + const int TICK_PER_SECOND = 60; + const int SKIP_TICKS = 1000 / TICK_PER_SECOND; + const int MAX_FRAMESKIP = 10; + + next_game_tick = GetTickCount64(); + int loops; + + // repeat until window closes + while(!WindowClosed){ + + loops = 0; +// while (GetTickCount64() > next_game_tick && loops < MAX_FRAMESKIP) { + Window->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); + + g_application->enterFrame(&status); + gaudio_AdvanceStreamBuffers(); + + next_game_tick += SKIP_TICKS; + loops++; +// } + + g_devcon->OMSetRenderTargets(1, &g_backbuffer, nullptr); + g_devcon->ClearRenderTargetView(g_backbuffer, backcol); + + // application_->clearBuffers(); + g_application->renderScene(); // optional argument deltaFrameCount + + g_swapchain->Present(1, 0); + } + + CleanD3D(); + CleanXAudio2(); + + gaudio_Cleanup(); + gtexture_cleanup(); + // gui_cleanup(); + ghttp_Cleanup(); + ggeolocation_cleanup(); + ginput_cleanup(); + gapplication_cleanup(); + gevent_Cleanup(); + gvfs_cleanup(); + gpath_cleanup(); + } + + virtual void Uninitialize() {} + + void OnActivated(CoreApplicationView^ CoreAppView, IActivatedEventArgs^ Args) + { + CoreWindow^ Window = CoreWindow::GetForCurrentThread(); + Window->Activate(); + } + + void Closed(CoreWindow^ sender, CoreWindowEventArgs^ args) + { + WindowClosed = true; // time to end the endless loop + } + + void Suspending(Object^ Sender, SuspendingEventArgs^ Args) + { + Windows::ApplicationModel::SuspendingDeferral^ deferral = Args->SuspendingOperation->GetDeferral(); + + // Save application data + + dxgiDevice->Trim(); + deferral->Complete(); + } + + void Resuming(Object^ Sender, Object^ Args) + { + next_game_tick = GetTickCount64(); + } + + void OnSizeChanged(CoreWindow ^sender, WindowSizeChangedEventArgs ^args) + { + } + + void PointerPressed(CoreWindow^ Window, PointerEventArgs^ Args) + { + + float xp = Args->CurrentPoint->Position.X; + float yp = Args->CurrentPoint->Position.Y; + + float x, y; + getStdCoords(xp, yp, x, y); + + ginputp_mouseDown(x,y,0); + } + + void PointerReleased(CoreWindow^ Window, PointerEventArgs^ Args) + { + + float xp = Args->CurrentPoint->Position.X; + float yp = Args->CurrentPoint->Position.Y; + + float x, y; + getStdCoords(xp, yp, x, y); + + ginputp_mouseUp(x,y,0); + } + + void PointerMoved(CoreWindow^ Window, PointerEventArgs^ Args) + { + if (Args->CurrentPoint->IsInContact){ + float xp = Args->CurrentPoint->Position.X; + float yp = Args->CurrentPoint->Position.Y; + + float x, y; + getStdCoords(xp, yp, x, y); + + ginputp_mouseMove(x, y); + } + } + + void KeyDown(CoreWindow^ Window, KeyEventArgs^ Args) + { + ginputp_keyDown((int)Args->VirtualKey); + } + + void KeyUp(CoreWindow^ Window, KeyEventArgs^ Args) + { + ginputp_keyUp((int)Args->VirtualKey); + } + + +}; + +// ###################################################################### + +ref class AppSource sealed : IFrameworkViewSource +{ + public: + virtual IFrameworkView^ CreateView() + { + return ref new App(); + } +}; + +[MTAThread] // define main as multi-threaded apartment function + +int main(Array^ args) +{ + + CoreApplication::Run(ref new AppSource()); + return 0; +}