reflexion 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.doc/ext/reflex/application.cpp +54 -39
- data/.doc/ext/reflex/capture_event.cpp +87 -0
- data/.doc/ext/reflex/draw_event.cpp +103 -0
- data/.doc/ext/reflex/event.cpp +73 -0
- data/.doc/ext/reflex/focus_event.cpp +98 -0
- data/.doc/ext/reflex/frame_event.cpp +133 -0
- data/.doc/ext/reflex/image_view.cpp +74 -0
- data/.doc/ext/reflex/key_event.cpp +124 -0
- data/.doc/ext/reflex/native.cpp +45 -6
- data/.doc/ext/reflex/pointer_event.cpp +181 -0
- data/.doc/ext/reflex/reflex.cpp +17 -41
- data/.doc/ext/reflex/scroll_event.cpp +141 -0
- data/.doc/ext/reflex/selector.cpp +135 -0
- data/.doc/ext/reflex/style.cpp +253 -0
- data/.doc/ext/reflex/style_length.cpp +133 -0
- data/.doc/ext/reflex/style_length2.cpp +149 -0
- data/.doc/ext/reflex/style_length4.cpp +192 -0
- data/.doc/ext/reflex/update_event.cpp +77 -0
- data/.doc/ext/reflex/view.cpp +408 -88
- data/.doc/ext/reflex/wheel_event.cpp +146 -0
- data/.doc/ext/reflex/window.cpp +95 -92
- data/Rakefile +6 -5
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +67 -49
- data/ext/reflex/capture_event.cpp +92 -0
- data/ext/reflex/draw_event.cpp +110 -0
- data/ext/reflex/event.cpp +77 -0
- data/ext/reflex/extconf.rb +18 -68
- data/ext/reflex/focus_event.cpp +104 -0
- data/ext/reflex/frame_event.cpp +143 -0
- data/ext/reflex/image_view.cpp +77 -0
- data/ext/reflex/key_event.cpp +133 -0
- data/ext/reflex/native.cpp +45 -6
- data/ext/reflex/pointer_event.cpp +195 -0
- data/ext/reflex/reflex.cpp +21 -47
- data/ext/reflex/scroll_event.cpp +152 -0
- data/ext/reflex/selector.cpp +144 -0
- data/ext/reflex/style.cpp +277 -0
- data/ext/reflex/style_length.cpp +140 -0
- data/ext/reflex/style_length2.cpp +157 -0
- data/ext/reflex/style_length4.cpp +204 -0
- data/ext/reflex/update_event.cpp +81 -0
- data/ext/reflex/view.cpp +469 -114
- data/ext/reflex/wheel_event.cpp +158 -0
- data/ext/reflex/window.cpp +130 -123
- data/include/reflex/application.h +12 -7
- data/include/reflex/defs.h +13 -89
- data/include/reflex/event.h +260 -0
- data/include/reflex/exception.h +17 -11
- data/include/reflex/image_view.h +45 -0
- data/include/reflex/reflex.h +2 -6
- data/include/reflex/ruby/application.h +40 -13
- data/include/reflex/ruby/event.h +72 -0
- data/include/reflex/ruby/image_view.h +25 -0
- data/include/reflex/ruby/selector.h +27 -0
- data/include/reflex/ruby/style.h +27 -0
- data/include/reflex/ruby/style_length.h +37 -0
- data/include/reflex/ruby/view.h +193 -38
- data/include/reflex/ruby/window.h +123 -39
- data/include/reflex/ruby.h +3 -2
- data/include/reflex/selector.h +64 -0
- data/include/reflex/style.h +144 -0
- data/include/reflex/style_length.h +147 -0
- data/include/reflex/view.h +182 -19
- data/include/reflex/window.h +35 -19
- data/include/reflex.h +7 -0
- data/lib/reflex/application.rb +14 -5
- data/lib/reflex/arc_shape.rb +20 -0
- data/lib/reflex/button.rb +75 -0
- data/lib/reflex/capture_event.rb +37 -0
- data/lib/reflex/color.rb +13 -0
- data/lib/reflex/color_space.rb +13 -0
- data/lib/reflex/draw_event.rb +19 -0
- data/lib/reflex/ellipse_shape.rb +20 -0
- data/lib/reflex/ext.rb +1 -1
- data/lib/reflex/flags.rb +18 -0
- data/lib/reflex/focus_event.rb +38 -0
- data/lib/reflex/font.rb +13 -0
- data/lib/reflex/frame_event.rb +42 -0
- data/lib/reflex/helper.rb +87 -30
- data/lib/reflex/image_view.rb +25 -0
- data/lib/reflex/key_event.rb +38 -0
- data/lib/reflex/line_shape.rb +20 -0
- data/lib/reflex/list_view.rb +15 -0
- data/lib/reflex/model.rb +149 -0
- data/lib/reflex/model_owner.rb +57 -0
- data/lib/reflex/model_view.rb +22 -0
- data/lib/reflex/module.rb +11 -7
- data/lib/reflex/pointer_event.rb +85 -0
- data/lib/reflex/rect_shape.rb +20 -0
- data/lib/reflex/reflex.rb +13 -2
- data/lib/reflex/scroll_event.rb +19 -0
- data/lib/reflex/selector.rb +31 -0
- data/lib/reflex/shader.rb +13 -0
- data/lib/reflex/shape.rb +34 -0
- data/lib/reflex/style.rb +55 -0
- data/lib/reflex/style_length.rb +30 -0
- data/lib/reflex/style_length2.rb +34 -0
- data/lib/reflex/style_length4.rb +38 -0
- data/lib/reflex/text_view.rb +55 -0
- data/lib/reflex/update_event.rb +19 -0
- data/lib/reflex/view.rb +38 -4
- data/lib/reflex/wheel_event.rb +19 -0
- data/lib/reflex/window.rb +7 -5
- data/lib/reflex.rb +38 -1
- data/lib/reflexion/include.rb +5 -0
- data/lib/reflexion.rb +100 -0
- data/reflex.gemspec +3 -4
- data/samples/app.rb +13 -0
- data/samples/bats.rb +91 -0
- data/samples/checker.rb +36 -0
- data/{examples/ruby/shapes.rb → samples/fans.rb} +12 -16
- data/samples/fps.rb +46 -0
- data/samples/grid.rb +60 -0
- data/{examples/ruby → samples}/hello.rb +14 -16
- data/samples/image.rb +44 -0
- data/samples/ios/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/samples/ios/hello/hello/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/samples/ios/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/ios/hello/hello/hello-Info.plist +47 -0
- data/samples/ios/hello/hello/hello-Prefix.pch +10 -0
- data/samples/ios/hello/hello/main.cpp +79 -0
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/{examples/ruby → samples}/key.rb +11 -14
- data/samples/layout.rb +89 -0
- data/samples/model.rb +86 -0
- data/samples/osx/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/samples/osx/hello/hello/en.lproj/Credits.rtf +29 -0
- data/samples/osx/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/osx/hello/hello/hello-Info.plist +32 -0
- data/samples/osx/hello/hello/hello-Prefix.pch +3 -0
- data/samples/osx/hello/hello/main.cpp +79 -0
- data/samples/osx/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/samples/reflexion/hello.rb +24 -0
- data/samples/reflexion/paint.rb +40 -0
- data/samples/reflexion/pulse.rb +34 -0
- data/samples/repl.rb +69 -0
- data/samples/shader.rb +41 -0
- data/samples/shapes.rb +30 -0
- data/{examples/ruby → samples}/text.rb +7 -8
- data/samples/tree.rb +71 -0
- data/samples/views.rb +41 -0
- data/samples/visuals.rb +22 -0
- data/src/event.cpp +225 -0
- data/src/exception.cpp +24 -15
- data/src/image_view.cpp +70 -0
- data/src/ios/app_delegate.h +17 -0
- data/src/ios/app_delegate.mm +120 -0
- data/src/ios/application.mm +116 -0
- data/src/{cocoa/applicationdata.h → ios/application_data.h} +6 -6
- data/src/ios/event.h +26 -0
- data/src/ios/event.mm +31 -0
- data/src/ios/native_window.h +37 -0
- data/src/ios/native_window.mm +220 -0
- data/src/ios/opengl_view.h +13 -0
- data/src/ios/opengl_view.mm +131 -0
- data/src/{cocoa → ios}/reflex.mm +8 -12
- data/src/ios/window.mm +303 -0
- data/src/ios/window_data.h +75 -0
- data/src/osx/app_delegate.h +17 -0
- data/src/{cocoa/cocoaapplication.mm → osx/app_delegate.mm} +90 -48
- data/src/osx/application.mm +132 -0
- data/src/osx/application_data.h +45 -0
- data/src/osx/event.h +42 -0
- data/src/osx/event.mm +112 -0
- data/src/osx/native_window.h +26 -0
- data/src/osx/native_window.mm +322 -0
- data/src/{cocoa/openglview.h → osx/opengl_view.h} +0 -4
- data/src/{cocoa/openglview.mm → osx/opengl_view.mm} +66 -23
- data/src/osx/reflex.mm +50 -0
- data/src/osx/window.mm +308 -0
- data/src/osx/window_data.h +75 -0
- data/src/selector.cpp +121 -0
- data/src/style.cpp +576 -0
- data/src/style_length.cpp +341 -0
- data/src/view.cpp +1228 -129
- data/src/win32/application.cpp +1 -1
- data/src/window.cpp +54 -26
- data/test/helper.rb +8 -4
- data/test/test_capture_event.rb +41 -0
- data/test/test_event.rb +20 -0
- data/test/test_has_frame.rb +45 -0
- data/test/test_model.rb +9 -0
- data/test/test_model_owner.rb +9 -0
- data/test/test_selector.rb +75 -0
- data/test/test_style.rb +70 -0
- data/test/test_style_length.rb +38 -0
- data/test/test_style_length2.rb +50 -0
- data/test/test_style_length4.rb +56 -0
- data/test/test_view.rb +97 -23
- data/test/test_window.rb +54 -46
- metadata +205 -84
- data/.doc/ext/reflex/defs.cpp +0 -8
- data/.doc/ext/reflex/key.cpp +0 -122
- data/.doc/ext/reflex/points.cpp +0 -151
- data/.gitignore +0 -14
- data/ChangeLog +0 -8
- data/examples/hello/.gitignore +0 -2
- data/examples/hello/Rakefile +0 -41
- data/examples/hello/main.cpp +0 -18
- data/examples/ruby/app.rb +0 -13
- data/examples/ruby/checker.rb +0 -41
- data/examples/ruby/fps.rb +0 -49
- data/examples/ruby/grid.rb +0 -65
- data/examples/ruby/views.rb +0 -88
- data/examples/ruby/visuals.rb +0 -27
- data/ext/reflex/defs.cpp +0 -8
- data/ext/reflex/key.cpp +0 -129
- data/ext/reflex/points.cpp +0 -161
- data/include/reflex/ruby/key.h +0 -39
- data/include/reflex/ruby/points.h +0 -39
- data/lib/reflex/visuals/string.rb +0 -53
- data/src/cocoa/application.mm +0 -101
- data/src/cocoa/cocoaapplication.h +0 -21
- data/src/cocoa/cocoawindow.h +0 -46
- data/src/cocoa/cocoawindow.mm +0 -230
- data/src/cocoa/defs.h +0 -34
- data/src/cocoa/defs.mm +0 -87
- data/src/cocoa/window.mm +0 -148
- data/src/cocoa/windowdata.h +0 -56
- data/src/defs.cpp +0 -47
- data/src/helper.h +0 -12
- data/src/reflex.cpp +0 -43
- /data/{README → README.md} +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
%w[xot rays reflex]
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
end
|
|
4
|
+
%w[xot rays reflex]
|
|
5
|
+
.map {|s| File.expand_path "../../../#{s}/lib", __FILE__}
|
|
6
|
+
.each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}
|
|
8
7
|
|
|
9
|
-
require 'rubygems'
|
|
10
8
|
require 'reflex'
|
|
11
9
|
|
|
12
10
|
|
|
@@ -15,28 +13,27 @@ class HelloWindow < Reflex::Window
|
|
|
15
13
|
def initialize ()
|
|
16
14
|
super
|
|
17
15
|
set :title, "Hello Reflex!"
|
|
18
|
-
set :
|
|
16
|
+
set :frame, 100, 100, 320, 240
|
|
19
17
|
p = painter
|
|
20
18
|
p.font Rays::Font.new "Menlo", 32
|
|
21
19
|
p.background 0
|
|
22
20
|
p.fill 1
|
|
23
21
|
end
|
|
24
22
|
|
|
25
|
-
def
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
end
|
|
23
|
+
def on_draw (e)
|
|
24
|
+
p = e.painter
|
|
25
|
+
draw_grid p
|
|
26
|
+
p.text "hello world!", 5, 5
|
|
30
27
|
end
|
|
31
28
|
|
|
32
|
-
def
|
|
29
|
+
def on_update_ (e)
|
|
33
30
|
painter.background = rand, rand, rand
|
|
34
31
|
redraw
|
|
35
32
|
end
|
|
36
33
|
|
|
37
34
|
def draw_grid (p)
|
|
38
|
-
p.push do
|
|
39
|
-
w, h =
|
|
35
|
+
p.push do |_|
|
|
36
|
+
w, h = frame.size.to_a
|
|
40
37
|
p.stroke 0.5, 0.4
|
|
41
38
|
(0..w).step(5).each {|x| p.line x, 0, x, h}
|
|
42
39
|
(0..h).step(5).each {|y| p.line 0, y, w, y}
|
|
@@ -46,5 +43,6 @@ class HelloWindow < Reflex::Window
|
|
|
46
43
|
end# HelloWindow
|
|
47
44
|
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
Reflex.start do
|
|
47
|
+
HelloWindow.new.show
|
|
48
|
+
end
|
data/samples/image.rb
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
%w[xot rays reflex]
|
|
5
|
+
.map {|s| File.expand_path "../../../#{s}/lib", __FILE__}
|
|
6
|
+
.each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}
|
|
7
|
+
|
|
8
|
+
require 'reflex'
|
|
9
|
+
|
|
10
|
+
include Reflex
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
win = Window.new do
|
|
14
|
+
image = Image.new(32, 32).tap do |img|
|
|
15
|
+
img.paint do
|
|
16
|
+
color :white
|
|
17
|
+
rect img.bounds
|
|
18
|
+
color :red
|
|
19
|
+
ellipse img.bounds.inset_by(2, 2)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
256.times do
|
|
24
|
+
add ImageView.new {set data: image}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
on :update do
|
|
28
|
+
redraw
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
after :draw do |e|
|
|
32
|
+
e.painter.color :blank do
|
|
33
|
+
rect 0, 0, 100, 40
|
|
34
|
+
fill :white
|
|
35
|
+
text "#{e.fps.to_i} FPS", 10, 10
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
set title: 'Many Image Views', frame: [100, 100, 500, 400]
|
|
40
|
+
show
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
Reflex.start
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"images" : [
|
|
3
|
+
{
|
|
4
|
+
"idiom" : "iphone",
|
|
5
|
+
"size" : "29x29",
|
|
6
|
+
"scale" : "2x"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"idiom" : "iphone",
|
|
10
|
+
"size" : "40x40",
|
|
11
|
+
"scale" : "2x"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"idiom" : "iphone",
|
|
15
|
+
"size" : "60x60",
|
|
16
|
+
"scale" : "2x"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"idiom" : "ipad",
|
|
20
|
+
"size" : "29x29",
|
|
21
|
+
"scale" : "1x"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"idiom" : "ipad",
|
|
25
|
+
"size" : "29x29",
|
|
26
|
+
"scale" : "2x"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"idiom" : "ipad",
|
|
30
|
+
"size" : "40x40",
|
|
31
|
+
"scale" : "1x"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"idiom" : "ipad",
|
|
35
|
+
"size" : "40x40",
|
|
36
|
+
"scale" : "2x"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"idiom" : "ipad",
|
|
40
|
+
"size" : "76x76",
|
|
41
|
+
"scale" : "1x"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"idiom" : "ipad",
|
|
45
|
+
"size" : "76x76",
|
|
46
|
+
"scale" : "2x"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"info" : {
|
|
50
|
+
"version" : 1,
|
|
51
|
+
"author" : "xcode"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"images" : [
|
|
3
|
+
{
|
|
4
|
+
"orientation" : "portrait",
|
|
5
|
+
"idiom" : "iphone",
|
|
6
|
+
"extent" : "full-screen",
|
|
7
|
+
"minimum-system-version" : "7.0",
|
|
8
|
+
"scale" : "2x"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"orientation" : "portrait",
|
|
12
|
+
"idiom" : "iphone",
|
|
13
|
+
"subtype" : "retina4",
|
|
14
|
+
"extent" : "full-screen",
|
|
15
|
+
"minimum-system-version" : "7.0",
|
|
16
|
+
"scale" : "2x"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"orientation" : "portrait",
|
|
20
|
+
"idiom" : "ipad",
|
|
21
|
+
"extent" : "full-screen",
|
|
22
|
+
"minimum-system-version" : "7.0",
|
|
23
|
+
"scale" : "1x"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"orientation" : "landscape",
|
|
27
|
+
"idiom" : "ipad",
|
|
28
|
+
"extent" : "full-screen",
|
|
29
|
+
"minimum-system-version" : "7.0",
|
|
30
|
+
"scale" : "1x"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"orientation" : "portrait",
|
|
34
|
+
"idiom" : "ipad",
|
|
35
|
+
"extent" : "full-screen",
|
|
36
|
+
"minimum-system-version" : "7.0",
|
|
37
|
+
"scale" : "2x"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"orientation" : "landscape",
|
|
41
|
+
"idiom" : "ipad",
|
|
42
|
+
"extent" : "full-screen",
|
|
43
|
+
"minimum-system-version" : "7.0",
|
|
44
|
+
"scale" : "2x"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"info" : {
|
|
48
|
+
"version" : 1,
|
|
49
|
+
"author" : "xcode"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>en</string>
|
|
7
|
+
<key>CFBundleDisplayName</key>
|
|
8
|
+
<string>${PRODUCT_NAME}</string>
|
|
9
|
+
<key>CFBundleExecutable</key>
|
|
10
|
+
<string>${EXECUTABLE_NAME}</string>
|
|
11
|
+
<key>CFBundleIdentifier</key>
|
|
12
|
+
<string>org.xord.${PRODUCT_NAME:rfc1034identifier}</string>
|
|
13
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
14
|
+
<string>6.0</string>
|
|
15
|
+
<key>CFBundleName</key>
|
|
16
|
+
<string>${PRODUCT_NAME}</string>
|
|
17
|
+
<key>CFBundlePackageType</key>
|
|
18
|
+
<string>APPL</string>
|
|
19
|
+
<key>CFBundleShortVersionString</key>
|
|
20
|
+
<string>1.0</string>
|
|
21
|
+
<key>CFBundleSignature</key>
|
|
22
|
+
<string>????</string>
|
|
23
|
+
<key>CFBundleVersion</key>
|
|
24
|
+
<string>1.0</string>
|
|
25
|
+
<key>LSRequiresIPhoneOS</key>
|
|
26
|
+
<true/>
|
|
27
|
+
<key>UIRequiredDeviceCapabilities</key>
|
|
28
|
+
<array>
|
|
29
|
+
<string>armv7</string>
|
|
30
|
+
</array>
|
|
31
|
+
<key>UIStatusBarHidden</key>
|
|
32
|
+
<true/>
|
|
33
|
+
<key>UISupportedInterfaceOrientations</key>
|
|
34
|
+
<array>
|
|
35
|
+
<string>UIInterfaceOrientationPortrait</string>
|
|
36
|
+
<string>UIInterfaceOrientationLandscapeLeft</string>
|
|
37
|
+
<string>UIInterfaceOrientationLandscapeRight</string>
|
|
38
|
+
</array>
|
|
39
|
+
<key>UISupportedInterfaceOrientations~ipad</key>
|
|
40
|
+
<array>
|
|
41
|
+
<string>UIInterfaceOrientationPortrait</string>
|
|
42
|
+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
|
43
|
+
<string>UIInterfaceOrientationLandscapeLeft</string>
|
|
44
|
+
<string>UIInterfaceOrientationLandscapeRight</string>
|
|
45
|
+
</array>
|
|
46
|
+
</dict>
|
|
47
|
+
</plist>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#include <xot.h>
|
|
2
|
+
#include <rays.h>
|
|
3
|
+
#include <reflex.h>
|
|
4
|
+
|
|
5
|
+
using namespace Xot;
|
|
6
|
+
using namespace Rays;
|
|
7
|
+
using namespace Reflex;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Win : public Window
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
typedef Window Super;
|
|
14
|
+
|
|
15
|
+
public:
|
|
16
|
+
|
|
17
|
+
void on_update (UpdateEvent* e)
|
|
18
|
+
{
|
|
19
|
+
redraw();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
void on_draw (DrawEvent* e)
|
|
23
|
+
{
|
|
24
|
+
Super::on_draw(e);
|
|
25
|
+
e->painter->text(stringf("%f", e->fps), 10, 10);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
};// Window
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class App : public Application
|
|
32
|
+
{
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
|
|
36
|
+
void on_start (Event* e)
|
|
37
|
+
{
|
|
38
|
+
Window* win = new Win();
|
|
39
|
+
win->set_title(app()->name());
|
|
40
|
+
win->set_frame(100, 100, 500, 500);
|
|
41
|
+
win->show();
|
|
42
|
+
|
|
43
|
+
Image image(32, 32);
|
|
44
|
+
Painter painter = image.painter();
|
|
45
|
+
painter.begin();
|
|
46
|
+
painter.no_stroke();
|
|
47
|
+
painter.set_fill(1, 1, 1);
|
|
48
|
+
painter.rect(0, 0, image.width(), image.height());
|
|
49
|
+
painter.set_fill(1, 0, 0);
|
|
50
|
+
painter.ellipse(0, 0, image.width(), image.height());
|
|
51
|
+
painter.end();
|
|
52
|
+
|
|
53
|
+
for (int i = 0; i < 2000; ++i)
|
|
54
|
+
{
|
|
55
|
+
ImageView* view = new ImageView();
|
|
56
|
+
view->set_image(image);
|
|
57
|
+
view->set_frame(0, 0, image.width(), image.height());
|
|
58
|
+
|
|
59
|
+
win->root()->add_child(view);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
};// App
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
int main(int argc, const char** argv)
|
|
67
|
+
{
|
|
68
|
+
Rays::init();
|
|
69
|
+
Reflex::init();
|
|
70
|
+
|
|
71
|
+
Application* app = new App();
|
|
72
|
+
app->set_name("Hello Xcode!");
|
|
73
|
+
app->start();
|
|
74
|
+
|
|
75
|
+
Reflex::fin();
|
|
76
|
+
Rays::fin();
|
|
77
|
+
|
|
78
|
+
return 0;
|
|
79
|
+
}
|