FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE
Posted: Tue Sep 12, 2017 08:09 PM
just an Idea

I thinke you must create an array with 36 numbers of roulette and add also the zero

aNumbers:=:= { 0,32,15,19,4,21,2,25,17,34,6,27,13,36,11,30,8,23,10,5,24,16,33,1,20,14,31,9,22,18,29,7,28,12,35,3,26}

control if I insert all numbers


Msginfo( aNumbers[ Int(nDegrees/36)])

I tried but not run ok
I not understood because each times the number is on different position

Code (fw): Select all Collapse
function Spin( oImage )

   local nStep       := 5
   local n
   local nDegrees
   Local aNumbers:= { 0,32,15,19,4,21,2,25,17,34,6,27,13,36,11,30,8,23,10,5,24,16,33,1,20,14,31,9,22,18,29,7,28,12,35,3,26}

   for n := 1 to 1000 / nStep
      oImage:Rotate( nStep )
      SysWait( 0.005 * nStep )
   next

   nDegrees := oImage:nRotate % 360
     Msginfo( aNumbers[ Int(nDegrees/36)])
    * Msginfo( nDegrees)

return nil


any solution ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE
Posted: Sat Sep 16, 2017 01:17 PM

Silvio,

YES,
because the numbers of the wheel are mixed
You can define a array with the numbers

LOCAL aValue[37]

starts from 36 to 6 ( top first step )
each step = 10 degrees

aValue[1] := 6 // first step
aValue[2] := 27
aValue[3] := 13
aValue[4] := 36
aValue[5] := 11
aValue[6] := 30
aValue[7] := 8
aValue[8] := 23
aValue[9] := 10
aValue[10] := 5
aValue[11] := 24
aValue[12] := 16
aValue[13] := 33
aValue[14] := 1
aValue[15] := 20
aValue[16] := 14
aValue[17] := 31
aValue[18] := 9
aValue[19] := 22
aValue[20] := 18
aValue[21] := 29
aValue[22] := 7
aValue[23] := 28
aValue[24] := 12
aValue[25] := 35
aValue[26] := 3
aValue[27] := 26

aValue[28] := 0 // left position

aValue[29] := 32
aValue[30] := 15
aValue[31] := 19
aValue[32] := 4
aValue[33] := 21
aValue[34] := 2
aValue[35] := 25
aValue[36] := 17 // last step of 36 * 10 = 360 degrees
aValue[37] := 34 // reaching the top

The number of the array is the same like the
position of the wheel ( steps are 10 degrees each number ).

regards
Uwe :?:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE
Posted: Sat Sep 16, 2017 10:37 PM
Try

Code (fw): Select all Collapse
#include "fivewin.ch"

Static nHora   := 0
Static nOldH   := 0
Static nImgs   := 12
//----------------------------------------------------------------------------//

function Main()

   local cImage, oImage
   local oDlg

   cImage   := "c:\fwh\bitmaps\alphabmp\flight.bmp"  // your image file

   DEFINE DIALOG oDlg SIZE 500,400 PIXEL TRUEPIXEL

   @ 20, 20 XIMAGE oImage SOURCE cImage SIZE 256,256 OF oDlg

   @ 20,300 BTNBMP PROMPT "Spin" SIZE 160,40 PIXEL OF oDlg FLAT ;
      ACTION Spin( oImage )

   ACTIVATE DIALOG oDlg CENTERED

return nil

//----------------------------------------------------------------------------//

function Spin( oImage )

   local nStep     := 5
   local n
   local nR        := nRandom( nImgs - 1 ) + 1
   nOldH           := nHora
   for n := 1 to 360
      oImage:Rotate( nStep * nR )
      SysWait( 0.008 )
      nR           := nRandom( nImgs - 1 ) + 1
   next
   ? ( nHora += 12 - Int( Mod( oImage:nRotate, 360 ) / ( 360 / nImgs ) ) - nOldH )
return nil

//----------------------------------------------------------------------------//
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE
Posted: Tue Sep 26, 2017 01:49 PM
Cristobal. Output your function the number is not on the same position

please I set the position arrow at left see the picture



How we can use a ball ( game.prg) to animate it on route and stop it on the number ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE
Posted: Tue Sep 26, 2017 01:54 PM
ukoenig wrote:Silvio,

YES,
because the numbers of the wheel are mixed
You can define a array with the numbers

LOCAL aValue[37]

starts from 36 to 6 ( top first step )
each step = 10 degrees

aValue[1] := 6 // first step
aValue[2] := 27
aValue[3] := 13
aValue[4] := 36
aValue[5] := 11
aValue[6] := 30
aValue[7] := 8
aValue[8] := 23
aValue[9] := 10
aValue[10] := 5
aValue[11] := 24
aValue[12] := 16
aValue[13] := 33
aValue[14] := 1
aValue[15] := 20
aValue[16] := 14
aValue[17] := 31
aValue[18] := 9
aValue[19] := 22
aValue[20] := 18
aValue[21] := 29
aValue[22] := 7
aValue[23] := 28
aValue[24] := 12
aValue[25] := 35
aValue[26] := 3
aValue[27] := 26

aValue[28] := 0 // left position

aValue[29] := 32
aValue[30] := 15
aValue[31] := 19
aValue[32] := 4
aValue[33] := 21
aValue[34] := 2
aValue[35] := 25
aValue[36] := 17 // last step of 36 * 10 = 360 degrees
aValue[37] := 34 // reaching the top

The number of the array is the same like the
position of the wheel ( steps are 10 degrees each number ).

regards
Uwe :-)



wich is your function to calculate the number ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE
Posted: Tue Sep 26, 2017 03:26 PM
Silvio.Falconi wrote:Cristobal. Output your function the number is not on the same position

please I set the position arrow at left see the picture

How we can use a ball ( game.prg) to animate it on route and stop it on the number ?


Silvio, you are changed this ?

Code (fw): Select all Collapse
Static nImgs   := 37


Send me your image
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE
Posted: Tue Sep 26, 2017 03:40 PM

yes not run

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion