Author Topic: Mysterious  (Read 3976 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Mysterious
« on: August 01, 2011, 06:25:50 AM »
Hi Charles,

for some experiments i have made a small windows enviroment.
without curlicue and so.

but there is  an obscure phenomenon, direct mysterious and strange.
that program  increased a number and after a short time, the number will be blinking.   :D

what is Oxygenbasic doing here ?  do you know this secret ?

i am planning some pixel experiments, like mirror, spinning, scaling  and so on.
that all for an own  graphics engine.

Code: [Select]
IndexBase 0
Include "window.h"

sys x, y, a, hdc, hWnd
sys number

hWnd= Window "Hallo",640,480,ws_overlapped
hdc = GetDC hWnd

'While WinExit=0
'SetFont 16,32,0,"courier"
'For x=0 To 640 Step 20
'For y=0 To 480 Step 36
'Text "*",x,y,RGB Rand(64,255),Rand(64,255),Rand(64,255)
'Next: Next
'SetFont 18,64,700,"courier"
'Text "HAPPY LINUX",210,200,RGB 255,199,240
'DoEvents
'WaitFrames 14
'Wend
'WinEnd

SetFont 38,128,800,"times"

While WinExit=0
cls
Text "WHAT'S THAT",0,0,0xFFC8C8
Text number,210,160, 255 RGB Rand(0x40,0xFF),Rand(0x40,0xFF),Rand(0x40,0xFF)
number +=1
DoEvents
WaitTime 2
Wend
WinEnd


[attachment deleted by admin]

Charles Pegge

  • Guest
Re: Mysterious
« Reply #1 on: August 01, 2011, 10:23:25 AM »

Hi Peter,

I noticed it stopped blinking whenever the mouse moved across. So..

InvalidateRect hWnd,0,0

Code: OxygenBasic
  1.  
  2. IndexBase 0
  3. Include "window.h"
  4.  
  5. sys x, y, a, hdc, hWnd
  6. sys number
  7.  
  8. hWnd= Window "Hallo",640,480,ws_overlapped
  9. hdc = GetDC hWnd
  10.  
  11. 'While WinExit=0
  12. 'SetFont 16,32,0,"courier"
  13. 'For x=0 To 640 Step 20
  14. 'For y=0 To 480 Step 36
  15. 'Text "*",x,y,RGB Rand(64,255),Rand(64,255),Rand(64,255)
  16. 'Next: Next
  17. 'SetFont 18,64,700,"courier"
  18. 'Text "HAPPY LINUX",210,200,RGB 255,199,240
  19. 'DoEvents
  20. 'WaitFrames 14
  21. 'Wend
  22. 'WinEnd
  23.  
  24. SetFont 38,128,800,"times"
  25.  
  26. While WinExit=0
  27. cls
  28. Text "WHAT'S THAT",0,0,0xFFC8C8
  29. Text number, 300, 120, RGB Rand(0x40,0xFF),Rand(0x40,0xFF), Rand(0x40,0xFF)
  30. InvalidateRect hWnd,0,0
  31. number +=1
  32. DoEvents
  33. WaitTime 2
  34. Wend
  35. WinEnd
  36.  

Charles

Peter

  • Guest
Re: Mysterious
« Reply #2 on: August 01, 2011, 11:48:15 AM »
Thanks Charles,

But this is not right solution!
I have found what I have forgot. That is similar what you have done.

Middles in the source code! Nobody knows such a thing.   :D

Code: [Select]
IndexBase 0
Include "window.h"

sys x, y, a, hdc, hWnd
sys number

hWnd= Window "Hallo",640,480,ws_overlapped
hdc = GetDC hWnd


While WinExit=0
SetFont 16,32,0,"courier"
For x=0 To 640 Step 20
For y=0 To 480 Step 36
Text "*",x,y,RGB Rand(64,255),Rand(64,255),Rand(64,255)
Next: Next
SetFont 18,64,700,"courier"
Text "HAPPY LINUX",210,200,RGB 255,199,240
DoEvents
WaitTime 10
Wend
WinEnd
 

[attachment deleted by admin]

Peter

  • Guest
Re: Mysterious
« Reply #3 on: August 01, 2011, 12:52:34 PM »
I found yet an error.   >:(

Code: [Select]
Function Count() as long
Return number +=1   
End Function

[attachment deleted by admin]

Charles Pegge

  • Guest
Re: Mysterious
« Reply #4 on: August 02, 2011, 12:36:49 AM »
Hi Peter,

'Return' cannot evaluate assignment statements, only expressions

This is not perfect but has the desired action

Code: OxygenBasic
  1. sys number
  2.  
  3. Function Count() as long
  4. Return ++number+0
  5. End Function
  6.  
  7.  
  8. print count()
  9. print count()
  10.  
  11.  

I will see if I can improve on this.

Charles

Peter

  • Guest
Re: Mysterious
« Reply #5 on: August 02, 2011, 02:05:20 AM »
Hi Charles,

Code: [Select]
I will see if I can improve on this.
That is not necessary!

Code: [Select]
Function Count() as long
Return number = Number +1  
End Function

Code: [Select]
IndexBase 0
Include "window.h"

sys x, y, a, hdc, hWnd
sys number

hWnd= Window "Hallo",640,480,ws_overlapped
hdc = GetDC hWnd

Function Count() as long
Return number = Number +1   
End Function


While WinExit=0
cls
count
SetFont 18,64,700,"courier"
Text "RETURN, A GOOD CHOICE",110,200,RGB 255,199,240
Text number,300,250,0xFFC8C8
DoEvents
WaitTime 10
Wend
WinEnd
« Last Edit: August 02, 2011, 02:08:03 AM by peter »

Charles Pegge

  • Guest
Re: Mysterious
« Reply #6 on: August 02, 2011, 03:39:28 AM »
Peter,

This was very easy to fix


function count() as long
return ++number
end function


I will include it in the next update.

Charles

Always looking out for anomalies

Peter

  • Guest
Re: Mysterious
« Reply #7 on: August 02, 2011, 04:40:14 AM »
I will do.     :D