Permalink
Browse files

s/import/use/g; fix class method syntax

  • Loading branch information...
1 parent 3680392 commit 01eb6757c6085195017a1a47769c1e08b681f6a2 Brian J. Burg committed Sep 11, 2012
Showing with 56 additions and 50 deletions.
  1. +8 −4 layers.rs
  2. +22 −22 rendergl.rs
  3. +2 −2 scene.rs
  4. +23 −21 test.rs
  5. +1 −1 util.rs
View
@@ -1,8 +1,8 @@
-import geom::matrix::{Matrix4, identity};
-import opengles::gl2::{GLuint, delete_textures};
+use geom::matrix::{Matrix4, identity};
+use opengles::gl2::{GLuint, delete_textures};
-import std::cmp::FuzzyEq;
-import dvec::DVec;
+use std::cmp::FuzzyEq;
+use dvec::DVec;
enum Format {
ARGB32Format,
@@ -21,7 +21,9 @@ struct CommonLayer {
mut next_sibling: Option<Layer>,
mut transform: Matrix4<f32>,
+}
+impl CommonLayer {
// FIXME: Workaround for cross-crate bug regarding mutability of class fields
fn set_transform(new_transform: Matrix4<f32>) {
self.transform = new_transform;
@@ -88,7 +90,9 @@ fn Image(width: uint, height: uint, format: Format, +data: ~[u8]) -> Image {
struct ImageLayer {
mut common: CommonLayer,
mut image: @layers::Image,
+}
+impl ImageLayer {
// FIXME: Workaround for cross-crate bug
fn set_image(new_image: @layers::Image) {
self.image = new_image;
View
@@ -1,27 +1,27 @@
-import layers::{ARGB32Format, ContainerLayerKind, Image, ImageLayerKind, RGB24Format};
-import layers::{TiledImageLayerKind};
-import scene::Scene;
+use layers::{ARGB32Format, ContainerLayerKind, Image, ImageLayerKind, RGB24Format};
+use layers::{TiledImageLayerKind};
+use scene::Scene;
-import geom::matrix::{Matrix4, ortho};
-import opengles::gl2::{ARRAY_BUFFER, COLOR_BUFFER_BIT, COMPILE_STATUS};
-import opengles::gl2::{FRAGMENT_SHADER, LINEAR, LINK_STATUS, NEAREST, NO_ERROR, REPEAT, RGB, RGBA,
+use geom::matrix::{Matrix4, ortho};
+use opengles::gl2::{ARRAY_BUFFER, COLOR_BUFFER_BIT, COMPILE_STATUS};
+use opengles::gl2::{FRAGMENT_SHADER, LINEAR, LINK_STATUS, NEAREST, NO_ERROR, REPEAT, RGB, RGBA,
BGRA};
-import opengles::gl2::{STATIC_DRAW, TEXTURE_2D, TEXTURE_MAG_FILTER, TEXTURE_MIN_FILTER};
-import opengles::gl2::{TEXTURE_WRAP_S, TEXTURE_WRAP_T};
-import opengles::gl2::{TRIANGLE_STRIP, UNPACK_ALIGNMENT, UNSIGNED_BYTE, VERTEX_SHADER, GLclampf};
-import opengles::gl2::{GLenum, GLint, GLsizei, GLuint, attach_shader, bind_buffer, bind_texture};
-import opengles::gl2::{buffer_data, create_program, clear, clear_color};
-import opengles::gl2::{compile_shader, create_shader, draw_arrays, enable};
-import opengles::gl2::{enable_vertex_attrib_array, gen_buffers, gen_textures};
-import opengles::gl2::{get_attrib_location, get_error, get_program_iv};
-import opengles::gl2::{get_shader_info_log, get_shader_iv};
-import opengles::gl2::{get_uniform_location, link_program, pixel_store_i, shader_source};
-import opengles::gl2::{tex_image_2d, tex_parameter_i, uniform_1i, uniform_matrix_4fv, use_program};
-import opengles::gl2::{vertex_attrib_pointer_f32, viewport};
-
-import io::println;
-import libc::c_int;
-import str::to_bytes;
+use opengles::gl2::{STATIC_DRAW, TEXTURE_2D, TEXTURE_MAG_FILTER, TEXTURE_MIN_FILTER};
+use opengles::gl2::{TEXTURE_WRAP_S, TEXTURE_WRAP_T};
+use opengles::gl2::{TRIANGLE_STRIP, UNPACK_ALIGNMENT, UNSIGNED_BYTE, VERTEX_SHADER, GLclampf};
+use opengles::gl2::{GLenum, GLint, GLsizei, GLuint, attach_shader, bind_buffer, bind_texture};
+use opengles::gl2::{buffer_data, create_program, clear, clear_color};
+use opengles::gl2::{compile_shader, create_shader, draw_arrays, enable};
+use opengles::gl2::{enable_vertex_attrib_array, gen_buffers, gen_textures};
+use opengles::gl2::{get_attrib_location, get_error, get_program_iv};
+use opengles::gl2::{get_shader_info_log, get_shader_iv};
+use opengles::gl2::{get_uniform_location, link_program, pixel_store_i, shader_source};
+use opengles::gl2::{tex_image_2d, tex_parameter_i, uniform_1i, uniform_matrix_4fv, use_program};
+use opengles::gl2::{vertex_attrib_pointer_f32, viewport};
+
+use io::println;
+use libc::c_int;
+use str::to_bytes;
fn FRAGMENT_SHADER_SOURCE() -> ~str {
~"
View
@@ -1,5 +1,5 @@
-import layers::Layer;
-import geom::size::Size2D;
+use layers::Layer;
+use geom::size::Size2D;
struct Scene {
mut root: Layer,
View
44 test.rs
@@ -2,27 +2,27 @@ use glut;
use azure;
use geom;
-import geom::point::Point2D;
-import geom::rect::Rect;
-import geom::size::Size2D;
-import geom::matrix::Matrix4;
-import layers::*;
-import scene::*;
-import rendergl::*;
-import util::convert_rgb32_to_rgb24;
-
-import glut::{DOUBLE, check_loop, create_window, destroy_window, display_func, init};
-import glut::{init_display_mode, post_redisplay, swap_buffers, timer_func};
-
-import azure::cairo::CAIRO_FORMAT_RGB24;
-import CairoContext = azure::cairo_hl::Context;
-import azure::azure_hl::{Color, ColorPattern, DrawTarget};
-import azure::cairo_hl::ImageSurface;
-
-import comm::{peek, recv, send, Port, Chan};
-import libc::c_uint;
-import os::{getenv, setenv};
-import task::TaskBuilder;
+use geom::point::Point2D;
+use geom::rect::Rect;
+use geom::size::Size2D;
+use geom::matrix::Matrix4;
+use layers::*;
+use scene::*;
+use rendergl::*;
+use util::convert_rgb32_to_rgb24;
+
+use glut::{DOUBLE, check_loop, create_window, destroy_window, display_func, init};
+use glut::{init_display_mode, post_redisplay, swap_buffers, timer_func};
+
+use azure::cairo::CAIRO_FORMAT_RGB24;
+use CairoContext = azure::cairo_hl::Context;
+use azure::azure_hl::{Color, ColorPattern, DrawTarget};
+use azure::cairo_hl::ImageSurface;
+
+use comm::{peek, recv, send, Port, Chan};
+use libc::c_uint;
+use os::{getenv, setenv};
+use task::TaskBuilder;
struct Renderer {
mut layer: @TiledImageLayer,
@@ -31,7 +31,9 @@ struct Renderer {
mut delta: f32,
mut render_context: Option<RenderContext>,
mut image: Option<@Image>,
+}
+impl Renderer {
fn get_display_callback(this: @Renderer) -> fn@() {
fn@() {
(*this).display_callback();
View
@@ -1,6 +1,6 @@
// Miscellaneous utilities.
-import vec::from_fn;
+use vec::from_fn;
fn convert_rgb32_to_rgb24(buffer: ~[u8]) -> ~[u8] {
let mut i = 0;

0 comments on commit 01eb675

Please sign in to comment.