Because i am wired with fractal antennas here is brand new Minkowski Islands fractal...
include "awinh.inc"
#lookahead
INT win
'GLOBALS for drawing to DC --------------------------------------------
INT hdc, hdcMem, hbmMem, oldBmp, oldBrush, oldPen, oldFont, fColor,bColor
INT textX,textY,hBrush
INT ww,hh
INT wstyle = WS_MINMAXSIZE Or WS_CLIPCHILDREN
'create main window ****************************************************
win = SetWindow("Minkowski",40,40,600,550,0,wstyle)
InitDrawing(win)
sys k, posx, posy
goxy (20, 20)
turnright(90)
Function Mink(sys x, t) as sys
if t > 0.2
t=t-1
x=x/3
TextColor win,RGB(x,130,190)
Mink(x, t)
turnright(90)
Mink(x, t)
turnleft(90)
TextColor win,RGB(150,x,180)
Mink(x, t)
turnleft(90)
Mink(x,t)
turnright(90)
Mink(x, t)
else
forward(x*6)
end if
End Function
for x = 1 to 4
Mink(140,4)
turnright(90)
next
'------------------------------------------------------------------------
Wait()
'------------------------------------------------------------------------
Function WndProc (byval hwnd as long,byval wMsg as long, byval wParam as long,byval lparam as long) as long callback
Select hwnd
'>>>>>>>>>>>>>>>>>>>>>>>>>
Case win
'>>>>>>>>>>>>>>>>>>>><<<
Select wMsg
'----------------------------
CASE WM_PAINT
BitBlt(hDC, 0, 0, ww, hh, hdcMem, 0, 0, SRCCOPY)
'----------------------------
Case WM_CLOSE
If win <> 0
CleanUp()
CloseWindow(win)
EndProgram
End If
End Select
End Select
Return Default
End Function
'-------------------------------------------------------------------------
'================================================
SUB InitDrawing(byval wnd as INT)
'INT ww,hh
''get current size of window
GetSize(wnd,0,0,ww,hh)
'get window DC
hdc=GetDC(wnd)
hdcMem = CreateCompatibleDC(0)
hbmMem = CreateCompatibleBitmap(hdc, ww, hh)
oldBmp = SelectObject( hdcMem, hbmMem )
oldBrush = SelectObject(hdcMem, CreateSolidBrush( RGB(231,223,231)) )
oldPen = SelectObject(hdcMem, CreatePen(PS_SOLID,1,RGB(231,223,231)))
'fill rectangle memDC with brush color
FillRect ( hdcMem,rc, oldBrush)
SetTextColor( hDC,RGB(0,0,0))
SetBkColor( hDC, RGB(231,223,231))
'blit to memDC
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wnd, hdc)
End SUB
'=================================================
SUB TextColor (wID as INT,byval frontColor as sys)
hdc = GetDC(wID)
sys bColor
fColor=frontColor
bColor = RGB(231,223,231)
SetTextColor( hDC, frontColor)
SetBkColor( hDC, bColor)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'=================================================
Sub TextOn( int wnd,sys x, y, string txt)
'INT ww,hh
hdc=GetDC(wnd)
GetSize(wnd,0,0,ww,hh)
TextOut sys_hdc,x,y,txt,Len(txt)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC(wnd,Hdc)
End Sub
'=================================================
SUB LineXY (wID as INT,Lx as INT,Ly as INT,Lx1 as INT,Ly1 as INT)
hdc = GetDC(wID)
GetSize(wID,0,0,ww,hh)
SelectObject(hdc, CreatePen(PS_SOLID,1,fColor))
MoveToEx hdc,Lx,Ly,Byval 0
LineTo hdc,Lx1,Ly1
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'=================================================
SUB Pset (wID as int , px as int ,py as int)
hdc = GetDC(wID)
'GetSize(wID,0,0,ww,hh)
SetPixel ( hdc, px, py, fColor)
BitBlt(hDCmem, 0, 0, ww, hh, hdc, 0, 0, SRCCOPY)
ReleaseDC( wID, hdc)
End SUB
'//////////////////////////////////////////////
SUB CleanUp
DeleteDC(hdcMem)
DeleteObject(SelectObject(hdcMem, oldBrush))
DeleteObject(SelectObject(hdcMem, oldPen))
DeleteObject(SelectObject(hdcMem, oldBmp))
End SUB
'/////////////////////////////////////////////
'************************************
' TURTLE FUNCTIONS
'************************************
Function forward(sys d) as sys
sys a, b, x, y
a = sin(k * pi / 180) * d
b = cos(k * pi / 180) * d
x = posx + a
y = posy - b
LineXY (win,posx, posy, x, y)
posx = x
posy = y
End Function
'------------------------------------------
Function backward(sys d) as sys
sys a, b, x, y
a = sin(k * pi / 180) * d
b = cos(k * pi / 180) * d
x = posx - a
y = posy + b
LineXY(win,posx, posy, x, y)
posx = x
posy = y
End Function
'-------------------------------------------
Function turnright(sys z) as sys
k = k + z
if k > 360
k = k - 360
end if
if k < 0
k = k + 360
end if
End Function
'---------------------------------------------
Function turnleft(sys z) as sys
k = k - z
if k > 360
k = k - 360
end if
if k < 0
k = k + 360
end if
End Function
'----------------------------------------------
Function penup(sys drawing) as sys
return drawing
End Function
'----------------------------------------------
Function goxy(sys zx, zy) as sys
posx=zx
posy=zy
End Function
'----------------------------------------------
X