xUI - Portable Cocoa Touch Clone

Monkey Forums/Monkey Programming/xUI - Portable Cocoa Touch Clone

xzess(Posted 2011) [#1]
Well its a bit early WIP yet but you may use it if you like:

Html5 Demo (for the lazy ones ^^):
http://xzess.org/Webgames/xuidemo/


Extract to Monkey/Modules

You have to copy the directory /modules/xui/xui into your game.data directory


With XUI you can simply add Buttons, Labels and Images or Switches and much more with one line of code!

Current todo plans:
xUIList, xUIAlert

Coming up in the Release:


API:
'UI Functions
Function AddView:xUIView(Position:Vector,Visible:Bool)
Function AddLabel:xUILabel(UIView:xUIView,Text:String,Position:Vector)
Function AddButton:xUIButton(UIView:xUIView,Caption:String="Click Here",PositionX:Float,PositionY:Float,PixelLength:Int=150)
Function AddSwitch:xUISwitch(UIView:xUIView,Position:Vector,Checked:Bool)
Function AddCheckbox:xUICheckBox(Position:Vector)
Function AddEditbox:xUIEditbox(UIView:xUIView,Input:xUIKeyboard,Text:String,Position:Vector,Width:Float)
Function AddSlideLock:xUISlideLock(x:Float,y:Float)
Function AddCodeBlock:xUICodeBlock(x:Float,y:Float,width:Float,height:float)
Function AddUIKeyboard:xUIKeyboard(Position:Vector)
Function AddScrollText:xUIScrollText(UIView:xUIView,Text:String,TextPosition:Vector,WidthPx:Float,HeightPx:Float)
Function AddTabBar:xUITabBar()
Function AddTabBarItem:xUITabBarItem(ParentBar:xUITabBar,Text:String,TargetView:xUIView,IconPath:String)
Function AddImage:xUIImage(UIView:xUIView,ImagePath:String,Frames:Int,Position:Vector,Fullscreen:Bool)
Function AddSlider:xUISlider(UIView:xUIView,MinValue:Float=0,MaxValue:Float=100,CurrentValue:Float=0,Width:Float,Position:Vector)

Function AddColor(Red:Int,Green:Int,Blue:Int)

'Tools + Helper
Function ScaleToDeviceResolution(VirtualDisplaySize:Vector)
Function CheckCollision:Bool(x1:Float, y1:Float, w1:Float, h1:Float, x2:Float, y2:Float, w2:Float, h2:Float)
Function DrawImageFullscreen(image:Image,x:Float,y:Float,CurrentFrame:Int)
Function OnTouchHit:Bool(PositionStart:Vector,PositionEnd:Vector)
Function OnTouch:Bool(PositionStart:Vector,PositionEnd:Vector)

Screenshot of Example:


Example of usage:
Import xui



Class MyApp extends App	
Field MainPage:xUIView
Field Bttn:xUIButton
Field Img:xUIImage
Field Label:xUILabel
Field Switch:xUISwitch
Field Slider:xUISlider
Field helper:xUIHelper



	Method OnCreate()
		
	SetUpdateRate(25)
	
	MainPage = AddView(Vec(0,0),True)
	Img = AddImage(MainPage,"bg1.png",1,Vec(0,0),True)
	Bttn = AddButton(MainPage,"Press here",50,50,200)
	Label = AddLabel(MainPage,"This is a Label",Vec(0,200))
	Switch = AddSwitch(MainPage,Vec(150,150),True)
	Slider = AddSlider(MainPage,0,100,20,200,Vec(20,DeviceWidth()))
	
	helper = New xUIHelper
	helper.Show()
	
	
	'You can show/hide via Show() or Hide()
	' Label.Hide()ie.
	
	End
	Method OnLoading()
		
	End
	Method OnUpdate()
	
		If(Bttn.OnAction = True)
		Bttn.Reset() 'Reset to get clickable again
		Label.SetCaption("You pressed the Button")
		End
		
		Select Switch.Status
			Case SWITCH_OFF
			MainPage.Visible = False
			Img.SetFullscreen(False)
			Case SWITCH_ON 
			MainPage.Visible = True
			Img.SetFullscreen(True)
		End
	
	
		xUIObject.UpdateAll()
	End
	Method OnRender()
		Cls
		

		
		xUIObject.RenderAll()
	End
	
	'Custom Stuff
	
End


Function Main()
	New MyApp
End






If you like, please support this project via Paypal -> support@...
Or get free music @ music.xzess.org (with energy balance coupon)
Every cent helps to feed the family and results with more time for development :)



