<div dir="auto">Hello,<div dir="auto">Please indicate platform, os, FFI and VM version.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 19 mars 2020 à 16:19, William Ott via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello everyone,<div><br></div><div>I'm trying to write a FFI wrapper for the game dev library raylib [1]. But I encountered an issue when passing custom ExternalStructures to some library functions.</div><div><br></div><div>For example I created the following struct:</div><div><br></div><div>!classDefinition: #RaylibVector2 category: #'Game-Raylib'!<br>ExternalStructure subclass: #RaylibVector2<br> instanceVariableNames: ''<br> classVariableNames: ''<br> poolDictionaries: ''<br> category: 'Game-Raylib'!<br>!classDefinition: 'RaylibVector2 class' category: #'Game-Raylib'!<br>RaylibVector2 class<br> instanceVariableNames: ''!<br></div><div><br></div><div>!RaylibVector2 class methodsFor: 'compiling' stamp: 'smotti 3/19/2020 22:51:40'!<br>fields<br> "self defineFields"<br> ^ #( (x 'float') (y 'float') )! !<br></div><div><br></div><div>And here the FFI method:</div><div><br></div><div>!Raylib class methodsFor: 'as yet unclassified' stamp: 'smotti 3/19/2020 22:52:44'!<br>apiDrawCircleVatPosition: center radius: radius color: color<br> <br><apicall: void 'DrawCircleV' (RaylibVector2 float RaylibColor) module: 'libraylib'><br> ^ self externalCallFailed ! !<br></div><div><br></div><div>What i expect is that this will draw a circle into a window with the center being at the coordinates defined by RaylibVector2.</div><div><br></div><div>It works for RaylibColor, which is another struct with ulong values to define an RGB color with and alpha value. The RaylibVector2 works also when returned from a function for example in the case of GetMousePosition. Also drawing works in general by using DrawCircle or DrawRectangle.</div><div><br></div><div>I checked the FFI-Test package for examples also read through the documentation and classes of the other FFI classes. And also tried different approaches but it just doesn't work.<br>So I have no clue why it doesn't work in this case (and in others, i.e. when passing a RaylibRectangle).</div><div><br></div><div>You can find a package with the classes and examples at [2].</div><div><br></div><div>Thank you very much for your help in advance.</div><div><br></div><div>Kind regards,</div><div>smotti</div><div><br></div><div>[1] <a href="https://www.raylib.com/index.html" target="_blank" rel="noreferrer">https://www.raylib.com/index.html</a></div><div>[2] <a href="https://pastebin.com/4LSs6SNX" target="_blank" rel="noreferrer">https://pastebin.com/4LSs6SNX</a></div></div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank" rel="noreferrer">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div>