adamdruppe / arsd

This is a collection of modules that I've released over the years. Most of them stand alone, or have just one or two dependencies in here, so you don't have to download this whole repo.
http://arsd-official.dpldocs.info/arsd.html
530 stars 127 forks source link

Moving those 2 functions here #252

Closed MuriloMir closed 4 years ago

MuriloMir commented 4 years ago

I've just moved those 2 functions to simpledisplay.

adamdruppe commented 4 years ago

ok im gonna hit merge then do some fixes myself, it will be pretty different though

adamdruppe commented 4 years ago

here's the way i coded it

https://github.com/adamdruppe/arsd/commit/136b4d0ad50bec88e2601ccb5c9bb53028f8134d

and a usage example:


import arsd.simpledisplay;

void main() {
        SyntheticInput i = SyntheticInput(0);

        i.pressKey(Key.Shift, true); // press and hold Shift
        i.pressMouseButton(MouseButton.left, true); // hold left mouse button
        i.moveMouseArrowBy(50, 10);
        i.pressMouseButton(MouseButton.left, false); // release button
        i.pressKey(Key.Shift, false); // release shift

        i.sendSyntheticInput("ok cool"); // send a plain ascii string
}
adamdruppe commented 4 years ago

by putting it in the object i could load the library without a new build dependency and sort the api out a little. It is also next to the Windows function in the file so if we want to add more Windows functions it can follow the same pattern.