mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
internal/cocoa, internal/graphicsdriver/mtl: remove usages of NSInvocations to directly call ID.Send (#2464)
purego now supports using floats as arguments. We can remove these instances of NSInvocation that only existed to circumvent that feature. Updates #1162
This commit is contained in:
parent
9a75e266d4
commit
fb612ab443
@ -108,16 +108,7 @@ type NSColor struct {
|
||||
}
|
||||
|
||||
func NSColor_colorWithSRGBRedGreenBlueAlpha(red, green, blue, alpha CGFloat) (color NSColor) {
|
||||
sig := NSMethodSignature_signatureWithObjCTypes("@@:ffff")
|
||||
inv := NSInvocation_invocationWithMethodSignature(sig)
|
||||
inv.SetSelector(sel_colorWithSRGBRedGreenBlueAlpha)
|
||||
inv.SetArgumentAtIndex(unsafe.Pointer(&red), 2)
|
||||
inv.SetArgumentAtIndex(unsafe.Pointer(&green), 3)
|
||||
inv.SetArgumentAtIndex(unsafe.Pointer(&blue), 4)
|
||||
inv.SetArgumentAtIndex(unsafe.Pointer(&alpha), 5)
|
||||
inv.InvokeWithTarget(objc.ID(class_NSColor))
|
||||
inv.GetReturnValue(unsafe.Pointer(&color))
|
||||
return color
|
||||
return NSColor{objc.ID(class_NSColor).Send(sel_colorWithSRGBRedGreenBlueAlpha, red, green, blue, alpha)}
|
||||
}
|
||||
|
||||
type NSOperatingSystemVersion struct {
|
||||
|
@ -910,14 +910,7 @@ func (rce RenderCommandEncoder) SetFragmentTexture(texture Texture, index int) {
|
||||
}
|
||||
|
||||
func (rce RenderCommandEncoder) SetBlendColor(red, green, blue, alpha float32) {
|
||||
inv := cocoa.NSInvocation_invocationWithMethodSignature(cocoa.NSMethodSignature_signatureWithObjCTypes("v@:ffff"))
|
||||
inv.SetTarget(rce.commandEncoder)
|
||||
inv.SetSelector(sel_setBlendColorRedGreenBlueAlpha)
|
||||
inv.SetArgumentAtIndex(unsafe.Pointer(&red), 2)
|
||||
inv.SetArgumentAtIndex(unsafe.Pointer(&green), 3)
|
||||
inv.SetArgumentAtIndex(unsafe.Pointer(&blue), 4)
|
||||
inv.SetArgumentAtIndex(unsafe.Pointer(&alpha), 5)
|
||||
inv.Invoke()
|
||||
rce.commandEncoder.Send(sel_setBlendColorRedGreenBlueAlpha, red, green, blue, alpha)
|
||||
}
|
||||
|
||||
// SetDepthStencilState sets the depth and stencil test state.
|
||||
|
Loading…
Reference in New Issue
Block a user