Perform colorToInt conversion manually during compiletime (#176)
This commit is contained in:
parent
94fa7e23b0
commit
e4d66a8dae
3 changed files with 15 additions and 5 deletions
|
|
@ -2211,6 +2211,13 @@ pub fn loadRenderTexture(width: i32, height: i32) RaylibError!RenderTexture2D {
|
|||
return if (isValid) render_texture else RaylibError.LoadRenderTexture;
|
||||
}
|
||||
|
||||
pub fn colorToInt(color: Color) i32 {
|
||||
return if (@inComptime())
|
||||
(@as(i32, color.r) << 24) | (@as(i32, color.g) << 16) | (@as(i32, color.b) << 8) | @as(i32, color.a)
|
||||
else
|
||||
@as(i32, cdef.ColorToInt(color));
|
||||
}
|
||||
|
||||
/// Get the default Font
|
||||
pub fn getFontDefault() RaylibError!Font {
|
||||
// TODO: GetFontDefault requires SUPPORT_DEFAULT_FONT. Error out if unset.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue