c++ - FireBreath passing values from one function to another and using that functions in JavaScript -


how can pass ptx , pty testpluginapi::clicksemulationmove testpluginapi::clicksemulationclick(int ptx, int pty).
thing must use 2 functions in javascript , therefore can't expose 1 another.

fb::variant testpluginapi::clicksemulationclick(int ptx, int pty) {  showcursor(true); mouseleft(); mousereturn(ptx, pty); showcursor(true); return 0; }  fb::variant testpluginapi::clicksemulationmove(int ptx, int pty) { point pt; mousemove(-325, 605); getcursorpos(&pt); ptx = pt.x; pty = pt.y; return 0; } 

as need use jsobjectptr or fb::variantlist, i'm bit of confused without sample. can show me simple code sample?

have read jsapi docs? information there.

to return array (will javascript array) 2 values, can do:

return fb::variant_list_of(pt.x)(pt.y); 

then in javascript call other method like:

var res = plugin().clicksemulationmove(); // assuming don't need args here plugin().clicksemulationclick(res[0], res[1]); 

you pass array in directly, in case in c++:

fb::variant testpluginapi::clicksemulationclick(const std::vector<int>& arr) {     showcursor(true);     mouseleft();     mousereturn(arr[0], arr[1]);     showcursor(true);     return 0; } 

seriously, there example of of these things in fbtestplugin example in firebreath code base; should spend time in there. of questions see asking discovered reading through code , you'd understand better.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -