Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 2D / translate Graphics2D ?! on: 2003-05-27 13:15:24
Hi
I want to have something like a speedometer. I draw it with Java2D
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
Graphics2D g2d = ( Graphics2D ) new Graphics;
GeneralPath filledPolygon = new GeneralPath();

filledPolygon.moveTo( x, yo1 );
filledPolygon.lineTo( x, yu1 );
filledPolygon.lineTo( x1, yu1 );
filledPolygon.lineTo( x1, yu2 );
filledPolygon.lineTo( x2, y );
filledPolygon.lineTo( x1, yo2 );
filledPolygon.lineTo( x1, yo1 );
filledPolygon.lineTo( x, yo1 );

AffineTransform af = new AffineTransform();
af.translate(676, 75);
af.rotate( Math.PI );
af.scale(0.5, 0.6);

filledPolygon.transform(af);

g2d.setPaint( Color.white );
g2d.fill( filledPolygon );

If I have now an event, then I want to change to position of "filledPolygon". How can I do that?

I found out, that i can translate the Graphics2D-Object, but this does not affect on my already created "filledPolygon" !

Any ideas?
Thanks, Flavio
2  Java Game APIs & Engines / Java 3D / Re: How to implement a joystick? on: 2003-05-19 17:39:55
Hi,
first of all, thanks for responding. I'm now a little bit further ... but still have problems:

I get the value from JXInput (-1 to 1) which I wanna use for the translation/rotation.
How can I transform this value in a value which is compatible with the Transform3D-class (a Matrix4d object), which I us for doing the translation/rotation?

Would it be possible to take a look in your code, especially the Behavior-Class and the Class where you handle the value from JXInput?

Thanks
Flavio


3  Java Game APIs & Engines / Java 3D / How to implement a joystick? on: 2003-05-16 15:14:02
Hi
I wanna programm a helicopter-simulator controlled by joystick. For the joystick, I use te JXInput package (www.hardcode.de) which returns me a value between -1 and 1 for each axis, depending on where the stick is.

Now, I'm not sure what to use: Behavior or Listener. And how can I implement translations/rotations using the Alpha/Interpolator-Classes together with this -1 to 1 -value ?

Really thanks for help !
Flavio
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (26 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (13 views)
2014-07-29 10:59:34

E.R. Fleming (34 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (44 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!