QB64.org Forum

Active Forums => Programs => Topic started by: Aurel on February 10, 2021, 03:05:43 pm

Title: MayaMotor ...how to swap buffers?
Post by: Aurel on February 10, 2021, 03:05:43 pm
Hi
here is a program made  by me ,Ed Davis translated to QB64...
but i don't know how to get proper effect ?
I am using SWAP function in my interpreter so...
is there something similar in QB64...
i hope that B+ have solution(option)....

Code: QB64: [Select]
  1. 'Translated from: maya_motor in micro(A)
  2. SCREEN _NEWIMAGE(600, 600, 32)
  3. color _rgb(200,220,250), _rgb(0, 0, 0)
  4. pi = 3.14
  5. level = 300 : angle = 0
  6. x1=200 : y1=200
  7.  
  8.  
  9. for n = 0 to 1999
  10.   angle = angle - 20
  11.    for i = 1 to 99
  12.      d=9
  13.      x2 = x1 + cos(angle/d) * (d*10)
  14.      y2 = y1 + sin(angle*d) * (d*10)
  15.      rr=200-d*10 : gg=190-d : bb= 220
  16.      color _rgb(rr,gg,bb)
  17.      'Line x2,y2,x1,y1
  18.      circle (x2,y2),d
  19.      angle = angle + 20
  20.      d=d-1
  21.      _delay .01
  22.    next
Title: Re: MayaMotor ...how to swap buffers?
Post by: odin on February 10, 2021, 03:44:50 pm
Not valid QB64 code.
Title: Re: MayaMotor ...how to swap buffers?
Post by: Aurel on February 10, 2021, 03:45:28 pm
now is valid...sorry i made mistake,...
Title: Re: MayaMotor ...how to swap buffers?
Post by: bplus on February 10, 2021, 03:52:10 pm
Hi
here is a program made  by me ,Ed Davis translated to QB64...
but i don't know how to get proper effect ?
I am using SWAP function in my interpreter so...
is there something similar in QB64...
i hope that B+ have solution(option)....

Code: QB64: [Select]
  1. 'Translated from: maya_motor in micro(A)
  2. SCREEN _NEWIMAGE(600, 600, 32)
  3. color _rgb(200,220,250), _rgb(0, 0, 0)
  4. pi = 3.14
  5. level = 300 : angle = 0
  6. x1=200 : y1=200
  7.  
  8.  
  9. for n = 0 to 1999
  10.   angle = angle - 20
  11.    for i = 1 to 99
  12.      d=9
  13.      x2 = x1 + cos(angle/d) * (d*10)
  14.      y2 = y1 + sin(angle*d) * (d*10)
  15.      rr=200-d*10 : gg=190-d : bb= 220
  16.      color _rgb(rr,gg,bb)
  17.      'Line x2,y2,x1,y1
  18.      circle (x2,y2),d
  19.      angle = angle + 20
  20.      d=d-1
  21.      _delay .01
  22.    next

This code does work in dev 1.5 as of 3:47 edit
 


Nice little snip.

@Aurel What is it you want it to do? Swap what?
Title: Re: MayaMotor ...how to swap buffers?
Post by: bplus on February 10, 2021, 04:36:21 pm
Here's a mod:
Code: QB64: [Select]
  1. 'Translated from: maya_motor in micro(A)   mod by b+ 2021-02-10
  2. Screen _NewImage(400, 400, 32)
  3. _Delay .25
  4.  
  5. level = 300: angle = 0: x1 = 200: y1 = 200
  6.     n = n + 1: angle = angle - 20
  7.     For i = 1 To 99
  8.         Line (0, 0)-(_Width, _Height), &H08000000, BF
  9.         d = 9
  10.         x2 = x1 + Cos(angle / d) * (d * 10)
  11.         y2 = y1 + Sin(angle * d) * (d * 10)
  12.         rr = 255 - i * 2: gg = 255: bb = i * 2
  13.         Circle (x2, y2), d, _RGB32(rr, gg, bb)
  14.         angle = angle + 20
  15.         d = d - 1
  16.         _Limit 480
  17.     Next
  18.  
  19.  
Title: Re: MayaMotor ...how to swap buffers?
Post by: Aurel on February 10, 2021, 05:45:53 pm
Quote
What is it you want it to do? Swap what?

as you probably know i use gdi ...so i swap back buffer to front

like this...





Title: Re: MayaMotor ...how to swap buffers?
Post by: bplus on February 10, 2021, 05:48:27 pm
@Aurel checkout pcopy in Wiki, the old way of flipping screens.

wiki:
Quote
The QB64 _DISPLAY statement can also be used to stop screen flicker without page flipping or CLS and is the recommended practice.