ioPlus module
Monkey Forums/User Modules/ioPlus module
| ||
This is a module that does some basic file input&output. It also adds support to the native Windows Phone 7 keyboard (Not perfect though). And it has a two, or one button notification dialog. It has the following functions: void showAlert(string title, string message, bool twoButtons, string Button1, string Button2) description: opens a notification dialog with one or two buttons. To get the result(a string that contain the text of the pressed button), use the getClickedButton() function. Supported targets: XNA, Android, Flash(Not complete) string getClickedButton() description: Used to get the result of the ShowAlert() funtion. It returns a string that contain the text of the pressed button. After it is called. result will be reset to "Not intiated yet". Supported targets: XNA, Android void showXNAKeyboard(string title, string prompt, string defaultText) description: XNA virtual keyboards is not supported in monkey. This will toggle the keyboard. To get the result (a string that has the typed content), use the getKeyboardInput() function. Supported targets: XNA only (Tested on WP7) string getKeyboardInput() description: Used to get the result of the showKeyboard funtion. It returns a string that contains the text typed by the user. After it is called. result will be reset to "Not intiated yet". Supported targets: XNA only (Tested on WP7) string loadStringFromFile(string filename) description: reads a file and return its content as a file. If the file does not exit, it will create it. Supported targets: XNA, Android, GLFW void saveStringToFile(string message, string filename) description: write a string to a file. If the file does not exit, it will create it. Does not append data, it writes over them. If you want to append content to a file, use loadStringFromFile first. Supported targets: XNA, Android, GLFW Warning: I did this really fast. It has been a long time since I worked on them. There might be a bug here or there and there is plenty of room for enhancements. I created a Google Project page here: http://code.google.com/p/monkey-ioplus You can download the module from here: http://monkey-ioplus.googlecode.com/files/ioPlus.zip Alternative Link: http://www.2shared.com/file/9ObqQhz6/ioPlus.html |
| ||
Wow that's really cool! Thanks, will check it out! |
| ||
Hey Xaron, I had a feeling you would be interested in this ;) Here are some stuff I forgot to mention in the first post: showXNAKeyboard Will be ignored under windows. getKeyboardInput will always return "XNAWINDOWS". I also forget to include a function that might be useful for some: Get_XNA_Target which will tell you if the game is running under windows, wp7, or xbox. There is also another function called share(text:String) that will allow user to share a text using the native share method in Android and added a sharing method for WP7 as well. But it is not finished yet. loadStringFromFile & saveStringToFile create & handle files in the program's path by default. I forgot where exactly will that be for each target. Possible functions to add: SetPath:Void(path:String) GetPath:Strin() ResetPath:Void() FileExist:Bool(filename:String) |
| ||
WouldDirectoryFiles:String[] (dirPath:String) also be possible? Thanks for sharing. |
| ||
I think so but I think what is important to add iOS as a supported target first. |
| ||
Thanks! |
| ||
+1 for android and IOS support :) |
| ||
android is already supported. GLFW, and XNA are also supported. HTML5 and Flash are not possible to support them using the same approach. The only way to suport them is through the save and load file dialog. |
| ||
"HTML5 and Flash are not possible to support them using the same approach. The only way to suport them is through the save and load file dialog." Since you're already running a browser then you could probably use a serverside script like PHP/ASP in these cases to write to a file. I'm very interested whether you can pull it off to write local files on iOs... thanks so far! |
| ||
Why? so far it seems straight forward: http://tinyurl.com/AppleIOSfilesystem https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Strings/Articles/readingFiles.html#//apple_ref/doc/uid/TP40003459-SW1 I am thinking of providing functions to save files directly when available or using the file delegate when available |
| ||
Is ioPlus dead? |
| ||
Awesome module! |