Raylib-cs | use library to learn videogames | Game Engine library
kandi X-RAY | Raylib-cs Summary
kandi X-RAY | Raylib-cs Summary
C# bindings for raylib, a simple and easy-to-use library to learn videogames programming
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Raylib-cs
Raylib-cs Key Features
Raylib-cs Examples and Code Snippets
Community Discussions
Trending Discussions on Raylib-cs
QUESTION
I'm trying to draw simple graphics in the .NET Interactive Notebook, using C#. Kind of like a C# version of Dr. Racket.
The simplest thing I've seen so far is using System.Drawing
(SFML.NET, Raylib-cs work too, but they open up a window to show graphics instead of within the notebook).
I'd be willing to try another recommendation with #r "nuget:"
too.
The problem seems to be related to the MIME type, but I'm not sure. I get the same results with both .dib
and .ipynb
Is there a way to use something like .Display()
and show the simple image within the notebook?
Code
...ANSWER
Answered 2022-Jan-25 at 20:29Found the answer on github's issues. It looks like someone made a Skiasharp extension too, which is more what I'm looking for (although I cannot figure out how to install it):
https://github.com/dotnet/interactive/issues/902#issuecomment-900918386
Updated/Fixed Code
QUESTION
I'm teaching C# and game dev to high school students, and we're using Raylib-cs as a simple introduction to graphics APIs and libraries.
We've hit a small snag: We're swedish, and we'd like to use some special non-ascii letters – namely å, ä and ö (lots of swedish words use them). However, I can't get Raylib-cs to display anything above codepoint 127 – at least not using DrawText.
Instead, all I get is ?.
This is on Windows 10, 64-bit, 20H2. Using dotnet 5 (latest) and primarily the Raylib-cs available as a nuget package.
What I've tried so far:
- DrawText and DrawTextEx. Same result.
- Loading different fonts, with or without explicit inclusion of codepoints up to 255. Same result.
- Getting the latest Raylib-cs from the github page. Same result.
- Running the same code but in a virtual Debian machine. THIS WORKS, so issue seems to be in Windows.
- Asking a friend who's proficient in C/C++ to try using åäö using Raylib in C++. THIS WORKS, so the issue seems to be specific to Raylib-cs, even though it's just a wrapper?
- DrawTextCodepoint. THIS WORKS, which means that for some reason the issue is specific to the DrawText methods (and InitWindow). Raylib is supposed to be Unicode-capable, and this proves that at least in theory, it is.
Here's my simple test code (just writes out characters 0-255):
...ANSWER
Answered 2021-Jan-20 at 08:49The way the library imports DrawText
is faulty; its default behavior "marshals" string values to fit a legacy character encoding, not necessarily UTF-8: https://github.com/ChrisDill/Raylib-cs/blob/b1f46d33071387800559523950aa131448251461/Raylib-cs/Raylib.cs#L2116 (Specifying CharSet=Unicode probably won't help because the DrawText function doesn't use wide-character strings, but rather ordinary char* pointers interpreted as UTF-8.)
I see you have posted an issue to the GitHub repository. And fortunately, the library's author suggested two workarounds. As they said, one of them is: "Using [MarshalAs(UnmanagedType.LPUTF8Str)]
to marshal strings as UTF8."
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Raylib-cs
Add Raylib-cs/Raylib-cs.csproj to your project as an existing project. Download the native libraries for the platforms you want to build for using the official 3.7.0 release. NOTE: the MSVC version is required for Windows platforms. (Recommended) Put the native library for each platform under Raylib-cs/runtimes/{platform}/native/ (Optional) If you want to handle the native libraries yourself, make sure they are either in the same directory as the executable and/or can be found in the search path. See https://www.mono-project.com/docs/advanced/pinvoke/ for details.
Download/Clone this repo
Add Raylib-cs/Raylib-cs.csproj to your project as an existing project.
Download the native libraries for the platforms you want to build for using the official 3.7.0 release. NOTE: the MSVC version is required for Windows platforms
(Recommended) Put the native library for each platform under Raylib-cs/runtimes/{platform}/native/ (Optional) If you want to handle the native libraries yourself, make sure they are either in the same directory as the executable and/or can be found in the search path. See https://www.mono-project.com/docs/advanced/pinvoke/ for details.
Start coding!
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page