You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I'm trying to load images from memory instead of loading them from a file.
But I've landed on an issue where the following function does not work because AsRef<Texture> is not implemented for Texture.
However. external C function DrawTexture works. Because it seems to be related to raylib_sys::Texture which is not convertible to raylib::ffi::Texture2D. Although I can definitely be wrong!
let img = LoadImageFromMemory(const_c!(".png"),
image_data.as_ptr()as*const_,
image_data.len()asi32);let tex = LoadTextureFromImage(img)// Texture2D
d.draw_texture(tex, x asi32 - 128, y asi32, fade_out_color);// Gives error
error[E0277]: the trait bound `Texture:AsRef<Texture>` is not satisfied
--> src\credits.rs:85:28
|
85 | d.draw_texture(tex, x asi32 - 128, y asi32, fade_out_color);
| ------------ ^^^ the trait `AsRef<Texture>` is not implemented for `Texture`
| |
| required by a bound introduced by this call
|
note: required by a bound in `draw_texture`
--> C:\Users\Nautilus\.cargo\registry\src\github.com-1ecc6299db9ec823\raylib-3.7.0\src\core\drawing.rs:849:23
|
849 | texture:implAsRef<ffi::Texture2D>,
| ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `draw_texture`
While this sample works
let img = LoadImageFromMemory(const_c!(".png"),
image_data.as_ptr()as*const_,
image_data.len()asi32);let tex = LoadTextureFromImage(img)// Texture2DDrawTexture(tex, x asi32 - 128, y asi32, raylib::ffi::Color{r:255,g:255,b:255,a:255,});
The text was updated successfully, but these errors were encountered:
Library Version:
3.7.0
Rust version:
1.65.0
Toolchain:
stable-x86-64-pc-windows-msvc
Description
I'm trying to load images from memory instead of loading them from a file.
But I've landed on an issue where the following function does not work because
AsRef<Texture>
is not implemented forTexture
.However. external C function
DrawTexture
works. Because it seems to be related toraylib_sys::Texture
which is not convertible toraylib::ffi::Texture2D
. Although I can definitely be wrong!While this sample works
The text was updated successfully, but these errors were encountered: