Page 1 of 2

ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Fri Sep 01, 2017 6:02 pm
by joseluisysturiz
Greetings, I am presented to realize what you see in these video, a roulette wheel of fortune. Some idea of what tools to use or where to start for this job.? thanks in advance, regards ...

https://www.youtube.com/watch?time_cont ... LO0V5LlauM

https://www.youtube.com/watch?v=342ZRq8Q9ZE

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 2:01 am
by nageswaragunupudi
This sample demonstrates how to implement Spinning of an image.
Please test and modify to suit your requirements.
Code: Select all  Expand view
#include "fivewin.ch"

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

function Main()

   local cImage, oImage
   local oDlg

   cImage   := "c:\fwh\bitmaps\alphabmp\widgets.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

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

return nil

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

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 4:54 am
by joseluisysturiz
Mr. NAGE, simplemente ESPECTACULAR, muchas gracias, es lo que necesitaba, no sabia seria tan facil, saludos, gracias... :shock:

Mr. NAGE, simply SPECTACULAR, thank you very much, it's what I needed, it would not be so easy, greetings, thanks... :shock:

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 5:37 am
by Otto
Dear Mr. Rao,
thank you. This is really a nice sample.
Best regards,
Otto

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 11:40 am
by ukoenig
I added a dialog-brush and tested the alpha-channel

Image

Code: Select all  Expand view

#include "fivewin.ch"

function Main()
local cImage, oImage
local oDlg

cImage   := "..\bitmaps\alphabmp\widgets.bmp"  // your image file

DEFINE DIALOG oDlg SIZE 500,400 PIXEL TRUEPIXEL TRANSPARENT  

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

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

ACTIVATE DIALOG oDlg CENTERED ;
ON INIT BuildBrush( oDlg )

return nil

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

function BuildBrush( oDlg )
local oImage, oBrush, aRect := oDlg:GetRect()

DEFINE IMAGE oImage FILENAME "..\bitmaps\backgrnd\blustone.bmp"

oBrush   := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap,  aRect[4], aRect[3], .T. ) )  // 1 = stretch, 2 : fitoutside, 3:fitinside
oImage:End()
oDlg:SetBrush( oBrush )
oBrush:End()

return nil

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

function Spin( oImage )
local nStep       := 5
local n

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

return nil
 


Added to the sample-collector

Image

regards
Uwe :D

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 5:34 pm
by joseluisysturiz
The spin of the roulette was great, now I have a very important detail, I will place an arrow that indicates or point the number that is selected, my question is, how the roulette is a complete image, how can I get the value selected.? I do not know how to get the selected value in the arrow ... I do not know if I was able to explain, thanks for the suggestions and ideas on how to get the selected result ... greetings, thanks ... :shock:

El giro de la ruleta quedo buenisimo, ahora se me presenta un detalle muy importante, voy a colocar una flecha que me indique o señale el numero que queda seleccionado, mi pregunta es, como la ruleta es una imagen completa, como puedo obtener el valor seleccionado.? se me ocurre dividir la imagen por angulos, pero no se como obtener el valor que quede seleccionado en la flecha... no se si me supe explicar, gracias por las sugerencias e ideas de como obtener el resultado seleccionado...saludos, gracias... :shock:

VIEW IMAGE / VER IMAGEN

[img]
http://subirimagen.me/uploads/20170902123213.jpg
[/img]

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 8:21 pm
by Enrico Maria Giordano
Maybe you can get the number from the current rotation angle?

EMG

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 8:29 pm
by nageswaragunupudi
Do not put the arrow inside ximage rectangle. Place it as separate bitmap on the right side of ximage.
Visually user can read the number
Through program you should derive the number from oImage:nRotation

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 10:08 pm
by ukoenig
Converted and repainted to a real alphablended PNG
maybe You like it

http://www.pflegeplus.com/IMAGES/Roulette.png

regards
Uwe :D

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 11:35 pm
by joseluisysturiz
Enrico Maria Giordano wrote:Maybe you can get the number from the current rotation angle?

EMG


That is the point, in the class how to get the value of rotation, since instead of numbers, they will be some images, which each one will be in a certain angle, what I need to know is when the image is marked by the arrow, know what image it is, since this is a draw and automatically the system must say and display the name of the image indicated by the arrow ... the image you place is an example when you are finished spinning the roulette, saludos, gracias... :shock:

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 11:39 pm
by joseluisysturiz
nageswaragunupudi wrote:Do not put the arrow inside ximage rectangle. Place it as separate bitmap on the right side of ximage.
Visually user can read the number
Through program you should derive the number from oImage:nRotation


Mr. Nage, the arrow as you say put it out of the image that rotates, in this case the roulette, I just put it as an example, what I need to know is what is the image or number that ends indicated by the arrow when the roulette stops, since the system automatically must say and show the image that I won or selected, the user will only rotate the roulette, I will review what he says of oImage: nRotation in class, greetings, thanks. .. :shock:

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Sat Sep 02, 2017 11:41 pm
by joseluisysturiz
ukoenig wrote:Converted and repainted to a real alphablended PNG
maybe You like it

http://www.pflegeplus.com/IMAGES/Roulette.png

regards
Uwe :D


Thank you Mr. UWE, I will try the image you converted, this image should be placed on or under a brush, and I will mount a complete image to understand what I want to do, greetings, thanks ...

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Mon Sep 11, 2017 10:10 pm
by joseluisysturiz
If the calculation of the degree of 360 / n is that of the division of the divisions, the que no se hacer es como determines the position of the figure or the degree resulting in an associado to dicha figure, at the same time it refiero y no se que propiedad de la clase me devuelve el grado resulting ya que la roulette puede llegar to give varias vueltas antes de detenerse como es logico que suceda ... alguna idea de como obtengo en la clase and the resultant result. saludos...gracias... :shock:

Se como calcular lo de los grados que es 360 / n que es la cantidad de diviciones, lo que no se hacer es como determinar la posicion de la figura o el grado resultando asociado a dicha figura, a eso me refiero y no se que propiedad de la clase me devuelve el grado resultante ya que la ruleta puede llegar a dar varias vueltas antes de detenerse como es lo logico que suceda...alguna idea de como obtengo en la clase el grado resultante.? saludos...gracias... :shock:

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Tue Sep 12, 2017 12:40 am
by nageswaragunupudi
oImage:nRotate --> Degrees

nDegrees := oImage:nRotate % 360

Re: ROULETTE OF THE FORTUNE - ROTATE ROUND PICTURE

PostPosted: Tue Sep 12, 2017 3:21 am
by joseluisysturiz
nageswaragunupudi wrote:oImage:nRotate --> Degrees

nDegrees := oImage:nRotate % 360


Ready, now associate the numbers to the degrees ... greetings..thanks... :shock: