Recent

Author Topic: 2 important questions i'd like to know their answer please help  (Read 5947 times)

DiCri

  • Full Member
  • ***
  • Posts: 151
  • My goal : Build a game
    • http://manueldicriscito.altervista.org/DinoLand.zip
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
I'm a game developer.. Now studying..
Go download my game:
http://manueldicriscito.altervista.org/DinoLand.zip

Thaddy

  • Hero Member
  • *****
  • Posts: 14382
  • Sensorship about opinions does not belong here.
Re: 2 important questions i'd like to know their answer please help
« Reply #1 on: August 07, 2016, 08:06:23 pm »
Ad question nbr 2:

There is the Windows unit.. So you can build Windows GUI applications with FPC.
You can also use KOL... Example is in the wiki.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

DiCri

  • Full Member
  • ***
  • Posts: 151
  • My goal : Build a game
    • http://manueldicriscito.altervista.org/DinoLand.zip
Re: 2 important questions i'd like to know their answer please help
« Reply #2 on: August 07, 2016, 09:34:02 pm »
Ad question nbr 2:

There is the Windows unit.. So you can build Windows GUI applications with FPC.
You can also use KOL... Example is in the wiki.
Ok where i can find windows unit procedures and functions?
I'm a game developer.. Now studying..
Go download my game:
http://manueldicriscito.altervista.org/DinoLand.zip

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11458
  • FPC developer.
Re: 2 important questions i'd like to know their answer please help
« Reply #3 on: August 07, 2016, 09:44:09 pm »
MSDN, and the best guide is the Petzold book.

But is smarter to use the Lazarus IDE with its designer. Much faster to get a decent windows gui.

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: 2 important questions i'd like to know their answer please help
« Reply #4 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.

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

DiCri

  • Full Member
  • ***
  • Posts: 151
  • My goal : Build a game
    • http://manueldicriscito.altervista.org/DinoLand.zip
Re: 2 important questions i'd like to know their answer please help
« Reply #5 on: August 08, 2016, 06:23:08 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.

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
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..
I'm a game developer.. Now studying..
Go download my game:
http://manueldicriscito.altervista.org/DinoLand.zip

Thaddy

  • Hero Member
  • *****
  • Posts: 14382
  • Sensorship about opinions does not belong here.
Re: 2 important questions i'd like to know their answer please help
« Reply #6 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 ;)
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

DiCri

  • Full Member
  • ***
  • Posts: 151
  • My goal : Build a game
    • http://manueldicriscito.altervista.org/DinoLand.zip
Re: 2 important questions i'd like to know their answer please help
« Reply #7 on: August 08, 2016, 08:14:45 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 ;)
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

I'm a game developer.. Now studying..
Go download my game:
http://manueldicriscito.altervista.org/DinoLand.zip

lainz

  • Hero Member
  • *****
  • Posts: 4470
    • https://lainz.github.io/
Re: 2 important questions i'd like to know their answer please help
« Reply #8 on: August 08, 2016, 08:56:11 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 ;)
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

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

  • Jr. Member
  • **
  • Posts: 71
Re: 2 important questions i'd like to know their answer please help
« Reply #9 on: August 11, 2016, 05:18:53 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

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

 

TinyPortal © 2005-2018