hiho
A little example 4 2D games with AA
<code>
;Wir laden die BlurLib
;Load lib
Include "blur.bb"
;Wir brauchen Graphics3D, weil Jan's Blur lib auf 3D Basis ist.
;Darum können wir leider nicht Grapics nehmen :-(
;set 3d mode
Graphics3D 800,600,32,2
Create_AA()
Gitter = CreateImage(GraphicsWidth(),GraphicsHeight())
SetBuffer ImageBuffer(Gitter )
For x= 0 To GraphicsWidth() Step 10
For y = 0 To GraphicsHeight() Step 10
Line X-5,y-5,x+5,y+5
Next
Next
;Backbuffer setzten, wie immer
SetBuffer BackBuffer()
;Hauptschleife
Repeat
;Berechnungen
;Math
Faktor#=255.0/GraphicsWidth()
x=x+1
If x> GraphicsWidth() Then x=0
;Objekte Zeichnen, auf die AA angewendet werden soll
;Draw all objekts with AA
DrawBlock gitter,0,0
Text X,GraphicsHeight() Shr 1,"Text mit AA"
Text X+1,GraphicsHeight() Shr 1,"Text mit AA"
; Set the AA Color - very nice effekt :-)
setblurColor X*Faktor#,255-x*Faktor#,255
;Update AA
Update_AA()
;Objekte Zeichen, ohne AA
; Draw all objekts without AA
Text GraphicsWidth()- X,GraphicsHeight() Shr 1,"Text ohne AA"
;Flippt die Buffer
Flip 1
Until KeyHit(1)
Function Create_AA()
;Wichtig, Camera initialisieren
;Init the Cam
Cam=CreateCamera()
CameraClsMode cam,0,1
;Blur an der Camera erstellen
;Create AA parental to the cam
CreateBlur(Cam,4,0.6);Erstellt AA Bild, und setzt Unscharfmaske auf 0.6 pixel
SetBlurUpdateTime(0);Setzt die Update rate (Bei AA am besten immer 0)
End Function
Function Update_AA()
;Updates the 3D scene
RenderWorld
;Updates Blur
UpdateBlur(0.48)
End Function
</code>
Theoretiks:
we use 3 Layers:
_______________ 1- 2D Layer
_______________ 2- 3D Layer
_______________ 3- 2D Layer
the 3D layer is over the 2D layer --> 3D effekts on the 2D layer!
http://jankuhnert.stormsoft.de/files/AA%20in%202D%20Games.rar have a lot of fun