Jesse(Posted 2011) [#2]
nice xzess
but can you upload it in a zip file. I don't want to have to install winrar on my mac.
Please.


xzess(Posted 2011) [#3]
yeah man you're welcome.
here it is:
Http://www.xzess.org/xui.zip


matt(Posted 2011) [#4]
@Jesse take a look at The Unarchiver http://wakaba.c3.cx/s/apps/unarchiver.html or UnRarX http://www.unrarx.com - both are free.


Jesse(Posted 2011) [#5]
Thanks xzess, and thanks matt.
The reason I don't want to install anything extra on my laptop is because I just want to use it for programming and internet. so I bought a 30GB SSD drive and that is what I am using. the operating system took about 16 gig(bloated Snow Leopard- I can probably strip it to its core only but I rather stay of the technical stuff for now - not too familiar with macs yet). so I was left with like 10 gig for applications and code. I figured that would discipline me to keep only my code and the bare essentials in it. I have an external drive where I move stuff I don't need anymore or I am not working on.


Shinkiro1(Posted 2011) [#6]
The file seems to be down. Could you re-uploud?


Aman(Posted 2011) [#7]
Did you just update the demo?

It looks really cool. looking forward to use it. THANKS


xzess(Posted 2011) [#8]
Yes its WIP im sometimes updating the webdemo :)


Aman(Posted 2011) [#9]
Could you please re-upload the file. The provided link is not working


Samah(Posted 2011) [#10]
The reason I don't want to install anything extra on my laptop is because I just want to use it for programming and internet.

@Jesse: Just grab a portable version. I use heaps of programs at work that I run straight from a USB stick, so no need to install programs or leave sensitive data on the PC.
http://portableapps.com/

There's a portable version of 7zip you could use. It can read rar but not write, unfortunately. Having said that, the WinRAR guys have their own portable version called WinRAR Unplugged (commercial product with trial).
http://portableapps.com/apps/utilities/7-zip_portable


Jesse(Posted 2011) [#11]
Thanks Samah. I'll look into it.


xzess(Posted 2011) [#12]
@Aman Yes we will do a release soon.
we are currently working on an editor for it.
It will take some time but we planned it as wysiwyg with something like a device simulator bundled with the framework.


anawiki(Posted 2011) [#13]
From the whole thing it looks like I will be most pleased with "keyboard" feature (as long as it's iOS native keyboard). When can I donate?


xzess(Posted 2011) [#14]
Please wait with donations. It will be released soon!
All xUI components are simulated components because xUI is a portable Monkey GUI.
I will post more information very soon

Greetz


xzess(Posted 2011) [#15]
xUI is now in the last testing phase before first release.

Please navigate to this Page: http://www.xzess.org/xui/index.php5?title=Main_Page
for further Informations

You can test some demos (more will be added soon) in the new xUI Wiki:

http://www.xzess.org/xui/index.php5?title=SlidelockDemo
http://www.xzess.org/xui/index.php5?title=ListboxDemo
http://www.xzess.org/xui/index.php5?title=ButtonDemo
http://www.xzess.org/xui/index.php5?title=AnimationDemo
http://www.xzess.org/xui/index.php5?title=TimerDemo


Here are some features of xUI:
- Whole UI is skinable with your own templates!
- Simply design your GUI with a few lines of code!
- Open Source for all members!
- rapid fun
( - wysiwyg editor planned for near future )

I will add more demos soon!


Xaron(Posted 2011) [#16]
Great job! Will check it out and probably use it. :)


marksibly(Posted 2011) [#17]
Hi,

That looks incredible!

Are all the graphics original, ie: nothing 'ripped'?


xzess(Posted 2011) [#18]
Hi thanks for resonance,

to be honest, everything is ripped ^^
Its all pure monkey code with use of mojo.
Its slower that way instead of using the real device UI but portable to all devices.

We should work all hand in hand on a Community Module which supports simple Interface Functions for all targets with UI
So we all profit from it and for sure there will be some helpful guys guys for every target. Maybe some guru guys, mostly those quiet ones who don't write into boards because they have no time ^^

It shouldn't be the problem to start with a button

Here is something im working on for iMonk (WIP as most stuff atm unfortunately):

uifunctions.monkey
Import "native/ios.cpp"  'contains native cpp code

Extern

Function UICreateButton(text$,x1#,y1#,x2#,y2#)
Function  UICreateTextField(placeholder$, x1#, y1#, x2#,y2#)
Function  UICreateScrollView(ScrollViewWidth#,ScrollViewHeight#,ContentWidth#, ContentHeight#)


native.cpp
void UICreateButton(String text, float x1,float y1, float x2, float y2)
{
    UIButton    *button;
    NSString *StrText = text.ToNSString();

	   UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    myButton.frame = CGRectMake(x1, y1, x2, y2); // position in the parent view and set the size of the button
    [myButton setTitle:StrText forState:UIControlStateNormal];
    // add targets and actions
    
	//[myButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
    
	// Add Subview to mojo window
    [superView addSubview:myButton];
	
}

void UICreateTextField(String placeholder, float x1,float y1, float x2, float y2)
{
    UITextField    *textfield;
    NSString *placeholderStr = placeholder.ToNSString();

    // Create textfield 
    textfield = [[UITextField alloc] initWithFrame:CGRectMake(x1, y1, x2, y2)];
    textfield.placeholder = placeholderStr;
    textfield.delegate = self;
    textfield.returnKeyType = UIReturnKeyDone;
    textfield.borderStyle = UITextBorderStyleBezel;
    textfield.enablesReturnKeyAutomatically = TRUE;
    // Add Subview to mojo window
    [superView addSubview:textfield];
}

void UICreateScrollView(float ScrollViewWidth, float ScrollViewHeight, float ContentWidth, float ContentHeight)
{
    // Create scrollview
    scrollview = [[UIScrollView alloc] init];      
    scrollview.contentSize = CGSizeMake(ContentWidth, ContentHeight);
    scrollview.frame = CGRectMake(0, 0, ScrollViewWidth, ScrollViewHeight);
    scrollview.scrollsToTop = NO;
    scrollview.delegate = self;
	// Add Subview to mojo window
    [superView addSubview:scrollview];
}


Maybe this is a start for iOS.

By the way, Mark maybe you can add feature to load images from url to mojo, i overloaded the LoadImage with a Url String instead of a File String on my own installation where it loads the surface.

This will load an UIImage from URL:
UIImage * img = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@..."]]];



Greetz


CopperCircle(Posted 2011) [#19]
Anyone still got this? Site seems to be down.

Thanks.


Tibit(Posted 2011) [#20]
I must have missed this, I'm also interested in testing this out! Like said, all links seems to be broken now?


xzess(Posted 2011) [#21]
Hello there, its been a while :)

I have no time to complete some old stuff, so maybe you can have a use of it.

So here's my small christmas present for you:


http://www.tim-koepsel.info/xui.rar

Its WIP but maybe you can follow my ideas and fix the crap out :)
You can do what you want with it, but have fun :)

*** INSTRUCTIONS ***
Extract the Archive to your MonkeyHomeDirectory/modules/xui/
Copy Examples to your bananas if you want
Copy the xui folder into every new project's data directory << VERY IMPORTANT!!
***************


Then test out the examples to see if it works and everything is right


Aman(Posted 2011) [#22]
Thanks. I was looking forward to use it but was never able to download it. I have my own GUI module but I can always improve it.

Thanks again and good luck on whatever your doing right now.


matt(Posted 2011) [#23]
xzess site seems down?