use new exit() everywhere
parent
b2851daffc
commit
a69e6febbc
|
@ -33,7 +33,8 @@ fn (f mut Fetcher) fetch() {
|
||||||
f.mu.unlock()
|
f.mu.unlock()
|
||||||
resp := http.get('https://hacker-news.firebaseio.com/v0/item/${id}.json')
|
resp := http.get('https://hacker-news.firebaseio.com/v0/item/${id}.json')
|
||||||
story := json.decode(Story, resp) or {
|
story := json.decode(Story, resp) or {
|
||||||
exit('failed to decode a story')
|
println('failed to decode a story')
|
||||||
|
exit(1)
|
||||||
}
|
}
|
||||||
println('#$f.cursor) $story.title')
|
println('#$f.cursor) $story.title')
|
||||||
}
|
}
|
||||||
|
|
10
gg/gg.v
10
gg/gg.v
|
@ -273,7 +273,8 @@ fn ft_load_char(_face Face, code long) Character {
|
||||||
# FT_Face face = *((FT_Face*)_face.cobj);
|
# FT_Face face = *((FT_Face*)_face.cobj);
|
||||||
# if (FT_Load_Char(face, code, FT_LOAD_RENDER))
|
# if (FT_Load_Char(face, code, FT_LOAD_RENDER))
|
||||||
{
|
{
|
||||||
os.exit('ERROR::FREETYTPE: Failed to load Glyph')
|
println('freetype: Failed to load Glyph')
|
||||||
|
exit(1)
|
||||||
}
|
}
|
||||||
// Generate texture
|
// Generate texture
|
||||||
# GLuint texture;
|
# GLuint texture;
|
||||||
|
@ -345,14 +346,15 @@ fn new_context_text(cfg Cfg, scale int) *GG {
|
||||||
}
|
}
|
||||||
if !os.file_exists(font_path) {
|
if !os.file_exists(font_path) {
|
||||||
println('failed to load RobotoMono-Regular.ttf')
|
println('failed to load RobotoMono-Regular.ttf')
|
||||||
exit('')
|
exit1()
|
||||||
}
|
}
|
||||||
# FT_Face face;
|
# FT_Face face;
|
||||||
# if (FT_New_Face(ft, font_path.str, 0, &face))
|
# if (FT_New_Face(ft, font_path.str, 0, &face))
|
||||||
// # if (FT_New_Face(ft, "/Library/Fonts/Courier New.ttf", 0, &face))
|
// # if (FT_New_Face(ft, "/Library/Fonts/Courier New.ttf", 0, &face))
|
||||||
// # if (FT_New_Face(ft, "/System/Library/Fonts/Apple Color Emoji.ttc", 0, &face))
|
// # if (FT_New_Face(ft, "/System/Library/Fonts/Apple Color Emoji.ttc", 0, &face))
|
||||||
{
|
{
|
||||||
exit('ERROR::FREETYPE: Failed to load font')
|
println('freetyp: Failed to load font')
|
||||||
|
exit(1)
|
||||||
}
|
}
|
||||||
// Set size to load glyphs as
|
// Set size to load glyphs as
|
||||||
# FT_Set_Pixel_Sizes(face, 0, font_size) ;
|
# FT_Set_Pixel_Sizes(face, 0, font_size) ;
|
||||||
|
@ -466,7 +468,7 @@ fn (ctx &GG) _draw_text(_x, _y int, utext ustring, cfg gx.TextCfg) {
|
||||||
firstc := utext.at(0)
|
firstc := utext.at(0)
|
||||||
println('drawtext "$utext.s" len=$utext.s.len ulen=$utext.len x=$_x firstc=$firstc')
|
println('drawtext "$utext.s" len=$utext.s.len ulen=$utext.len x=$_x firstc=$firstc')
|
||||||
if firstc != ' ' {
|
if firstc != ' ' {
|
||||||
exit('')
|
exit1()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -125,7 +125,8 @@ pub fn new_shader(name string) Shader {
|
||||||
log := gl.shader_info_log(vertex_shader)
|
log := gl.shader_info_log(vertex_shader)
|
||||||
println('shader $vertex_shader compilation failed')
|
println('shader $vertex_shader compilation failed')
|
||||||
println('shader source = $vertex_src')
|
println('shader source = $vertex_src')
|
||||||
os.exit('shader')
|
println('shader failed to compile')
|
||||||
|
exit(1)
|
||||||
}
|
}
|
||||||
// fragment shader
|
// fragment shader
|
||||||
// fragment_src := os.read_file(fragment_path.trim_space())
|
// fragment_src := os.read_file(fragment_path.trim_space())
|
||||||
|
@ -134,7 +135,8 @@ pub fn new_shader(name string) Shader {
|
||||||
gl.compile_shader(fragment_shader)
|
gl.compile_shader(fragment_shader)
|
||||||
if gl.shader_compile_status(fragment_shader) == 0 {
|
if gl.shader_compile_status(fragment_shader) == 0 {
|
||||||
println('fragment $fragment_shader shader compilation failed')
|
println('fragment $fragment_shader shader compilation failed')
|
||||||
os.exit('shader')
|
println('shader failed to compile')
|
||||||
|
exit(1)
|
||||||
}
|
}
|
||||||
// link shaders
|
// link shaders
|
||||||
shader_program := gl.create_program()
|
shader_program := gl.create_program()
|
||||||
|
@ -147,7 +149,8 @@ pub fn new_shader(name string) Shader {
|
||||||
println('shader compilation failed')
|
println('shader compilation failed')
|
||||||
println('vertex source = $vertex_src')
|
println('vertex source = $vertex_src')
|
||||||
println('fragment source = $fragment_src')
|
println('fragment source = $fragment_src')
|
||||||
os.exit('shader')
|
println('shader failed to compile')
|
||||||
|
exit(1)
|
||||||
}
|
}
|
||||||
shader := Shader {
|
shader := Shader {
|
||||||
program_id: shader_program,
|
program_id: shader_program,
|
||||||
|
|
3
gl/gl.v
3
gl/gl.v
|
@ -18,7 +18,8 @@ import const (
|
||||||
fn init_glad() {
|
fn init_glad() {
|
||||||
ok := C.gladLoadGL()
|
ok := C.gladLoadGL()
|
||||||
if !ok {
|
if !ok {
|
||||||
os.exit('Failed to initialize glad OpenGL context')
|
println('Failed to initialize glad OpenGL context')
|
||||||
|
exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,8 @@ fn load(path string) Image {
|
||||||
res.data = C.stbi_load(path.str, &res.width, &res.height, &res.nr_channels, 0)
|
res.data = C.stbi_load(path.str, &res.width, &res.height, &res.nr_channels, 0)
|
||||||
}
|
}
|
||||||
if isnil(res.data) {
|
if isnil(res.data) {
|
||||||
exit('stbi cant load')
|
println('stbi cant load')
|
||||||
|
exit(1)
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue