@@ -18,18 +18,19 @@ CSFML2 : http://www.sfml-dev.org/download/csfml/
18
18
19
19
Then clone the repo and build the library with the following command.
20
20
21
+ Rust-sfml is now build with the rustpkg tool :
22
+
21
23
``` Shell
22
- > rustc rsfml.rc
23
- >
24
+ > rustpkg build rsfml
24
25
```
25
- Finally build your program with the rust-sfml library. For exemple, if the library is in the same path than your program.
26
+
27
+ Examples are build too with rustpkg :
26
28
27
29
``` Shell
28
- > rustc main.rs -L .
29
- >
30
+ > rustpkg build examples/pong
30
31
```
31
32
32
- Normaly rust -sfml works on Linux and windows and OSX.
33
+ Rust -sfml works on Linux, windows and OSX.
33
34
34
35
OSX Specific
35
36
============
@@ -50,16 +51,31 @@ Short example
50
51
Here is a short example, draw a circle shape and display it.
51
52
52
53
``` Rust
54
+ extern mod rsfml ;
55
+
56
+ use rsfml :: system :: vector2 :: Vector2f ;
57
+ use rsfml :: window :: context_settings :: ContextSettings ;
58
+ use rsfml :: window :: video_mode :: VideoMode ;
59
+ use rsfml :: window :: event;
60
+ use rsfml :: graphics :: render_window :: * ;
61
+ use rsfml :: graphics :: circle_shape :: CircleShape ;
62
+ use rsfml :: graphics :: color :: Color ;
63
+
64
+ #[start]
65
+ fn start (argc : int , argv : * * u8 , crate_map : * u8 ) -> int {
66
+ std :: rt :: start_on_main_thread (argc , argv , crate_map , main )
67
+ }
68
+
53
69
fn main () -> () {
54
70
// Create the window of the application
55
71
let setting = ContextSettings {
56
72
depthBits: 10 ,
57
- stencilBits: 10 ,
58
- antialiasingLevel: 1 ,
59
- majorVersion: 0 ,
73
+ stencilBits: 10 ,
74
+ antialiasingLevel: 1 ,
75
+ majorVersion: 0 ,
60
76
minorVersion: 1
61
77
};
62
- let mut window = match RenderWindow :: new (VideoMode :: new_init (800 , 600 , 32 ), ~" SFML Pong " , sfClose, & setting ) {
78
+ let mut window = match RenderWindow :: new (VideoMode :: new_init (800 , 600 , 32 ), ~" SFML Example " , sfClose, & setting ) {
63
79
Some (window ) => window ,
64
80
None => fail! (" Cannot create a new Render Window." )
65
81
};
@@ -82,11 +98,11 @@ fn main () -> () {
82
98
_ => {}
83
99
}
84
100
}
85
-
101
+
86
102
// Clear the window
87
103
window . clear (~Color :: new_from_RGB (0 , 200 , 200 ));
88
104
// Draw the shape
89
- window . draw (& circle );
105
+ window . draw (& circle );
90
106
// Display things on screen
91
107
window . display ()
92
108
}
0 commit comments