vala语言很有前景
Tofloor
poster avatar
z85525006
deepin
2012-10-13 11:08
Author
以前不识vala的好啊... :  :  :  :  :  :  :
我今天学了一下vala,和C#99%相似,结构清晰,写出的界面代码非常美观和容易去阅读。可惜缺少一个IDE拖拉环境,不然真的和 C#有的拼搏的。
     我很看好这门语言,非常好玩,非常爽。
     
      Form1...slgner..vala 模块代码. 主要是界面部分的代码.
     
  1. using Gtk;
  2. namespace WindowApplication1
  3. {
  4.     public class Form1 : Gtk.Window
  5.     {
  6.         public void InitializeComponent()
  7.         {
  8.             this.button1 = new Gtk.Button();
  9.             this.button2 = new Gtk.Button();
  10.             this.button3 = new Gtk.Button();
  11.             this.fixed   = new Gtk.Fixed();
  12.             // button1.
  13.             this.button1.set_label("测试一");                        
  14.             // button2.
  15.             this.button2.set_label("测试二");            
  16.             // button3.
  17.             this.button3.set_label("测试三");
  18.             // window.
  19.             this.title = "测试窗口";
  20.             this.set_default_size(300, 300);
  21.             this.add(this.fixed);
  22.             // window event init.
  23.             this.destroy.connect(()=>{Gtk.main_quit();});
  24.             // add widgets. 测试代码... ...
  25.             this.fixed.put(this.button1, 10, 20);
  26.             this.fixed.put(this.button2, 50, 50);
  27.             this.fixed.put(this.button3, 120, 50);  
  28.         }
  29.         //
  30.         public Gtk.Button button1;
  31.         public Gtk.Button button2;
  32.         public Gtk.Button button3;
  33.         public Gtk.Fixed  fixed;
  34.     }
  35. }
  36.       
Copy the Code

      Form1.vala ... 事件部分代码.全部的关于事件的代码都集中在这个模块,用PYTHON写代码,真写不出这种感觉,vala写的真爽.分离的真好... ...
     
  1.        using WindowApplication1;
  2. using Gtk;
  3. namespace WindowsApplication1
  4. {
  5.     public class Form1 : WindowApplication1.Form1
  6.     {
  7.         public Form1()
  8.         {
  9.             //初始化
  10.             InitializeComponent();
  11.             // init buton1 event.
  12.             this.button1.clicked.connect(this.on_button1_clicked);
  13.             // init button3 event.
  14.             this.button3.clicked.connect(this.on_button3_clicked);
  15.         }
  16.         
  17.         private void on_button1_clicked(Gtk.Button widget)
  18.         {
  19.             this.button3.set_label("测试更改文本");
  20.         }
  21.         
  22.         private void on_button3_clicked(Gtk.Button widget)
  23.         {
  24.             this.button1.set_label("你被我改变了");
  25.         }
  26.     }
  27. }
  28.       
Copy the Code
      Program.vala 最后一个模块,是主函数.不用看见PYTHON连这个东西都没有,哎...
     
  1.       using WindowsApplication1;
  2. using Gtk;
  3. public class Program
  4. {
  5.     static int main(string[] args)
  6.     {
  7.         Gtk.init(ref args);
  8.         WindowsApplication1.Form1 form1 = new WindowsApplication1.Form1();
  9.         form1.show_all();
  10.         Gtk.main();
  11.         return 0;
  12.     }
  13. }
  14.       
Copy the Code
       总体感觉vala 这门语言非常爽... 类似C#的语法,居然生出C的代码,一个字"爽",两个字"真爽"... 三个字"...
      不知道能否嵌入汇编.
      asm(".....":...:......值得期待.

重绘事件代码.test_window.tar.gz
如果以后都能用这门语言的话,我快乐的不得了.哈哈哈.非常接近C/C++,C#,很适合使用.
真想用这门语言重写代码编辑器,用它来写IDE啊..可惜时间不够啊,不能这样做...我还要学习其它的东西,
Reply Favorite View the author
All Replies
z85525006
deepin
2012-10-16 19:01
#1
用vala 的好处,直接就可以编写类C#的设计模式。
vala真的很爽。
http://www.cnblogs.com/zhenyulu/categor ... l?Show=All
Reply View the author
tuhaihe
deepin
2012-10-16 23:26
#2
这个是 GNOME 搞得吧。
Reply View the author
electricface
deepin
2012-10-17 01:20
#3
快手aauto可能可以嵌入汇编吧.
Reply View the author
z85525006
deepin
2012-10-17 02:24
#4
Reply View the author
vala2012
deepin
2012-10-17 16:52
#5
我是一名在线大学生, 刚刚接触vala,我也感觉vala比较好用,同意开发一个IDE环境+拖拉界面。
Reply View the author
z85525006
deepin
2012-10-19 00:04
#6
vala语言的中文教程.

Vala+Tutorial.doc.tar.gz
Reply View the author
vala2012
deepin
2012-10-19 07:47
#7
Reply View the author
zhaixiang
deepin
2012-10-31 07:17
#8
iagno(黑白棋)用vala编写,然后自动生成C语言,可是gnome-games-3.4.2中iagno的AI貌似有BUG,经常出现“死循环”,造成高CPU占用,vala fans可以FIX一下吗?
Reply View the author
vala2012
deepin
2012-10-31 10:08
#9
iagno(黑白棋)用vala编写,然后自动生成C语言,可是gnome-games-3.4.2中iagno的AI貌似有BUG,经常出现“死循环”,造成高CPU占用,vala fans可以FIX一下吗?
iagno似乎是官方的东西啊。
是真的吗?我也想去找出BUG,但是我现在也没有时间去测试啊,... ...
这个游戏玩的人也不多,有BUG就有BUG吧!浪费时间去找BUG。       
Reply View the author
zhaixiang
deepin
2012-10-31 16:33
#10
iagno似乎是官方的东西啊。
是真的吗?我也想去找出BUG,但是我现在也没有时间去测试啊,... ...
这个游戏玩的人也不多,有BUG就有BUG吧!浪费时间去找BUG。       

恩呐,gnome-games-3.4.2.tar.xz包里的,玩的人很少吗? ops:
Reply View the author