GithubHelp home page GithubHelp logo

ctxdegithub / moai-ide Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vavius/moai-ide

0.0 3.0 0.0 178.44 MB

Qt + PySide moai host.

License: MIT License

Python 53.65% Makefile 0.60% C 44.45% C++ 1.01% Shell 0.06% Lua 0.23%

moai-ide's Introduction

MOAI Editor

This editor is a Python-Qt based host for MOAI SDK. The main idea behind all this is pretty easy:

  • I wanted to add editor features to MOAI SDK with live game preview - like most of 3d AAA engines have
  • Editors tend to have pretty complicated GUI - coding all this in Lua with MOAI classes is a pain, also some performance issues could arise, so better to look at existing frameworks and run MOAI as GL View
  • Qt is one of the most complete frameworks for crossplatform GUI applications
  • GUI stuff is easier to code and tune with dynamic language such as Python (may consider QtScript as well)

Features

  • Host for latest MOAI SDK (currently 1.5)
  • Lua code reload localy and remote (experimental)
  • Ability to specify target resolution (set as MOAIEnvironment.screenWidth and MOAIEnvironment.screenHeight values)
  • Color console output with timestamps
  • Limited modules support - no sound, box2d, http-task. I'll be adding those soon

Roadmap

What is missing:

  • Hmm, the Editor itself is pretty missing. Currently, this is just a Python-Qt MOAI Host

Setup

Since all used technologies are cross platform in nature this thing should work on Windows, Linux, OS X without problems. However, I've only tested this on OS X 10.8 and 10.9. To build on other platforms you'll need to compile MOAI as python module, read Technical details for more info.

There are tons of dependencies:

Installation

  1. Install Qt, then PySide bindings
  2. Unzip and install include/PyOpenGL-3.0.2.zip (python setup.py install)
  3. Clone Lua framework https://github.com/Vavius/moai-framework, then link or copy src/ folder from it to editor/lua/moai-framework/src/

Running

cd editor
python mainwindow.py

or double-click on run.command

Use file->open or cmd+O to open any moai main.lua file.

Live Reload

There is a watchdog module that looks for changed files in current directory (the one that contains opened main.lua). Probably you'll find 3 checkboxes in the host window:

  • Local - whether to auto-reload local host on file change
  • Device - whether to send changes to selected device (should be found and specified in drop-down menu)
  • Full reload - buggy one. When checked the whole MOAI context is created from scratch. Does not work for Device. Should be always checked for Local.

Device reload

WARNING: this feature was working in my tests some time ago, but currently I'm not using it in any of my projects, so it can be broken. Also, live-update (i.e. not full reload) needs a rethink.

Device reload implemented by sending files with luasocket and saving them to DocumentDirectory under livereload/ path. Lua package.path is altered to look in documents/livereload first. Also, resource lookup paths are updated to handle images, fonts and other resources hot-swap.

Devices can be found in local network. Device should run the app you currently developing. To enable remote reload add this to main.lua:

if MOAIAppIOS or MOAIAppAndroid then
    LIVE_RELOAD_CLIENT = require "util.LiveReloadClient"

    -- table here specifies custom lua search paths, that was added by your app to package.path
    -- in order to properly add directory overrides
    LIVE_RELOAD_CLIENT:init({'src/?.lua', 'src/framework/?.lua'})
end

Only live-update aka "not full reload" is working for device. It relauches current ingame scene when something is reloaded.

Technical details

MOAI is compiled as python module with Cython. Lua communication implemented with Lupa. There are some modifications to Lupa in order to make it use existing lua_State from MOAI. Python module sources located in dev/moaipy:

  • static moai libs - I suppose they need to be recompiled for your current platform
  • cmoai.pxd - cython header file for AKU calls
  • moaipy.pyx - here we wrap AKU functions to be called from python
  • _lupa.pyx - modified lupa
  • setup.py - distutils script
  • build.sh - run it to build extension

moai-ide's People

Contributors

vavius avatar

Watchers

James Cloos avatar ctx avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.