Author Topic: some demos  (Read 3391 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
some demos
« on: April 09, 2012, 02:18:22 AM »
Deleted
« Last Edit: April 11, 2015, 10:27:51 AM by Peter »

Aurel

  • Guest
Re: some demos
« Reply #1 on: April 09, 2012, 03:00:10 AM »
Ok..
First example work little bit slow.
Second work fine  ;)
Third work perfect ( i add some bouncing )  ;)
Code: [Select]
include "win64.inc"

window "Constrain Demo",640,490,2
font 12,24,0,"courier"

function Constrain(single xb,mi,ma) as single
if xb > mi and xb < ma then
   return xb
elseif xb < mi then
   return mi
elseif xb < ma then
   return ma
end if   
end function

single x, y=200, a

While EscKey()=0
ClsColor 0,0,0
'bouncing ball
y=200 + 50 * SIN(x/16)
Oval x,y,30,30,255,0,0
a = Constrain(x,0,Width)
Text 0,0,"constrain: " + str(a,0),255,255,255

IF Constrain(x,0,Width) > 0
   x = x + 0.15
Else
   x=0
END IF 
FlipBuffer
'WaitFor 80
Wend
WinEnd

Aurel

  • Guest
Re: some demos
« Reply #2 on: April 09, 2012, 08:32:15 AM »
Yeah...it's better. :)

Charles Pegge

  • Guest
Re: some demos
« Reply #3 on: April 09, 2012, 01:02:30 PM »
I wanted to create some nice transparent raindrops and waterfalls, but per-pixel alpha blending appears to be broken in GDI. - so transparent sprites are not possible, in Vista at least. Have you found a way round this Peter?

http://msdn.microsoft.com/en-us/library/dd183351(v=vs.85).aspx

http://msdn.microsoft.com/en-us/library/dd183393(v=vs.85).aspx


Charles

PS: This thread confirms the problem on 64 bit Windows Vista and 7.

http://social.msdn.microsoft.com/Forums/en-US/windowscompatibility/thread/34f16345-8b61-4427-b72a-64a42261fa1c/
« Last Edit: April 09, 2012, 01:14:06 PM by Charles Pegge »

Aurel

  • Guest
Re: some demos
« Reply #4 on: April 09, 2012, 02:40:17 PM »
Hi Charles..
I found something here :
http://www.functionx.com/win32/Lesson11.htm

I'm not sure if it help... :-\

Charles Pegge

  • Guest
Re: some demos
« Reply #5 on: April 10, 2012, 02:36:34 AM »

Thanks Aurel,

I've found it can be done with GDIplus, which has no problem with alpha transparency. Once GDIplus is set up, it is quite similar to GDI and can be used without OOP.

Charles

Charles Pegge

  • Guest
Re: some demos
« Reply #6 on: April 10, 2012, 11:35:25 AM »

Thanks Peter. Yes handling pixels restricts the performance.

Let me show what I have so far with GDIplus. (I think you could replace GDI in your windows API without anyone noticing :) )

Charles

Charles Pegge

  • Guest
Re: some demos
« Reply #7 on: April 11, 2012, 05:28:54 AM »

I only set two levels for the Water drop alpha - 0  for the dark surround and 0x60 for the drop itself.

One useful feature of GDIPlus is the ability to change pen color and brush color directly. So no need to create new brushes every time you need to change color.

I also got Fonts working.

Charles

jcfuller

  • Guest
Re: some demos
« Reply #8 on: April 12, 2012, 01:54:33 AM »
FYI
Here is a link I found awhile back when I was researching gdi+ with a number of examples written for Autoit.

http://www.autoitscript.com/forum/topic/87200-some-graphical-examples-using-gdi/

They might be useful to translate to O2?

James
Edit: the link went missing?
« Last Edit: April 13, 2012, 01:27:28 AM by jcfuller »

Charles Pegge

  • Guest
Re: some demos
« Reply #9 on: April 16, 2012, 12:07:06 AM »
Thanks James,

There are hundreds of GDIP functions, I've just picked up the essentials. On the image processing side, it fills in all the functionality missing in OpenGl.

Charles