Skip to content

Commit

Permalink
[api] Updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
travisdoor committed Nov 7, 2023
1 parent 04eed2e commit 704dcc8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 9 additions & 3 deletions lib/bl/api/extra/draw/draw.bl
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,11 @@ texture_init :: fn (texture: *Texture, directory: string_view, filename: string_
// @Incomplete: we should support custom allocators here.
assert(texture);
data: *u8;
err :: png_load_from_file(tprint("%/%", directory, filename), &data, &texture.width, &texture.height, &texture.bit_depth, &texture.format);
filepath := filename;
if directory.len > 0 {
filepath = tprint("%/%", directory, filename);
}
err :: png_load_from_file(filepath, &data, &texture.width, &texture.height, &texture.bit_depth, &texture.format);
if err { return err; }
gl_init_texture_2d(texture, data);
free(data);
Expand Down Expand Up @@ -576,8 +580,10 @@ font_generate_char_set :: fn (chars: string_view, out_set: *[..]u32) {
/// we need to render some non-ascii unicode characters. Each loaded font must be terminated by [font_terminate](#drawfont_terminate).
font_init_at_size :: fn (font: *Font, directory: string_view, filename: string_view, size: s32, char_set := []u32.{}) Error {
using FreeType;
filepath :: tprint("%/%", directory, filename);

filepath := filename;
if directory.len > 0 {
filepath = tprint("%/%", directory, filename);
}
face: *Face;
err :: New_Face(freetype_library, filepath.ptr, 0, &face);
defer Done_Face(face);
Expand Down
3 changes: 2 additions & 1 deletion lib/bl/api/os/windows/winapi.bl
Original file line number Diff line number Diff line change
Expand Up @@ -1183,4 +1183,5 @@ PROCESS_TERMINATE : u32 : 0x0001;

OpenProcess :: fn (dwDesiredAccess: DWORD, bInheritHandle: BOOL, dwProcessId: DWORD) HANDLE #extern "OpenProcess";

PathCreateFromUrlA :: fn (pszUrl: PCSTR, pszPath: PSTR, pcchPath: *DWORD, dwFlags: DWORD) HRESULT #extern "PathCreateFromUrlA";
PathCreateFromUrlA :: fn (pszUrl: PCSTR, pszPath: PSTR, pcchPath: *DWORD, dwFlags: DWORD) HRESULT #extern "PathCreateFromUrlA";
UrlCreateFromPathA :: fn (pszPath: PCSTR, pszUrl: PSTR, pcchUrl: *DWORD, dwFlags: DWORD) HRESULT #extern "UrlCreateFromPathA";

0 comments on commit 704dcc8

Please sign in to comment.