ons安卓吧 关注:178,425贴子:1,670,935
  • 20回复贴,共1

WP8的UVEngine游戏引擎开发的简单上手

只看楼主收藏回复

也许会开发安卓版,然后跑跑Rewrite小游戏之类的是绝对没有问题的
目前具有极强的交互性,以下的视频为演示,获取触摸位置与简单的Storyboard动画。
http://v.youku.com/v_show/id_XNTcwMzI5NzY4.html
脚本代码如下(这不是原生的WP8程序,只是随便从任何位置导入(包括网络)就能执行的脚本):
采用的高级语言是IronRuby。这只是简单地调用几个系统的类库获得基本的交互能力,并没有调用我们前几天写的NS脚本的解析。总觉得这玩意儿要跟NS搭配使用才能达到最佳状态。
顺带一提:多线程支持地妥妥的,只需要include System::Threading即可……
require 'mscorlib' include System
include System::Windows::Media
include System::Windows::Media::Animation
include System::Windows::Controls
include System::Windows
include System::Threading
include System::Windows::Input
include System::IO
include System::IO::IsolatedStorage # isostore=IsolatedStorageFile.new
timer=Storyboard.new tb=TextBlock.new
tb.Text="X:0 \nY:0"
tb.name="tb"
Phone.find_name("LayoutRoot").children.add(tb)
button = Button.new
button.name="button"
button.content = "Begin"
button.width=100
Phone.find_name("LayoutRoot").children.add(button)
button.click do |s,e|
if button.Content=="Begin"
MessageBox.show("Storyboard timer begin!")
timer.Begin
button.Content="Stop"
else
MessageBox.show("Storyboard timer Stop!")
timer.Stop
button.Content="Begin"
end
end # Set the titles
# Phone.find_name("ApplicationTitle").text = "uvengine is running!"
# Phone.find_name("PageTitle").text = "IronRuby for UVEngine" # Create a new text block
textBlock = TextBlock.new
textBlock.name = "textBlock"
textBlock.text = "IronRuby is running on Windows Phone 7!"
textBlock.foreground = SolidColorBrush.new(Colors.Green)
textBlock.font_size = 48
textBlock.text_wrapping = System::Windows::TextWrapping.Wrap
# Add the text block to the page
# Phone.find_name("ContentPanel").children.add(textBlock)
# Phone.find_name("LayoutRoot").manipulationdelta do |s,e|
# delta_x=e.DeltaManipulation.Translation.X
# delta_y=e.DeltaManipulation.Translation.Y
# MessageBox.Show(Convert.ToString(delta_x)+'\n'+Convert.ToString(delta_y))
# end # timer.begin
# Touch.FrameReported.add(method(:touch))
Touch.FrameReported do |s,e|
point = e.GetPrimaryTouchPoint(nil)
x = point.Position.X
y = point.Position.Y
Phone.find_name("button").margin = Thickness.new(x-50,y-25,430-x,0)
Phone.find_name("tb").text = "X:"+Convert.ToString(x)+"\nY:"+Convert.ToString(y)
end anim = DoubleAnimation.new
anim.From = 0.0
anim.To = 1.0
anim.Duration = Duration.new(TimeSpan.FromMilliseconds(500))
Storyboard.SetTarget(anim,button)
timer.Children.Add(anim)
timer.AutoReverse = true
timer.RepeatBehavior = RepeatBehavior.Forever
Storyboard.SetTargetProperty(anim, Phone.GetPropertyPath("(UIElement.Opacity)"))


1楼2013-06-13 18:16回复
    这是楼主自己开发的?


    来自手机贴吧5楼2013-06-13 21:46
    收起回复
      ONS不行了吗?


      来自Android客户端6楼2013-06-13 22:10
      收起回复
        总之只有这些还是不够的。
        首先Rewrite的很多特效是用theora编码的,我们目前还在研究中,ons要做到动态解码这些东西和多线程估计就已经挂掉了。
        而且WP上没有SDL,ons的源代码可以说是一点都没有用上。缺少这个依赖项使得ons在wp上编译基本不科学了。
        最后就是缺少移植者,等简化了流程之后我们会写几个示例,到时候移植者只用修改脚本的少量内容就行了,我们会尽量让制作特效的难度不高于NS脚本。


        7楼2013-06-13 22:33
        回复
          rewrite已经有ons了,暑假就能完善


          IP属地:云南来自Android客户端8楼2013-06-14 12:35
          收起回复
            不懂帮顶


            IP属地:四川来自Android客户端9楼2013-06-14 13:02
            回复
              WP啊!
              》》》我睿智,我独行,来自WP8数据终端


              IP属地:江苏来自WindowsPhone客户端10楼2013-06-14 16:33
              回复
                ⊙△⊙我只路过
                ——⊙△⊙我曾经也是个像lz一样的水怪,直到我的膝盖中了一箭。。。。啊。。。。。


                IP属地:四川来自Android客户端11楼2013-06-14 23:07
                回复
                  不懂帮顶


                  来自手机贴吧13楼2013-06-15 06:41
                  回复
                    不明觉厉
                    ——来自执信中学贴吧客户端,我爱执信,又大又漂亮!~


                    IP属地:加拿大来自Android客户端14楼2013-06-15 10:16
                    回复
                      不知帮顶
                         ~~ で踊る自由な海鸟は
                            手を伸ばせば触れられそう   でも指に羽は高くて


                      IP属地:上海来自Android客户端15楼2013-06-15 19:12
                      回复