1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tools: check formatting of more modules with v test-cleancode, colorize v vet output

This commit is contained in:
Delyan Angelov
2021-03-24 12:39:09 +02:00
parent 9e48826bcb
commit 9b78d7d21d
13 changed files with 128 additions and 67 deletions

View File

@@ -1,6 +1,7 @@
module gg
#include "@VROOT/vlib/gg/gg_darwin.m"
fn C.gg_get_screen_size() Size
fn C.darwin_draw_string(x int, y int, s string, cfg voidptr)

View File

@@ -28,7 +28,9 @@ pub fn (x Vec4) str() string {
// create a Vec4 function passing x,y,z as parameteres. w is set to 1
pub fn vec3(x f32, y f32, z f32) Vec4 {
return m4.Vec4{e:[x, y, z, 1]!}
return Vec4{
e: [x, y, z, 1]!
}
}
// Remove all the raw zeros
@@ -47,12 +49,14 @@ pub fn (a Vec4) clean() Vec4 {
// Set all elements to value
pub fn (mut x Vec4) copy(value f32) {
x.e = [ value, value, value, value, ]!
x.e = [value, value, value, value]!
}
// Scale the vector using a scalar
pub fn (x Vec4) mul_scalar(value f32) Vec4 {
return Vec4{ e: [ x.e[0] * value, x.e[1] * value, x.e[2] * value, x.e[3] * value, ]! }
return Vec4{
e: [x.e[0] * value, x.e[1] * value, x.e[2] * value, x.e[3] * value]!
}
}
// Reciprocal of the vector

View File

@@ -261,7 +261,9 @@ pub fn system_font_path() string {
mut fonts := ['Ubuntu-R.ttf', 'Arial.ttf', 'LiberationSans-Regular.ttf', 'NotoSans-Regular.ttf',
'FreeSans.ttf', 'DejaVuSans.ttf']
$if macos {
fonts = ['/System/Library/Fonts/SFNS.ttf', '/System/Library/Fonts/SFNSText.ttf', '/Library/Fonts/Arial.ttf']
fonts = ['/System/Library/Fonts/SFNS.ttf', '/System/Library/Fonts/SFNSText.ttf',
'/Library/Fonts/Arial.ttf',
]
for font in fonts {
if os.is_file(font) {
return font
@@ -269,8 +271,10 @@ pub fn system_font_path() string {
}
}
$if android {
xml_files := ['/system/etc/system_fonts.xml', '/system/etc/fonts.xml', '/etc/system_fonts.xml',
'/etc/fonts.xml', '/data/fonts/fonts.xml', '/etc/fallback_fonts.xml']
xml_files := ['/system/etc/system_fonts.xml', '/system/etc/fonts.xml',
'/etc/system_fonts.xml', '/etc/fonts.xml', '/data/fonts/fonts.xml',
'/etc/fallback_fonts.xml',
]
font_locations := ['/system/fonts', '/data/fonts']
for xml_file in xml_files {
if os.is_file(xml_file) && os.is_readable(xml_file) {