mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +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) {
|
func NSColor_colorWithSRGBRedGreenBlueAlpha(red, green, blue, alpha CGFloat) (color NSColor) {
|
||||||
sig := NSMethodSignature_signatureWithObjCTypes("@@:ffff")
|
return NSColor{objc.ID(class_NSColor).Send(sel_colorWithSRGBRedGreenBlueAlpha, red, green, blue, alpha)}
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type NSOperatingSystemVersion struct {
|
type NSOperatingSystemVersion struct {
|
||||||
|
@ -910,14 +910,7 @@ func (rce RenderCommandEncoder) SetFragmentTexture(texture Texture, index int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rce RenderCommandEncoder) SetBlendColor(red, green, blue, alpha float32) {
|
func (rce RenderCommandEncoder) SetBlendColor(red, green, blue, alpha float32) {
|
||||||
inv := cocoa.NSInvocation_invocationWithMethodSignature(cocoa.NSMethodSignature_signatureWithObjCTypes("v@:ffff"))
|
rce.commandEncoder.Send(sel_setBlendColorRedGreenBlueAlpha, red, green, blue, alpha)
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDepthStencilState sets the depth and stencil test state.
|
// SetDepthStencilState sets the depth and stencil test state.
|
||||||
|
Loading…
Reference in New Issue
Block a user