From 631c1226691505624c08995b6a2ac81e46a9b17e Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Sun, 5 Sep 2021 21:30:31 -0400 Subject: In response to issue #9629, correct usingnamespace usage --- src/constants.zig | 31 ++++++++++++++++ src/level.zig | 68 ++++++++++++++++++++++++++++++++++ src/main.zig | 62 +++++++++++++++---------------- src/map.zig | 71 ------------------------------------ src/raycast.zig | 31 ++++++++-------- src/renderConstants.zig | 29 --------------- src/sfml/audio/Sound.zig | 4 +- src/sfml/graphics/CircleShape.zig | 4 +- src/sfml/graphics/Image.zig | 4 +- src/sfml/graphics/RectangleShape.zig | 6 +-- src/sfml/graphics/RenderWindow.zig | 4 +- src/sfml/graphics/Sprite.zig | 4 +- src/sfml/graphics/Text.zig | 4 +- src/sfml/graphics/View.zig | 4 +- src/sfml/graphics/rect.zig | 2 +- src/sfml/graphics/texture.zig | 4 +- src/sfml/system/Clock.zig | 4 +- src/sfml/window/event.zig | 2 +- 18 files changed, 168 insertions(+), 170 deletions(-) create mode 100644 src/constants.zig create mode 100644 src/level.zig delete mode 100644 src/map.zig delete mode 100644 src/renderConstants.zig (limited to 'src') diff --git a/src/constants.zig b/src/constants.zig new file mode 100644 index 0000000..5c89b94 --- /dev/null +++ b/src/constants.zig @@ -0,0 +1,31 @@ +// This file is part of ZiRC +// +// Copyright (C) 2021, tslil clingman +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +pub const ScreenWidth: f32 = 1024; +pub const ScreenHeight: f32 = 768; + +pub const PlaneWidth = 320; +pub const PlaneHeight = 240; + +pub const HFact = ScreenWidth / PlaneWidth; +pub const VFact = ScreenHeight / PlaneHeight; + +pub const BackTextureWidth: f32 = 1280; +pub const BackTextureHeight: f32 = 240; + +pub const TextureDim: f32 = 32.0; + +pub const MAX_HEIGHT: f32 = 1; diff --git a/src/level.zig b/src/level.zig new file mode 100644 index 0000000..5a63ebb --- /dev/null +++ b/src/level.zig @@ -0,0 +1,68 @@ +// This file is part of ZiRC +// +// Copyright (C) 2021, tslil clingman +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +const std = @import("std"); + +pub const Object = struct { + height : f32, + width : f32, + texture : u8, + pos_x : f32, + pos_y : f32, +}; + +pub const Cell = struct { + height: f32, + wall_texture: u8 = 0, + floor_texture: u8 = 0, + ceiling_texture: u8 = 0, + + const floor = Cell{ .height = 0 }; +}; + +pub const Map = struct { + width: u32, + height: u32, + size: f32 = 64, + cells: std.ArrayList(Cell), + objects: std.ArrayList(Object), + + pub fn deinit(self: Map) void { + self.cells.deinit(); + self.objects.deinit(); + } + + pub fn new(width: u32, height: u32, alloc: *std.mem.Allocator) !Map { + var cells = std.ArrayList(Cell).init(alloc); + try cells.ensureTotalCapacity(width * height); + try cells.appendNTimes(Cell.floor, width * height); + + var objects = std.ArrayList(Object).init(alloc); + + return Map{ .width = width, .height = height, .cells = cells, .objects = objects }; + } + + pub fn inBounds(self: Map, x: i32, y: i32) bool { + return (x < self.width and x >= 0 and y < self.height and y >= 0); + } + + pub fn lookup(self: Map, x: i32, y: i32) Cell { + // live dangerously, no bounds check + std.debug.assert(x >= 0 and y >= 0); // compiler hint? + return self.cells.items[@intCast(u32, y) * self.width + @intCast(u32, x)]; + } +}; diff --git a/src/main.zig b/src/main.zig index cf3839d..2def0e8 100644 --- a/src/main.zig +++ b/src/main.zig @@ -16,17 +16,17 @@ // along with this program. If not, see . const sf = struct { - pub usingnamespace @import("sfml"); - pub usingnamespace graphics; - pub usingnamespace window; + usingnamespace @import("sfml"); + usingnamespace sf.graphics; + usingnamespace sf.window; }; const isKeyPressed = sf.window.keyboard.isKeyPressed; const std = @import("std"); -usingnamespace @import("raycast.zig"); -usingnamespace @import("renderConstants.zig"); -usingnamespace @import("map.zig"); +const constants = @import("constants.zig"); +const raycast = @import("raycast.zig"); +const level = @import("level.zig"); // TODO: is there anyway i can say fn renderSlice : RenderSliceFunction? fn renderSlice( @@ -41,17 +41,17 @@ fn renderSlice( ) void { // we need ceil here so that we draw always to or past the edge of the screen - const draw_height = @floatToInt(c_int, std.math.ceil(draw_frac * TextureDim)); - const total_length = total_height * VFact; + const draw_height = @floatToInt(c_int, std.math.ceil(draw_frac * constants.TextureDim)); + const total_length = total_height * constants.VFact; - const xpos = @intToFloat(f32, col) * HFact; - const ypos = ScreenHeight / 2 + (PlaneHeight / 2 - top) * VFact; + const xpos = @intToFloat(f32, col) * constants.HFact; + const ypos = constants.ScreenHeight / 2 + (constants.PlaneHeight / 2 - top) * constants.VFact; - const tind = @as(c_int, texture) * @floatToInt(c_int, TextureDim); - const left = tind + @floatToInt(c_int, texfrac * TextureDim); + const tind = @as(c_int, texture) * @floatToInt(c_int, constants.TextureDim); + const left = tind + @floatToInt(c_int, texfrac * constants.TextureDim); sprite.setPosition(.{ .x = xpos, .y = ypos }); - sprite.setScale(.{ .x = HFact, .y = total_length / TextureDim }); + sprite.setScale(.{ .x = constants.HFact, .y = total_length / constants.TextureDim }); sprite.setTextureRect(.{ .top = 0, .left = left, .width = 1, .height = draw_height }); window.draw(sprite, null); } @@ -62,7 +62,7 @@ pub fn main() !void { // Setup player and map //-------------------------------------------------------------------------- - var player = try Player(PlaneWidth, PlaneHeight).new( + var player = try raycast.Player(constants.PlaneWidth, constants.PlaneHeight).new( 7, // x coord 1.5, // y coord PI / 2.0, // angle @@ -71,27 +71,27 @@ pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); - var map = try Map.new(16, 16, &gpa.allocator); + var map = try level.Map.new(16, 16, &gpa.allocator); defer map.deinit(); var y: u32 = 0; while (y < 16) : (y += 1) { - map.cells.items[y * 16 + 00] = Cell{ .height = MAX_HEIGHT }; - map.cells.items[y * 16 + 15] = Cell{ .height = MAX_HEIGHT, .wall_texture = 2 }; - map.cells.items[15 * 16 + y] = Cell{ .height = MAX_HEIGHT }; - map.cells.items[00 * 16 + y] = Cell{ .height = MAX_HEIGHT }; + map.cells.items[y * 16 + 00] = level.Cell{ .height = constants.MAX_HEIGHT }; + map.cells.items[y * 16 + 15] = level.Cell{ .height = constants.MAX_HEIGHT, .wall_texture = 2 }; + map.cells.items[15 * 16 + y] = level.Cell{ .height = constants.MAX_HEIGHT }; + map.cells.items[00 * 16 + y] = level.Cell{ .height = constants.MAX_HEIGHT }; } - map.cells.items[16 * 7 + 7] = Cell{ .height = MAX_HEIGHT, .wall_texture = 1 }; - map.cells.items[16 * 7 + 6] = Cell{ .height = MAX_HEIGHT / 3, .wall_texture = 1, .floor_texture = 1 }; + map.cells.items[16 * 7 + 7] = level.Cell{ .height = constants.MAX_HEIGHT, .wall_texture = 1 }; + map.cells.items[16 * 7 + 6] = level.Cell{ .height = constants.MAX_HEIGHT / 3, .wall_texture = 1, .floor_texture = 1 }; - try map.objects.append(Object{.pos_x = 6.5, .pos_y = 8.5, .texture = 0, .height = 1, .width = 1}); - try map.objects.append(Object{.pos_x = 4, .pos_y = 8.5, .texture = 1, .height = 1, .width = 1}); + try map.objects.append(level.Object{ .pos_x = 6.5, .pos_y = 8.5, .texture = 0, .height = 1, .width = 1 }); + try map.objects.append(level.Object{ .pos_x = 4, .pos_y = 8.5, .texture = 1, .height = 1, .width = 1 }); // Initialise SFML //-------------------------------------------------------------------------- - var window = try sf.RenderWindow.create(.{ .x = ScreenWidth, .y = ScreenHeight }, 32, "zirc", sf.window.Style.none); + var window = try sf.RenderWindow.create(.{ .x = constants.ScreenWidth, .y = constants.ScreenHeight }, 32, "zirc", sf.window.Style.none); defer window.destroy(); window.setFramerateLimit(60); @@ -110,7 +110,7 @@ pub fn main() !void { var back_sprite = try sf.Sprite.createFromTexture(back_texture); defer back_sprite.destroy(); - back_sprite.setScale(.{ .x = 4.0 * ScreenWidth / BackTextureWidth, .y = ScreenHeight / (2 * BackTextureHeight) }); + back_sprite.setScale(.{ .x = 4.0 * constants.ScreenWidth / constants.BackTextureWidth, .y = constants.ScreenHeight / (2 * constants.BackTextureHeight) }); // Load wall textures var wall_textures = try sf.Texture.createFromFile("walls.png"); @@ -132,15 +132,15 @@ pub fn main() !void { var floors_image = try sf.Image.createFromFile("floors.png"); defer floors_image.destroy(); - var rendered_floors_texture = try sf.Texture.create(.{ .x = PlaneWidth, .y = PlaneHeight / 2 }); + var rendered_floors_texture = try sf.Texture.create(.{ .x = constants.PlaneWidth, .y = constants.PlaneHeight / 2 }); defer rendered_floors_texture.destroy(); rendered_floors_texture.setSmooth(false); var rendered_floors_sprite = try sf.Sprite.createFromTexture(rendered_floors_texture); defer rendered_floors_sprite.destroy(); - rendered_floors_sprite.setPosition(.{ .x = 0, .y = ScreenHeight / 2 }); - rendered_floors_sprite.setScale(.{ .x = HFact, .y = VFact }); + rendered_floors_sprite.setPosition(.{ .x = 0, .y = constants.ScreenHeight / 2 }); + rendered_floors_sprite.setScale(.{ .x = constants.HFact, .y = constants.VFact }); // Start your engines! //-------------------------------------------------------------------------- @@ -182,14 +182,14 @@ pub fn main() !void { window.clear(sf.Color.fromRGB(100, 100, 100)); // First the background - const back_scroll = @floatToInt(i32, -BackTextureWidth * player.ang / (2 * PI)); + const back_scroll = @floatToInt(i32, -constants.BackTextureWidth * player.ang / (2 * PI)); back_sprite.setTextureRect(sf.IntRect{ .left = back_scroll, // fix location of texture in the sky .top = 0, // scaling ensures that the next two dimensions paint it across the // width of the Screen, and for half the height of the screen - .width = BackTextureWidth / 4.0, // 1/4 of texture per screen - .height = BackTextureHeight, // full height of texture visible + .width = constants.BackTextureWidth / 4.0, // 1/4 of texture per screen + .height = constants.BackTextureHeight, // full height of texture visible }); window.draw(back_sprite, null); diff --git a/src/map.zig b/src/map.zig deleted file mode 100644 index b73fd36..0000000 --- a/src/map.zig +++ /dev/null @@ -1,71 +0,0 @@ -// This file is part of ZiRC -// -// Copyright (C) 2021, tslil clingman -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -const std = @import("std"); - -// Let's pretend that our units are meters -pub const MAX_HEIGHT: f32 = 1; - -pub const Object = struct { - height : f32, - width : f32, - texture : u8, - pos_x : f32, - pos_y : f32, -}; - -pub const Cell = struct { - height: f32, - wall_texture: u8 = 0, - floor_texture: u8 = 0, - ceiling_texture: u8 = 0, - - const floor = Cell{ .height = 0 }; -}; - -pub const Map = struct { - width: u32, - height: u32, - size: f32 = 64, - cells: std.ArrayList(Cell), - objects: std.ArrayList(Object), - - pub fn deinit(self: Map) void { - self.cells.deinit(); - self.objects.deinit(); - } - - pub fn new(width: u32, height: u32, alloc: *std.mem.Allocator) !Map { - var cells = std.ArrayList(Cell).init(alloc); - try cells.ensureTotalCapacity(width * height); - try cells.appendNTimes(Cell.floor, width * height); - - var objects = std.ArrayList(Object).init(alloc); - - return Map{ .width = width, .height = height, .cells = cells, .objects = objects }; - } - - pub fn inBounds(self: Map, x: i32, y: i32) bool { - return (x < self.width and x >= 0 and y < self.height and y >= 0); - } - - pub fn lookup(self: Map, x: i32, y: i32) Cell { - // live dangerously, no bounds check - std.debug.assert(x >= 0 and y >= 0); // compiler hint? - return self.cells.items[@intCast(u32, y) * self.width + @intCast(u32, x)]; - } -}; diff --git a/src/raycast.zig b/src/raycast.zig index 41458c7..e1bfce0 100644 --- a/src/raycast.zig +++ b/src/raycast.zig @@ -23,8 +23,8 @@ const Texture = @import("sfml").graphics.Texture; const Image = @import("sfml").graphics.Image; const Colour = @import("sfml").graphics.Color; -usingnamespace @import("map.zig"); -usingnamespace @import("renderConstants.zig"); +const level = @import("level.zig"); +const constants = @import("constants.zig"); pub const RenderSliceFunction: type = fn ( window: RenderWindow, @@ -92,7 +92,7 @@ pub fn Player(PlaneWidth: f32, PlaneHeight: f32) type { walls_sprite: Sprite, objects_sprite: Sprite, renderSlice: RenderSliceFunction, - map: Map, + map: level.Map, ) void { // reset the z_buffer var i: usize = 0; @@ -107,7 +107,7 @@ pub fn Player(PlaneWidth: f32, PlaneHeight: f32) type { self.renderObjects(window, objects_sprite, renderSlice, map); } - fn playerDistComp(pos : [2]f32, lhs: Object, rhs: Object) bool { + fn playerDistComp(pos: [2]f32, lhs: level.Object, rhs: level.Object) bool { const lx = lhs.pos_x - pos[0]; const ly = lhs.pos_y - pos[1]; const rx = rhs.pos_x - pos[0]; @@ -121,13 +121,12 @@ pub fn Player(PlaneWidth: f32, PlaneHeight: f32) type { window: RenderWindow, objects_sprite: Sprite, renderSlice: RenderSliceFunction, - map: Map, + map: level.Map, ) void { - std.sort.sort(Object, map.objects.items, - // Wow, context with an arbitrary type! No macros, just - // Zig all the way down! - [2]f32{self.pos_x, self.pos_y}, - playerDistComp); + std.sort.sort(level.Object, map.objects.items, + // Wow, context with an arbitrary type! No macros, just + // Zig all the way down! + [2]f32{ self.pos_x, self.pos_y }, playerDistComp); const self_cos = std.math.cos(self.ang); const self_sin = std.math.sin(self.ang); @@ -186,7 +185,7 @@ pub fn Player(PlaneWidth: f32, PlaneHeight: f32) type { break; } } - const draw_frac = std.math.clamp((top - bottom) / height, 0 , 1); + const draw_frac = std.math.clamp((top - bottom) / height, 0, 1); renderSlice(window, objects_sprite, col, top, height, draw_frac, tex_frac, obj.texture); } } @@ -197,7 +196,7 @@ pub fn Player(PlaneWidth: f32, PlaneHeight: f32) type { window: RenderWindow, walls_sprite: Sprite, renderSlice: RenderSliceFunction, - map: Map, + map: level.Map, ) void { // This is a TERRIBLE hack: for whatever reason *linearly* // interpolating on the direction vectors gives @@ -315,7 +314,7 @@ pub fn Player(PlaneWidth: f32, PlaneHeight: f32) type { } } - pub fn renderFloorsToTexture(self: @This(), floors_image: Image, rendered_floors_texture: Texture, map: Map) !void { + pub fn renderFloorsToTexture(self: @This(), floors_image: Image, rendered_floors_texture: Texture, map: level.Map) !void { var pixels = [_]Colour{Colour.Black} ** (PlaneWidth * PlaneHeight / 2); // Again, another TERRIBLE hack: we do the same nasty linear @@ -352,9 +351,9 @@ pub fn Player(PlaneWidth: f32, PlaneHeight: f32) type { if (map.inBounds(ix, iy)) { const tex = @as(c_uint, map.lookup(ix, iy).floor_texture); - const toff = tex * @floatToInt(c_uint, TextureDim); - const px = @floatToInt(c_uint, TextureDim * std.math.fabs(sx.fpart)); - const py = @floatToInt(c_uint, TextureDim * std.math.fabs(sy.fpart)); + const toff = tex * @floatToInt(c_uint, constants.TextureDim); + const px = @floatToInt(c_uint, constants.TextureDim * std.math.fabs(sx.fpart)); + const py = @floatToInt(c_uint, constants.TextureDim * std.math.fabs(sy.fpart)); const val = floors_image.getPixel(.{ .x = toff + px, .y = py }); diff --git a/src/renderConstants.zig b/src/renderConstants.zig deleted file mode 100644 index 7c193a7..0000000 --- a/src/renderConstants.zig +++ /dev/null @@ -1,29 +0,0 @@ -// This file is part of ZiRC -// -// Copyright (C) 2021, tslil clingman -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -pub const ScreenWidth: f32 = 1024; -pub const ScreenHeight: f32 = 768; - -pub const PlaneWidth = 320; -pub const PlaneHeight = 240; - -pub const HFact = ScreenWidth / PlaneWidth; -pub const VFact = ScreenHeight / PlaneHeight; - -pub const BackTextureWidth: f32 = 1280; -pub const BackTextureHeight: f32 = 240; - -pub const TextureDim: f32 = 32.0; diff --git a/src/sfml/audio/Sound.zig b/src/sfml/audio/Sound.zig index 4430dcb..073aa5f 100644 --- a/src/sfml/audio/Sound.zig +++ b/src/sfml/audio/Sound.zig @@ -1,8 +1,8 @@ -//! Regular sound that can be played in the audio environment. +//! Regular sound that can be played in the audio environment. const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace audio; + pub usingnamespace sf.audio; }; const Sound = @This(); diff --git a/src/sfml/graphics/CircleShape.zig b/src/sfml/graphics/CircleShape.zig index ce48fa8..b2759e5 100644 --- a/src/sfml/graphics/CircleShape.zig +++ b/src/sfml/graphics/CircleShape.zig @@ -2,8 +2,8 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; - pub usingnamespace graphics; + pub usingnamespace sf.system; + pub usingnamespace sf.graphics; }; const CircleShape = @This(); diff --git a/src/sfml/graphics/Image.zig b/src/sfml/graphics/Image.zig index 6401a6c..9fc6530 100644 --- a/src/sfml/graphics/Image.zig +++ b/src/sfml/graphics/Image.zig @@ -2,8 +2,8 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; - pub usingnamespace graphics; + pub usingnamespace sf.system; + pub usingnamespace sf.graphics; }; const std = @import("std"); diff --git a/src/sfml/graphics/RectangleShape.zig b/src/sfml/graphics/RectangleShape.zig index 7c18a82..34bb114 100644 --- a/src/sfml/graphics/RectangleShape.zig +++ b/src/sfml/graphics/RectangleShape.zig @@ -2,8 +2,8 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; - pub usingnamespace graphics; + pub usingnamespace sf.system; + pub usingnamespace sf.graphics; }; const RectangleShape = @This(); @@ -124,7 +124,7 @@ ptr: *sf.c.sfRectangleShape, test "rectangle shape: sane getters and setters" { const tst = @import("std").testing; - + var rect = try RectangleShape.create(sf.Vector2f{ .x = 30, .y = 50 }); defer rect.destroy(); diff --git a/src/sfml/graphics/RenderWindow.zig b/src/sfml/graphics/RenderWindow.zig index fa60ce5..dd6c7e3 100644 --- a/src/sfml/graphics/RenderWindow.zig +++ b/src/sfml/graphics/RenderWindow.zig @@ -2,8 +2,8 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; - pub usingnamespace graphics; + pub usingnamespace sf.system; + pub usingnamespace sf.graphics; }; const RenderWindow = @This(); diff --git a/src/sfml/graphics/Sprite.zig b/src/sfml/graphics/Sprite.zig index aeb66bf..4f24735 100644 --- a/src/sfml/graphics/Sprite.zig +++ b/src/sfml/graphics/Sprite.zig @@ -2,8 +2,8 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; - pub usingnamespace graphics; + pub usingnamespace sf.system; + pub usingnamespace sf.graphics; }; const Sprite = @This(); diff --git a/src/sfml/graphics/Text.zig b/src/sfml/graphics/Text.zig index 9208511..caaefa5 100644 --- a/src/sfml/graphics/Text.zig +++ b/src/sfml/graphics/Text.zig @@ -2,8 +2,8 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; - pub usingnamespace graphics; + pub usingnamespace sf.system; + pub usingnamespace sf.graphics; }; const Text = @This(); diff --git a/src/sfml/graphics/View.zig b/src/sfml/graphics/View.zig index 48882e2..6ce9610 100644 --- a/src/sfml/graphics/View.zig +++ b/src/sfml/graphics/View.zig @@ -2,8 +2,8 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; - pub usingnamespace graphics; + pub usingnamespace sf.system; + pub usingnamespace sf.graphics; }; const View = @This(); diff --git a/src/sfml/graphics/rect.zig b/src/sfml/graphics/rect.zig index 184799c..ace7397 100644 --- a/src/sfml/graphics/rect.zig +++ b/src/sfml/graphics/rect.zig @@ -2,7 +2,7 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; + pub usingnamespace sf.system; }; const math = @import("std").math; diff --git a/src/sfml/graphics/texture.zig b/src/sfml/graphics/texture.zig index 2de3d93..ac4cfbb 100644 --- a/src/sfml/graphics/texture.zig +++ b/src/sfml/graphics/texture.zig @@ -2,8 +2,8 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; - pub usingnamespace graphics; + pub usingnamespace sf.system; + pub usingnamespace sf.graphics; }; const std = @import("std"); diff --git a/src/sfml/system/Clock.zig b/src/sfml/system/Clock.zig index 17b6e5b..d8b174e 100644 --- a/src/sfml/system/Clock.zig +++ b/src/sfml/system/Clock.zig @@ -2,8 +2,8 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; - pub usingnamespace graphics; + pub usingnamespace sf.system; + pub usingnamespace sf.graphics; }; const Clock = @This(); diff --git a/src/sfml/window/event.zig b/src/sfml/window/event.zig index d875a1c..c9694f1 100644 --- a/src/sfml/window/event.zig +++ b/src/sfml/window/event.zig @@ -2,7 +2,7 @@ const sf = struct { pub usingnamespace @import("../sfml.zig"); - pub usingnamespace system; + pub usingnamespace sf.system; }; pub const Event = union(Event.Type) { -- cgit v1.3.1