Open PHandradee opened 1 year ago
Hi. I had the same question and @ MoritzBrueckner gave me a working solution, although it requires some manual source tweaking.
RPaladin — Kha related, but people who use Kha claim that this code works fine in Kha but it doesn't for me in Armory - it also doesn't throw any errors for me so they may be well right. Why doesn't this code work in Armory it seems? ```haxe kha.input.Mouse.get().setSystemCursor(Crosshair); ``` Reference: https://github.com/Kode/Kha/blob/main/Sources/kha/input/Mouse.hx#L12-L28
timodriaan — Do you use Krom? The code looks correct to me, will try to reproduce it now (or do you already have a small example file)?
RPaladin — 1. I'm using Krom Player (Armory). 2. Using a default blend with no cache. The cursor stays the same "Default" icon/image.
timodriaan — Also doesn't work for me, will investigate. It definitely worked before (~ 1 1/2 years ago when I worked on my game jam game), but Armory's Krom.hx needed to be modified back then, perhaps it's a similar issue... Even sillier, it's not implemented in Kha's Krom backend
timodriaan — It's only implemented in Armorcore, which is too bad because any change made to Kha would be overwritten when Lubos updates Kha. It's the same problem as always 😄 I will write it in the Kha discord server, for now you need to add `static function setMouseCursor(id: Int): Void;` to `/Kha/Backends/Krom/Krom.hx` and then call `Krom.setMouseCursor(cursorValue)` in your Haxe code `#if kha_krom where cursorValue` is an integer representing the cursor you want (Kha's implementation uses an enum so you can't just use the enum values). It's really messy 😄
Discord message ID, if you're interested: https://discord.com/channels/486771218599510021/486773417316450305/1053045903293939722
@MoritzBrueckner in reference to asking Rob, were you able to get something implemented for Kha?
@MoritzBrueckner in reference to asking Rob, were you able to get something implemented for Kha?
I sadly don't remember this anymore (I don't even remember anymore whether I even asked), but there are essentially two issues here:
Krom dont supports change the cursor via kha.input.Mouse.setSystemCursor().
It was nice to have this possibility.
`package arm;
import kha.Image;
class MouseCursorHandler extends iron.Trait {
} ` With this code above the mouse cursor is changed when exporting to Web, but in Krom this don't work.