Explorar o código

Update Audio, Input, IO module Lua API.

Aster Jian %!s(int64=12) %!d(string=hai) anos
pai
achega
5e203f1bba

+ 13 - 12
Extras/LuaScript/pkgs/Audio/Audio.pkg

@@ -13,32 +13,33 @@ enum SoundType
 class Audio : public Object
 {
 public:
-    // Methods:
     bool SetMode(int bufferLengthMSec, int mixRate, bool stereo, bool interpolation = true);
-    bool SetMode(int bufferLengthMSec, int mixRate, bool stereo);
     bool Play();
     void Stop();
-
     void SetMasterGain(SoundType type, float gain);
-    float GetMasterGain(SoundType type) const;
-    
     void SetListener(SoundListener* listener);
-    SoundListener* GetListener() const;
-    
+    void StopSound(Sound* sound);
+
     unsigned GetSampleSize() const;
     int GetMixRate() const;
     bool GetInterpolation() const;
-
     bool IsStereo() const;
     bool IsPlaying() const;
-    bool IsInitialized() const;  
+    bool IsInitialized() const;
+    float GetMasterGain(SoundType type) const;
+    SoundListener* GetListener() const;
 
-    // Properties:
-    tolua_property__get_set SoundListener* listener;
+    void AddSoundSource(SoundSource* soundSource);
+    void RemoveSoundSource(SoundSource* soundSource);
+
+    float GetSoundSourceMasterGain(SoundType type) const;
+    void MixOutput(void *dest, unsigned samples);
+    
     tolua_readonly tolua_property__get_set unsigned sampleSize;
     tolua_readonly tolua_property__get_set int mixRate;
     tolua_readonly tolua_property__get_set bool interpolation;
-
+
+tolua_property__get_set SoundListener* listener;
     tolua_readonly tolua_property__is_set bool stereo;    
     tolua_readonly tolua_property__is_set bool playing;
     tolua_readonly tolua_property__is_set bool initialized;

+ 4 - 6
Extras/LuaScript/pkgs/Audio/Sound.pkg

@@ -3,25 +3,23 @@ $#include "Sound.h"
 class Sound : public Resource
 {
 public:
-    // Methods:
     float GetLength() const;
+    unsigned GetDataSize() const;
     unsigned GetSampleSize() const;
     float GetFrequency();
-    
-    void SetLooped(bool enable);
+    unsigned GetIntFrequency();
     bool IsLooped() const;
-    
     bool IsSixteenBit() const;
     bool IsStereo() const;
     bool IsCompressed() const;
 
-    // Properties:
     tolua_readonly tolua_property__get_set float length;
+    tolua_readonly tolua_property__get_set unsigned dataSize;
     tolua_readonly tolua_property__get_set unsigned sampleSize;
     tolua_readonly tolua_property__get_set float frequency;
+    tolua_readonly tolua_property__get_set int intFrequency;
     tolua_property__is_set bool looped;
     tolua_readonly tolua_property__is_set bool sixteenBit;
     tolua_readonly tolua_property__is_set bool stereo;
     tolua_readonly tolua_property__is_set bool compressed;
-
 };

+ 17 - 16
Extras/LuaScript/pkgs/Audio/SoundSource.pkg

@@ -1,45 +1,46 @@
 $#include "SoundSource.h"
 
+enum SoundType{};
+
 class SoundSource : public Component
 {
 public:
-    // Methods:
     void Play(Sound* sound);
     void Play(Sound* sound, float frequency);
     void Play(Sound* sound, float frequency, float gain);
     void Play(Sound* sound, float frequency, float gain, float panning);
     void Stop();
-
     void SetSoundType(SoundType type);
-    SoundType GetSoundType() const;
-    
     void SetFrequency(float frequency);
-    float GetFrequency() const;
-    
     void SetGain(float gain);
-    float GetGain() const;
-    
     void SetAttenuation(float attenuation);
-    float GetAttenuation() const;
-    
     void SetPanning(float panning);
-    float GetPanning() const;
-    
     void SetAutoRemove(bool enable);
-    bool GetAutoRemove() const;
+    // void SetPlayPosition(signed char* pos);
     
     Sound* GetSound() const;
+    // volatile signed char* GetPlayPosition() const;
+    SoundType GetSoundType() const;
     float GetTimePosition() const;
+    float GetFrequency() const;
+    float GetGain() const;
+    float GetAttenuation() const;
+    float GetPanning() const;
+    bool GetAutoRemove() const;
     bool IsPlaying() const;
     
-    // Properties:
+    void PlayLockless(Sound* sound);
+    void StopLockless();
+    void SetPlayPositionLockless(signed char* position);
+    void Mix(int* dest, unsigned samples, int mixRate, bool stereo, bool interpolation);
+    
+    tolua_readonly tolua_property__get_set Sound* sound;
     tolua_property__get_set SoundType soundType;
+    tolua_readonly tolua_property__get_set float timePosition;
     tolua_property__get_set float frequency;
     tolua_property__get_set float gain;
     tolua_property__get_set float attenuation;
     tolua_property__get_set float panning;
     tolua_property__get_set bool autoRemove;
-    tolua_readonly tolua_property__get_set Sound* sound;
-    tolua_readonly tolua_property__get_set float timePosition;
     tolua_readonly tolua_property__is_set bool playing;
 };

+ 5 - 8
Extras/LuaScript/pkgs/Audio/SoundSource3D.pkg

@@ -3,19 +3,16 @@ $#include "SoundSource3D.h"
 class SoundSource3D : public SoundSource
 {
 public:
-    // Methods:
     void SetDistanceAttenuation(float nearDistance, float farDistance, float rolloffFactor);
-        
     void SetNearDistance(float distance);
-    float GetNearDistance() const;
-    
     void SetFarDistance(float distance);
-    float GetFarDistance() const;
-
     void SetRolloffFactor(float factor);
+    void CalculateAttenuation();
+    
+    float GetNearDistance() const;
+    float GetFarDistance() const;
     float RollAngleoffFactor() const;
-
-    // Properties:
+    
     tolua_property__get_set float nearDistance;
     tolua_property__get_set float farDistance;
     tolua_property__get_set float rolloffFactor;

+ 53 - 0
Extras/LuaScript/pkgs/IO/Deserializer.pkg

@@ -0,0 +1,53 @@
+$#include "Deserializer.h"
+
+class Deserializer
+{
+    // virtual unsigned Read(void* dest, unsigned size);
+    virtual unsigned Seek(unsigned position);
+    
+    virtual const String& GetName() const;
+    virtual unsigned GetChecksum();
+    unsigned GetPosition() const;
+    unsigned GetSize() const;
+    bool IsEof() const;
+    
+    int ReadInt();
+    short ReadShort();
+    signed char ReadByte();
+    unsigned ReadUInt();
+    unsigned short ReadUShort();
+    unsigned char ReadUByte();
+    bool ReadBool();
+    float ReadFloat();
+    IntRect ReadIntRect();
+    IntVector2 ReadIntVector2();
+    Rect ReadRect();
+    Vector2 ReadVector2();
+    Vector3 ReadVector3();
+    Vector3 ReadPackedVector3(float maxAbsCoord);
+    Vector4 ReadVector4();
+    Quaternion ReadQuaternion();
+    Quaternion ReadPackedQuaternion();
+    Color ReadColor();
+    BoundingBox ReadBoundingBox();
+    String ReadString();
+    String ReadFileID();
+    StringHash ReadStringHash();
+    ShortStringHash ReadShortStringHash();
+    PODVector<unsigned char> ReadBuffer();
+    ResourceRef ReadResourceRef();
+    ResourceRefList ReadResourceRefList();
+    Variant ReadVariant();
+    Variant ReadVariant(VariantType type);
+    VariantVector ReadVariantVector();
+    VariantMap ReadVariantMap();
+    unsigned ReadVLE();
+    unsigned ReadNetID();
+    String ReadLine();
+    
+    tolua_readonly tolua_property__get_set String& name;
+    tolua_readonly tolua_property__get_set unsigned checksum;
+    tolua_readonly tolua_property__get_set unsigned position;
+    tolua_readonly tolua_property__get_set unsigned size;
+    tolua_readonly tolua_property__is_set bool eof;
+};

+ 11 - 24
Extras/LuaScript/pkgs/IO/File.pkg

@@ -1,6 +1,5 @@
 $#include "File.h"
 
-/// File open mode.
 enum FileMode
 {
     FILE_READ = 0,
@@ -8,45 +7,33 @@ enum FileMode
     FILE_READWRITE
 };
 
-/// %File opened either through the filesystem or from within a package file.
 class File : public Deserializer
 {
-public:
-    /// Construct.
     File(Context* context);
-    /// Construct and open a filesystem file.
     File(Context* context, const String& fileName, FileMode mode = FILE_READ);
-    /// Construct and open from a package file.
     File(Context* context, PackageFile* package, const String& fileName);
-    /// Destruct. Close the file if open.
     virtual ~File();
     
-    /// Read bytes from the file. Return number of bytes actually read.
     virtual unsigned Read(void* dest, unsigned size);
-    /// Set position from the beginning of the file.
     virtual unsigned Seek(unsigned position);
-    /// Return the file name.
+    virtual unsigned Write(const void* data, unsigned size);
     virtual const String& GetName() const;
-    /// Return a checksum of the file contents using the SDBM hash algorithm.
     virtual unsigned GetChecksum();
     
-    /// Open a filesystem file. Return true if successful.
     bool Open(const String& fileName, FileMode mode = FILE_READ);
-    /// Open from within a package file. Return true if successful.
     bool Open(PackageFile* package, const String& fileName);
-    /// Close the file.
     void Close();
-    /// Flush any buffered output to the file.
     void Flush();
-    /// Change the file name. Used by the resource system.
     void SetName(const String& name);
     
-    /// Return the open mode.
-    FileMode GetMode() const { return mode_; }
-    /// Return whether is open.
-    bool IsOpen() const { return handle_ != 0; }
-    /// Return the file handle.
-    void* GetHandle() const { return handle_; }
-    /// Return whether the file originates from a package.
-    bool IsPackaged() const { return offset_ != 0; }
+    FileMode GetMode() const;
+    bool IsOpen() const;
+    void* GetHandle() const;
+    bool IsPackaged() const;
+    
+    tolua_readonly tolua_property__get_set String& name;
+    tolua_readonly tolua_property__get_set unsigned checksum;
+    tolua_readonly tolua_property__get_set FileMode mode;
+    tolua_readonly tolua_property__is_set bool open;
+    tolua_readonly tolua_property__is_set bool packaged;
 };

+ 44 - 34
Extras/LuaScript/pkgs/IO/FileSystem.pkg

@@ -1,70 +1,80 @@
 $#include "FileSystem.h"
 
-/// Return files.
 static const unsigned SCAN_FILES;
-/// Return directories.
 static const unsigned SCAN_DIRS;
-/// Return also hidden files.
 static const unsigned SCAN_HIDDEN;
 
-/// Subsystem for file and directory operations and access control.
 class FileSystem : public Object
 {
-public:
-    /// Set the current working directory.
     bool SetCurrentDir(const String& pathName);
-    /// Create a directory.
+    bool SetCurrentDir(const char* pathName);
+    
     bool CreateDir(const String& pathName);
-    /// Run a program using the command interpreter, block until it exits and return the exit code. Will fail if any allowed paths are defined.
+    bool CreateDir(const char* pathName);
+    
     int SystemCommand(const String& commandLine);
-    /// Open a file in an external program, with mode such as "edit" optionally specified. Will fail if any allowed paths are defined.
+    int SystemCommand(const char* commandLine);
+    
+    int SystemRun(const String& fileName, const Vector<String>& arguments);
+    int SystemRun(const char* fileName, const Vector<String>& arguments);
+    
     bool SystemOpen(const String& fileName, const String& mode = String::EMPTY);
-    /// Copy a file. Return true if successful.
+    bool SystemOpen(const char* fileName, const char* mode = 0);
+    
     bool Copy(const String& srcFileName, const String& destFileName);
-    /// Rename a file. Return true if successful.
+    bool Copy(const char* srcFileName, const char* destFileName);
+    
     bool Rename(const String& srcFileName, const String& destFileName);
-    /// Delete a file. Return true if successful.
+    bool Rename(const char* srcFileName, const char* destFileName);
+    
     bool Delete(const String& fileName);
-    /// Register a path as allowed to access. If no paths are registered, all are allowed.
+    bool Delete(const char* fileName);
+    
     void RegisterPath(const String& pathName);
+    void RegisterPath(const char* pathName);
     
-    /// Return the absolute current working directory.
     String GetCurrentDir() const;
-    /// Return whether paths have been registered.
-    bool HasRegisteredPaths() const { return allowedPaths_.Size() > 0; }
-    /// Check if a path is allowed to be accessed. If no paths are registered, all are allowed.
+    bool HasRegisteredPaths() const;
+    
     bool CheckAccess(const String& pathName) const;
-    /// Returns the file's last modified time as seconds since 1.1.1970, or 0 if can not be accessed.
+    bool CheckAccess(const char* pathName) const;
+    
     unsigned GetLastModifiedTime(const String& fileName) const;
-    /// Check if a file exists.
+    unsigned GetLastModifiedTime(const char* fileName) const;
+    
     bool FileExists(const String& fileName) const;
-    /// Check if a directory exists.
+    bool FileExists(const char* fileName) const;
+    
     bool DirExists(const String& pathName) const;
-    /// Return the program's directory.
+    bool DirExists(const char* pathName) const;
+    
+    // void ScanDir(Vector<String>& result, const String& pathName, const String& filter, unsigned flags, bool recursive) const;
+    tolua_outside Vector<String> FileSystemScanDir @ ScanDir(const String& pathName, const String& filter, unsigned flags, bool recursive) const;
+    tolua_outside Vector<String> FileSystemScanDir @ ScanDir(const char* pathName, const char* filter, unsigned flags, bool recursive) const;
+    
     String GetProgramDir() const;
-    /// Return the user documents directory.
     String GetUserDocumentsDir() const;
 };
 
-/// Split a full path to path, filename and extension. The extension will be converted to lowercase.
-void SplitPath(const String& fullPath, String& pathName, String& fileName, String& extension);
-/// Return the path from a full path.
+// void SplitPath(const String& fullPath, String& pathName, String& fileName, String& extension);
 String GetPath(const String& fullPath);
-/// Return the filename from a full path.
 String GetFileName(const String& fullPath);
-/// Return the extension from a full path, converted to lowercase.
 String GetExtension(const String& fullPath);
-/// Return the filename and extension from a full path. The extension will be converted to lowercase.
 String GetFileNameAndExtension(const String& fullPath);
-/// Replace the extension of a file name with another.
 String ReplaceExtension(const String& fullPath, const String& newExtension);
-/// Add a slash at the end of the path if missing and convert to internal format (use slashes.)
 String AddTrailingSlash(const String& pathName);
-/// Remove the slash from the end of a path if exists and convert to internal format (use slashes.)
 String RemoveTrailingSlash(const String& pathName);
-/// Return the parent path, or the path itself if not available.
 String GetParentPath(const String& pathName);
-/// Convert a path to internal format (use slashes.)
 String GetInternalPath(const String& pathName);
-/// Convert a path to the format required by the operating system.
 String GetNativePath(const String& pathName);
+
+${
+
+static Vector<String> FileSystemScanDir(const FileSystem* fileSystem, const String& pathName, const String& filter, unsigned flags, bool recursive)
+{
+    Vector<String> result;
+    fileSystem->ScanDir(result, pathName, filter, flags, recursive);
+    return result;
+}
+
+$}

+ 10 - 19
Extras/LuaScript/pkgs/IO/Log.pkg

@@ -1,37 +1,28 @@
 $#include "Log.h"
 
-/// Debug message level. By default only shown in debug mode.
 static const int LOG_DEBUG;
-/// Informative message level.
 static const int LOG_INFO;
-/// Warning message level.
 static const int LOG_WARNING;
-/// Error message level.
 static const int LOG_ERROR;
-/// Disable all log messages.
 static const int LOG_NONE;
 
-/// Logging subsystem.
 class Log : public Object
 {
-public:
-    /// Set logging level.
     void SetLevel(int level);
-    /// Set whether to timestamp log messages.
     void SetTimeStamp(bool enable);
-    /// Set quiet mode ie. only print error entries to standard error stream (which is normally redirected to console also). Output to log file is not affected by this mode.
     void SetQuiet(bool quiet);
     
-    /// Return logging level.
-    int GetLevel() const { return level_; }
-    /// Return whether log messages are timestamped.
-    bool GetTimeStamp() const { return timeStamp_; }
-    /// Return last log message.
-    /// Return whether log is in quiet mode (only errors printed to standard error stream).
-    bool IsQuiet() const { return quiet_; }
+    int GetLevel() const;
+    bool GetTimeStamp() const;
+    String GetLastMessage() const;
+    bool IsQuiet() const;
     
-    /// Write to the log. If logging level is higher than the level of the message, the message is ignored.
+    static void Write(int level, const String& message);
     static void Write(int level, const char* message);
-    /// Write raw output to the log.
+    static void WriteRaw(const String& message, bool error = false);
     static void WriteRaw(const char* message, bool error = false);
+    
+    tolua_property__get_set int level;
+    tolua_property__get_set bool timeStamp;
+    tolua_property__is_set bool quiet;
 };

+ 20 - 22
Extras/LuaScript/pkgs/IO/PackageFile.pkg

@@ -1,34 +1,32 @@
 $#include "PackageFile.h"
 
-/// %File entry within the package file.
 struct PackageEntry
 {
-    /// Offset from the beginning.
-    unsigned offset_;
-    /// File size.
-    unsigned size_;
-    /// File checksum.
-    unsigned checksum_;
+    unsigned offset_ @ offset;
+    unsigned size_ @ size;
+    unsigned checksum_ @ checksum;
 };
 
-/// Stores files of a directory tree sequentially for convenient access.
 class PackageFile : public Object
 {
-public:
-    /// Open the package file. Return true if successful.
+    PackageFile(Context* context);
+    PackageFile(Context* context, const String& fileName);
+    virtual ~PackageFile();
+    
     bool Open(const String& fileName);
-    /// Check if a file exists within the package file.
     bool Exists(const String& fileName) const;
-    /// Return the file entry corresponding to the name, or null if not found.
     const PackageEntry* GetEntry(const String& fileName) const;
-    /// Return the package file name.
-    const String& GetName() const { return fileName_; }
-    /// Return hash of the package file name.
-    StringHash GetNameHash() const { return nameHash_; }
-    /// Return number of files.
-    unsigned GetNumFiles() const { return entries_.Size(); }
-    /// Return total size of the package file.
-    unsigned GetTotalSize() const { return totalSize_; }
-    /// Return checksum of the package file contents.
-    unsigned GetChecksum() const { return checksum_; }
+    const HashMap<String, PackageEntry>& GetEntries() const;
+    
+    const String& GetName() const;
+    StringHash GetNameHash() const;
+    unsigned GetNumFiles() const;
+    unsigned GetTotalSize() const;
+    unsigned GetChecksum() const;
+    
+    tolua_readonly tolua_property__get_set String& name;
+    tolua_readonly tolua_property__get_set StringHash nameHash;
+    tolua_readonly tolua_property__get_set unsigned numFiles;
+    tolua_readonly tolua_property__get_set unsigned totalSize;
+    tolua_readonly tolua_property__get_set unsigned checksum;
 };

+ 40 - 0
Extras/LuaScript/pkgs/IO/Serializer.pkg

@@ -0,0 +1,40 @@
+$#include "Serializer.h"
+
+class Serializer
+{
+    // virtual unsigned Write(const void* data, unsigned size);
+    
+    bool WriteInt(int value);
+    bool WriteShort(short value);
+    bool WriteByte(signed char value);
+    bool WriteUInt(unsigned value);
+    bool WriteUShort(unsigned short value);
+    bool WriteUByte(unsigned char value);
+    bool WriteBool(bool value);
+    bool WriteFloat(float value);
+    bool WriteIntRect(const IntRect& value);
+    bool WriteIntVector2(const IntVector2& value);
+    bool WriteRect(const Rect& value);
+    bool WriteVector2(const Vector2& value);
+    bool WriteVector3(const Vector3& value);
+    bool WritePackedVector3(const Vector3& value, float maxAbsCoord);
+    bool WriteVector4(const Vector4& value);
+    bool WriteQuaternion(const Quaternion& value);
+    bool WritePackedQuaternion(const Quaternion& value);
+    bool WriteColor(const Color& value);
+    bool WriteBoundingBox(const BoundingBox& value);
+    bool WriteString(const String& value);
+    bool WriteFileID(const String& value);
+    bool WriteStringHash(const StringHash& value);
+    bool WriteShortStringHash(const ShortStringHash& value);
+    bool WriteBuffer(const PODVector<unsigned char>& buffer);
+    bool WriteResourceRef(const ResourceRef& value);
+    bool WriteResourceRefList(const ResourceRefList& value);
+    bool WriteVariant(const Variant& value);
+    bool WriteVariantData(const Variant& value);
+    bool WriteVariantVector(const VariantVector& value);
+    bool WriteVariantMap(const VariantMap& value);
+    bool WriteVLE(unsigned value);
+    bool WriteNetID(unsigned value);
+    bool WriteLine(const String& value);
+};

+ 2 - 0
Extras/LuaScript/pkgs/IOLuaAPI.pkg

@@ -1,9 +1,11 @@
 $#define TOLUA_RELEASE
 
+$pfile "IO/Deserializer.pkg"
 $pfile "IO/File.pkg"
 $pfile "IO/FileSystem.pkg"
 $pfile "IO/Log.pkg"
 $pfile "IO/PackageFile.pkg"
+$pfile "IO/Serializer.pkg"
 
 $using namespace Urho3D;
 $#pragma warning(disable:4800)

+ 32 - 83
Extras/LuaScript/pkgs/Input/Input.pkg

@@ -1,120 +1,69 @@
 $#include "Input.h"
 
-/// %Input state for a finger touch.
 struct TouchState
 {
-    /// Touch (finger) ID.
     int touchID_ @ touchID;
-    /// Position in screen coordinates.
     IntVector2 position_ @ position;
-    /// Last position in screen coordinates.
     IntVector2 lastPosition_ @ lastPosition;
-    /// Movement since last frame.
     IntVector2 delta_ @ delta;
-    /// Finger pressure.
     float pressure_ @ pressure;
 };
 
-/// %Input state for a joystick.
 struct JoystickState
 {
-    /// Return number of buttons.
-    unsigned GetNumButtons() const { return buttons_.Size(); }
-    /// Return number of axes.
-    unsigned GetNumAxes() const { return axes_.Size(); }
-    /// Return number of hats.
-    unsigned GetNumHats() const { return hats_.Size(); }
+    unsigned GetNumButtons() const;
+    unsigned GetNumAxes() const;
+    unsigned GetNumHats() const;
     
-    /// Check if a button is held down.
-    bool GetButtonDown(unsigned index) const
-    {
-        if (index < buttons_.Size())
-            return buttons_[index];
-        else
-            return false;
-    }
+    bool GetButtonDown(unsigned index) const;
+    bool GetButtonPress(unsigned index) const;
+    float GetAxisPosition(unsigned index) const;
+    int GetHatPosition(unsigned index) const;
     
-    /// Check if a button has been pressed on this frame.
-    bool GetButtonPress(unsigned index) const
-    {
-        if (index < buttons_.Size())
-            return buttonPress_[index];
-        else
-            return false;
-    }
-    
-    /// Return axis position.
-    float GetAxisPosition(unsigned index) const
-    {
-        if (index < axes_.Size())
-            return axes_[index];
-        else
-            return 0.0f;
-    }
-    
-    /// Return hat position.
-    int GetHatPosition(unsigned index) const
-    {
-        if (index < hats_.Size())
-            return hats_[index];
-        else
-            return HAT_CENTER;
-    }
+    tolua_readonly tolua_property__get_set unsigned numButtons;
+    tolua_readonly tolua_property__get_set unsigned numAxes;
+    tolua_readonly tolua_property__get_set unsigned numHats;
 };
 
-/// %Input subsystem. Converts operating system window messages to input state and events.
 class Input : public Object
 {
-public:
-    /// Set whether the operating system mouse cursor is visible. When not visible (default), is kept centered to prevent leaving the window.
     void SetMouseVisible(bool enable);
-    /// Open a joystick. Return true if successful.
     bool OpenJoystick(unsigned index);
-    /// Close a joystick.
     void CloseJoystick(unsigned index);
-    /// Redetect joysticks. Return true if successful.
     bool DetectJoysticks();
     
-    /// Check if a key is held down.
     bool GetKeyDown(int key) const;
-    /// Check if a key has been pressed on this frame.
     bool GetKeyPress(int key) const;
-    /// Check if a mouse button is held down.
     bool GetMouseButtonDown(int button) const;
-    /// Check if a mouse button has been pressed on this frame.
     bool GetMouseButtonPress(int button) const;
-    /// Check if a qualifier key is held down.
     bool GetQualifierDown(int qualifier) const;
-    /// Check if a qualifier key has been pressed on this frame.
     bool GetQualifierPress(int qualifier) const;
-    /// Return the currently held down qualifiers.
     int GetQualifiers() const;
-    /// Return mouse position within window. Should only be used with a visible mouse cursor.
     IntVector2 GetMousePosition() const;
-    /// Return mouse movement since last frame.
-    const IntVector2& GetMouseMove() const { return mouseMove_; }
-    /// Return horizontal mouse movement since last frame.
-    int GetMouseMoveX() const { return mouseMove_.x_; }
-    /// Return vertical mouse movement since last frame.
-    int GetMouseMoveY() const { return mouseMove_.y_; }
-    /// Return mouse wheel movement since last frame.
-    int GetMouseMoveWheel() const { return mouseMoveWheel_; }
-    /// Return number of active finger touches.
-    unsigned GetNumTouches() const { return touches_.Size(); }
-    /// Return active finger touch by index.
+    const IntVector2& GetMouseMove() const;
+    int GetMouseMoveX() const;
+    int GetMouseMoveY() const;
+    int GetMouseMoveWheel() const;
+    unsigned GetNumTouches() const;
     TouchState* GetTouch(unsigned index) const;
-    /// Return number of connected joysticks.
-    unsigned GetNumJoysticks() const { return joysticks_.Size(); }
-    /// Return joystick name by index.
+    unsigned GetNumJoysticks() const;
     const String& GetJoystickName(unsigned index) const;
-    /// Return joystick state by index. Automatically open if not opened yet.
     JoystickState* GetJoystick(unsigned index);
-    /// Return whether fullscreen toggle is enabled.
-    bool GetToggleFullscreen() const { return toggleFullscreen_; }
-    /// Return whether the operating system mouse cursor is visible.
-    bool IsMouseVisible() const { return mouseVisible_; }
-    /// Return whether application window has input focus.
-    bool HasFocus() { return inputFocus_; }
-    /// Return whether application window is minimized.
+    bool GetToggleFullscreen() const;
+    bool IsMouseVisible() const;
+    bool HasFocus();
     bool IsMinimized() const;
+    
+    tolua_readonly tolua_property__get_set int qualifiers;
+    tolua_readonly tolua_property__get_set IntVector2 mousePosition;
+    tolua_readonly tolua_property__get_set IntVector2& mouseMove;
+    tolua_readonly tolua_property__get_set int mouseMoveX;
+    tolua_readonly tolua_property__get_set int mouseMoveY;
+    tolua_readonly tolua_property__get_set int mouseMoveWheel;
+    tolua_readonly tolua_property__get_set unsigned numTouches;
+    tolua_readonly tolua_property__get_set unsigned numJoysticks;
+    tolua_readonly tolua_property__get_set bool toggleFullscreen;
+    tolua_property__is_set bool mouseVisible;
+    tolua_readonly tolua_property__has_set bool focus;
+    tolua_readonly tolua_property__is_set bool minimized;
 };