View Full Version : DXInput1.mouse.y what does this function returns?????
hammer
07-12-2003, 03:50 PM
Hello,
well here is another question from me:
what does DXInput1.mouse.y return?????
cus` surely it is not the y coordinates of the mouse on the form.
And if there is any other function that returns the current position of the mouse pls tell me.
thanks in advance.
Harry Hunt
07-12-2003, 06:19 PM
I haven't used DelphiX in a long time but DirectInput ususally doesn't work with screen coordinates but instead it will give you information about the mouse movement. So that Y-coordinate could be a negative value if the mouse is moved to the left.
You can try putting this in your timer event:
MyCursorPosY := MyCursorPosY + DXInput1.Mouse.Y;
MyCursorPosX := MyCursorPosX + DXInput1.Mouse.X;
DXInput1.Mouse.Y := 0; (Provided that this is not a read-only property)
DXInput1.Mouse.X := 0; (Provided that this is not a read-only property)
hammer
08-12-2003, 06:44 AM
thanks will try it
hammer
09-12-2003, 04:54 PM
well this doesnt work in my case :(
isnt there any other way to get the possition of the mouse cursor?
Traveler
09-12-2003, 05:02 PM
Sure, just use the onMouseMove Event of TDxdraw.
Here's some sample code
var mouseX, mouseY : word;
(...)
procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
begin
dxdraw1.Surface.fill(0);
Dxdraw1.Surface.Canvas.TextOut(10,10,'('+inttostr( mouseX)+','+inttostr(mouseY)+')');
dxdraw1.Surface.Canvas.Release;
dxdraw1.flip;
end;
procedure TForm1.DXDraw1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
mouseX := x;
mouseY := y;
end;
hammer
10-12-2003, 08:38 AM
allready solved the problem with getcursorpos :) thanks anyway :)
One more question how do i draw a rectangle or circle or smth else
becouse with .draw() i doesn't get any results :(
Useless Hacker
10-12-2003, 11:34 AM
You can use the DXDraw.Surface.Canvas to draw ractangles, circles etc. using the GDI functions. Just make sure you call Release when you are done:
with DXDraw.Surface.Canvas do try
Ellipse(10, 10, 50, 50);
// etc.
finally
Release;
end;
hammer
10-12-2003, 04:16 PM
thanks that worked but how can i change the color or make it transparent?
hammer
10-12-2003, 04:27 PM
http://wildebeest.dynup.net/tim/datas/users/34-i_want.bmp
i want to make something like this, the black color is the transparent one. is it possible?[/pascal]
Useless Hacker
10-12-2003, 04:36 PM
Look at the TCanvas documentation in the Delphi help files. You can use Pen.Colour and Brush.Color to set the colour, to make things transparent I think you use Brush.Style := bsClear;
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.