Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   General Forum (http://www.chiefdelphi.com/forums/forumdisplay.php?f=16)
-   -   Using POV in Java (http://www.chiefdelphi.com/forums/showthread.php?t=152468)

whitetail 30-11-2016 10:33

Using POV in Java
 
I am relatively new to programming and still have a lot to learn. I found some code on an old post on Chief Delphi and I added a class and added that in but it says: public class POV implements IControl. I am wondering what it means by implementing IControl and what is IControl and how to I implement it in my code. All help is gratefully appreciated :)

orangelight 30-11-2016 10:42

Re: Using POV in Java
 
Can you link the CD post?

nickbrickmaster 30-11-2016 10:46

Re: Using POV in Java
 
What exactly are you trying to do?

IControl is an interface, I assume for controllers. I've never seen it before, and unless you are implementing some custom control interface, I don't think you need it.

Just googling it, I found a Github repo from 3128 with class POV implementing IControl. IControl is a file in that same repo, and should be distributed along with POV.

I think you're putting the cart before the horse, if it were. There is probably a better way to do what you're trying to do.

whitetail 30-11-2016 10:49

Re: Using POV in Java
 
https://www.chiefdelphi.com/forums/s...&highlight=pov

nickbrickmaster 30-11-2016 11:06

Re: Using POV in Java
 
Yeah, just use the getPOV() method of your joystick object. It's not hard to check this angle against constants to determine which direction is pressed.

gerthworm 30-11-2016 12:57

Re: Using POV in Java
 
Java background - The "implements" keyword indicates that the class named POV has a required set of interface functions defined by the interface IControl. IControl effectively puts requirements on what sorts of functionality the POV class must provide. http://stackoverflow.com/questions/4...-do-on-a-class has a pretty good example.

As already mentioned, Joystick.getPOV() is probably the right answer, making the above statement relevant only for your edification.

As an example somewhat related to what you were doing, here's code our students wrote last year specific to an XBOX 360 controller, where we determine which direction(s) the POV hat is pushed based on angle criteria:
https://github.com/RobotCasserole173...ontroller.java


All times are GMT -5. The time now is 19:28.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi