(settings ImmediateIconButtonSettings)
| 368 | } |
| 369 | |
| 370 | func ImmediateIconButton(settings ImmediateIconButtonSettings) bool { |
| 371 | |
| 372 | clicked := false |
| 373 | |
| 374 | dst := &settings.Dst |
| 375 | dst.W *= settings.Scale |
| 376 | dst.H *= settings.Scale |
| 377 | |
| 378 | var insideButton = false |
| 379 | if settings.WorldSpace { |
| 380 | insideButton = globals.Mouse.RawWorldPosition().Inside(dst) |
| 381 | } else { |
| 382 | insideButton = globals.Mouse.RawPosition().Inside(dst) |
| 383 | } |
| 384 | |
| 385 | if RawClickedInRect(dst, settings.WorldSpace) { |
| 386 | globals.Mouse.Button(sdl.BUTTON_LEFT).Consume() |
| 387 | clicked = true |
| 388 | } |
| 389 | |
| 390 | guiTex := globals.GUITexture.Texture |
| 391 | |
| 392 | tint := uint8(200) |
| 393 | |
| 394 | if insideButton { |
| 395 | tint = 255 |
| 396 | } |
| 397 | |
| 398 | guiTex.SetColorMod(tint, tint, tint) |
| 399 | guiTex.SetAlphaMod(255) |
| 400 | |
| 401 | if settings.WorldSpace { |
| 402 | settings.Dst = *globals.Project.Camera.TranslateRect(dst) |
| 403 | } |
| 404 | globals.Renderer.RenderTextureRotated(guiTex, &settings.Src, dst, settings.Rotation, &sdl.FPoint{float32(settings.Src.W / 2), float32(settings.Src.H / 2)}, settings.Flip) |
| 405 | |
| 406 | return clicked |
| 407 | |
| 408 | } |
| 409 | |
| 410 | type Checkbox struct { |
| 411 | IconButton |
nothing calls this directly
no test coverage detected