Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Track Selecting with Image of Arrow`s

Author
Message
Stig Design Stig Magne
20
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 23rd Aug 2013 23:40 Edited at: 23rd Aug 2013 23:42
Hello
Long time since i last whas on forum

am re-coding in dbPro and am trying to make a simple
Track selecting via 2 images (arrow Left - Arrow Right)
i have so far gotten button`s to work and sort of selecting


so it has 4 Track`s and delay of 100 if i didnt do it then it youst skipped XD
but now am not surew how i can get it to detect exactely what track Number it is on and the info for it

eks Track 1
info1: bla bla
Length1 :bla bla

Track 2
info2: bla bla
Length2 :bla bla
i think my next Prev buttons is kind of old school and not optimized

ps Sorry for the english am Norwegian& i have Dyselexia
if some one has idea on how to structure it or re code it let me know please added immage as attachment.

**StigDesign** cheap 3D Modell Pack`s And Music at www.StigDesign.com
soon other aplication`s Software`s Game`s
Stig Design Stig Magne
20
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 24th Aug 2013 00:05
i tested
added

Before the loop

then i added on back arrow to Track 1

but then i got text over text problem when i added this as for track 2 aswell XD so guess i need to add cls some where.

**StigDesign** cheap 3D Modell Pack`s And Music at www.StigDesign.com
soon other aplication`s Software`s Game`s
Stig Design Stig Magne
20
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 24th Aug 2013 00:15
Sorry for 3rd Post but now it seems to work

Problem now is bug about if i left click and hold it 1 sec or 2 sec it skips Track`s :s

**StigDesign** cheap 3D Modell Pack`s And Music at www.StigDesign.com
soon other aplication`s Software`s Game`s
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 24th Aug 2013 03:19 Edited at: 24th Aug 2013 03:20
A way to stop mouseclicks (instead of using sleep) is to check if the mouse isn't being pressed the next frame. A easy way to do this is store the last frames mouseclick and this frames one like so:

_oldMouseClick = _mouseClick
_mouseClick = mouseclick()


If we want to check for a click we write:

if _mouseClick <> 0 and _oldMouseClick = 0

The reason for this is once you click and hold, oldMouseClick = 1 then next frame(or this frame is you write this underneath the if statement) so this line will skip whatever is in the middle next frame.

Secondly, you only need to check if the mouse is over the button once, then work out what to do. For this it's simply we add 1 or -1 to the current track then check if it's beyond it's limit and wrap it to it's negative or positive max. So:

// wrapping
if currentTrack > lastTrack then currentTrack = firstTrack

And example of all of this:


"Get in the Van!" - Van B
Stig Design Stig Magne
20
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 24th Aug 2013 17:45
Sasuke: Thank you for the Post& help. i will read it now

**StigDesign** cheap 3D Modell Pack`s And Music at www.StigDesign.com
soon other aplication`s Software`s Game`s
Stig Design Stig Magne
20
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 24th Aug 2013 18:03 Edited at: 24th Aug 2013 18:51
Sasuke: cool. it works. Greate
i got added now hidden button at 64 to 128 at x& y (youst quick&dirty
so now when i click next or prew and the click hiden button it shows text what number i had selected correctly
1 litle thing: id detects left right and scroll click. how can i get it to youst react to left click?
code

Thank you werry Mutch

ps. i must admit. think i have taken too big bite sort of or to hard project maby.but am locked to get it working without quitting i say this cuz. while back i have made a simple 3D car game/driving but it whas in db classic and track selecting there whas extremly simple. it had track list on left side and when mouse whas ower a track text changed colour and if pressed it had a goto command for loading so.
and now after long breake from dbpro i have tested from time to time but not done enny project`s youst testing simple commands to see if i get working. and this project. i did think it shudnt be to hard since menu is based from Need for Speed 2 or 2se
i know the driving will be hard but. i had project while back about Need for Speed 3 but i started from different dirrection i started with on how to recreate the tracks btw i cheked your old 2010 tread about menu. and i had made same fault as you stated peopeles alott does (about the mouse click)XD Greate Tread& i cheked your youtube video about curve editor. impressive

**StigDesign** cheap 3D Modell Pack`s And Music at www.StigDesign.com
soon other aplication`s Software`s Game`s
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 24th Aug 2013 19:13
Are you asking how do you just detect the left click?

This is how: If mouseclick() = 1

And cheers for the compliments, really should of finished that menu thread

"Get in the Van!" - Van B
Stig Design Stig Magne
20
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 24th Aug 2013 20:00 Edited at: 24th Aug 2013 20:09
oh ok so i change
// store mouse data
_mouseX = mousex()
_mouseY = mousey()
_oldMouseClick = _mouseClick
_mouseClick = mouseclick()

To
// store mouse data
_mouseX = mousex()
_mouseY = mousey()
_oldMouseClick = _mouseClick
_mouseClick = mouseclick() = 1
i think?
(guess i shud have test it but i have been bussy in rl sofar.
Yes you shud hopefully as Sticky aswell for others to read&learn

**StigDesign** cheap 3D Modell Pack`s And Music at www.StigDesign.com
soon other aplication`s Software`s Game`s
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 24th Aug 2013 20:15
Not quite, rather...

_mouseClick = mouseclick()

This stores what click state the mouse is in. When we want to just check if the left click is being pressed we use:

if _mouseClick = 1

So replace this bit:

if _mouseClick = 1 and _oldMouseClick = 0

"Get in the Van!" - Van B
Stig Design Stig Magne
20
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 24th Aug 2013 20:28
now i see Thank You

**StigDesign** cheap 3D Modell Pack`s And Music at www.StigDesign.com
soon other aplication`s Software`s Game`s

Login to post a reply

Server time is: 2026-07-07 00:09:19
Your offset time is: 2026-07-07 00:09:19