Forum > Beginners

2 important questions i'd like to know their answer please help

<< < (2/2)

DiCri:

--- Quote from: lainz on August 07, 2016, 10:46:58 pm ---About cuestion 1. That's a fake cursor. The real one is invisible and moving around when you move the mouse.

There is a calculation to determine the center of the screen and a virtual ray to pisition the cubes in the fake cursor front.


--- Quote from: Manu12x on August 07, 2016, 06:33:20 pm ---Question number 1:
Using SDL2 Unit with FreeaPascal and i'd like to know if there is a function where the mouse cursor is always in a specific position of the screen and if player moves the mouse, his x and y remains the same. For example Minecraft, in this game the mouse cursor is always on the center!

Question number 2:
Is there an unit on FreePascal for building normal windows applications??(not consoles) .
Tell me if u don't understand anything because i speak italian so i hardly write english. Thanks help me please

--- End quote ---

--- End quote ---
I don' t think it's a fake cursor.. Because if the invisible real mouse cursor goes to the edge of the screen, it can't move anymore so the animation (in minecraft) shoulds stop..

Thaddy:
Actually you should see it as a virtual cursor. In this case the background moves relative to the cursor instead of the cursor moving relative to the background.
It is also really easy to implement too. Noiw I gave you the clue, figure out how ;)

DiCri:

--- Quote from: Thaddy on August 08, 2016, 07:17:55 pm ---Actually you should see it as a virtual cursor. In this case the background moves relative to the cursor instead of the cursor moving relative to the background.
It is also really easy to implement too. Noiw I gave you the clue, figure out how ;)

--- End quote ---
But i already know how to do..but i mean..
If the virtual cursor, moving to right, reaches the edge of the screen, the max of x of the screen, the mouse cursor can't moves anymore and so the background doesn't move because the program sees that the mouse cursor didn't send a increasement of x

lainz:

--- Quote from: Manu12x on August 08, 2016, 08:14:45 pm ---
--- Quote from: Thaddy on August 08, 2016, 07:17:55 pm ---Actually you should see it as a virtual cursor. In this case the background moves relative to the cursor instead of the cursor moving relative to the background.
It is also really easy to implement too. Noiw I gave you the clue, figure out how ;)

--- End quote ---
But i already know how to do..but i mean..
If the virtual cursor, moving to right, reaches the edge of the screen, the max of x of the screen, the mouse cursor can't moves anymore and so the background doesn't move because the program sees that the mouse cursor didn't send a increasement of x

--- End quote ---

You to move the mouse (real cursor), then when the calculations in that frame are gone the mouse position is reseted to the origin (center of the screen). But that don't mean that the cursor you see is always at the center, is only a bitmap to display where the center is and the real cursor is not visible for you.

mrguzgog:

--- Quote from: Manu12x on August 08, 2016, 08:14:45 pm ---But i already know how to do..but i mean..
If the virtual cursor, moving to right, reaches the edge of the screen, the max of x of the screen, the mouse cursor can't moves anymore and so the background doesn't move because the program sees that the mouse cursor didn't send a increasement of x

--- End quote ---

I think you want to know if the user is pushing against the edge of the screen (maximum or minimum x position reached) and if so implement turning or strafing? If so, it's not hard - you can either check if it's at min or max at two consecutive times and apply the movement or you can limit the position of the cursor image to say 1 less than the maximum and apply movement if the limit is exceeded. Hope that's clear? :D

Navigation

[0] Message Index

[*] Previous page

Go to full version