Buchempfehlung
Windows-Programmierung. Das Entwicklerhandbuch zur WIN32-API
Windows-Programmierung. Das Entwicklerhandbuch zur WIN32-API
"Der" Petzold, das über 1000 Seiten starke Standardwerk zum Win32-API - besonders nützlich u. a. bei der GUI-Programmierung in FreeBASIC! [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

eiphonehelloworld.bas

Uploader:MitgliedThePuppetMaster
Datum/Zeit:19.08.2013 00:48:34

dim shared scw as integer = 480
dim shared sch as integer = 640

type btntype
    x       as integer
    y       as integer
    w       as uinteger
    h       as uinteger
    title   as string
    bgcol   as uinteger
end type
type wintype
    vis     as integer
    x       as integer
    y       as integer
    w       as uinteger
    h       as uinteger
    title   as string
    text    as string
    bgcol   as uinteger
    btn(255) as btntype
end type
dim shared wind() as wintype
dim shared winc as integer
dim shared tmaus as any ptr
dim shared tmausx as double
dim shared tmausy as double



sub dodraw()
screenlock()
line (0, 0)-(scw, sch), &HFF000000, BF
for x as integer = 1 to winc
    with wind(x)
        if .vis = 1 then
            line (.x, .y)-(.x + .w, .y + .h), .bgcol, BF
            line (.x, .y)-(.x + .w, .y + 20), &HFF9999FF, BF
            line (.x, .y)-(.x + .w, .y + 20), &HFF999999, B
            line (.x, .y)-(.x + .w, .y + .h), &HFF999999, B
            draw string (.x + 6, .y + 6), .title, &HFF000000
            draw string (.x + 6, .y + 26), .text, &HFFFFFFFF
            line (.x + 1, .y + 1)-(.x + .w - 1, .y + .h - 1), &HFFAAAAAA, B
            for y as integer = 1 to 255
                with .btn(y)
                    if .x > 0 then
                        line (wind(x).x + .x, wind(x).y + .y)-(wind(x).x + .x + .w, wind(x).y + .y + .h), .bgcol, BF
                        draw string (wind(x).x + .x + 6, wind(x).y + .y + 6), .title, &HFF000000
                        line (wind(x).x + .x, wind(x).y + .y)-(wind(x).x + .x + .w, wind(x).y + .y + .h), &HFF999999, B
                    end if
                end with
            next
        end if
    end with
next
put (tmausx, tmausy), tmaus, ALPHA
screenunlock()
end sub



sub mgoto(x as integer, y as integer)
dim tdistx as double = (x - tmausx)
dim tdisty as double = (y - tmausy)
dim tdist as integer = sqr(tdistx * tdistx + tdisty * tdisty)
dim tstepx as double = tdistx / tdisty * ((tdist \ 20) + 1)
dim tstepy as double = 1 * ((tdist \ 20) + 1)
if tdistx > tdisty then
    tstepx = 1 * ((tdist \ 20) + 1)
    tstepy = tdisty / tdistx * ((tdist \ 20) + 1)
end if
for z as integer = 1 to iif(tdistx > tdisty, tdistx, tdisty) / ((tdist \ 20) + 1)
    tmausx += tstepx
    tmausy += tstepy
    if (cint(tmausx) = x) and (cint(tmausy) = y) then exit for
    dodraw()
    sleep 30, 1
next
tmausx = x
tmausy = y
dodraw()
end sub



screenres scw, sch, 32
tmaus = imagecreate(16, 16, 0, 32)
line tmaus, (0, 0)-(0, 10), &HFF888888
line tmaus, (0, 0)-(10, 0), &HFF888888
line tmaus, (0, 10)-(4, 8), &HFF888888
line tmaus, (10, 0)-(8, 4), &HFF888888
line tmaus, (4, 8)-(11, 15), &HFF888888
line tmaus, (8, 4)-(15, 11), &HFF888888
line tmaus, (15, 11)-(11, 15), &HFF888888
paint tmaus, (1, 1), &HFFFFFFFF, &HFF888888

winc = 4
redim wind(winc) as wintype
with wind(1)
    .vis = 1
    .w = scw
    .h = sch
    .x = 0
    .y = 0
    .title = "EIPhone"'
    .bgcol = &HFF000033
    with .btn(1)
        .bgcol = &HFFCCCCFF
        .x = 15
        .y = 30
        .w = 36
        .h = 36
        .title = "IDE"
    end with
end with
with wind(2)
    .w = scw - 50
    .h = sch - 50
    .x = 25
    .y = 25
    .title = "EasyFBEdit - noname.bas"
    .bgcol = &HFFCCCCCC
end with
with wind(3)
    .vis = 0
    .w = 300
    .h = 200
    .x = 80
    .y = 80
    .title = "noname.exe"
    .bgcol = &HFF000000
end with
with wind(4)
    .vis = 0
    .w = scw
    .h = 200
    .x = 0
    .y = sch - .h
    .title = "KeyPad"
    .bgcol = &HFF999999
    for x as integer = 0 to 25
        with .btn(x + 1)
            .bgcol = &HFFCCCCCC
            .x = 15 + (x mod 11) * 40
            .y = 30 + (x \ 11) * 40
            .w = 36
            .h = 36
            .title = Chr(65 + X)
        end with
    next
    with .btn(27)
        .bgcol = &HFFCCCCCC
        .x = 15 + (26 mod 11) * 40
        .y = 30 + (26 \ 11) * 40
        .w = 40 * 6 - 4
        .h = 36
    end with
    with .btn(28)
        .bgcol = &HFFCCCCCC
        .x = 15 + (32 mod 11) * 40
        .y = 30 + (32 \ 11) * 40
        .w = 40
        .h = 36
        .title = """"
    end with
    with .btn(29)
        .bgcol = &HFFCCCCCC
        .x = 15 + (33 mod 11) * 40
        .y = 30 + (33 \ 11) * 40
        .w = 40 * 2 - 4
        .h = 36
        .title = "RUN"
    end with
end with

dodraw()
sleep 1000, 1

mgoto(30, 45)
wind(1).btn(1).bgcol = &HFFFFCCCC: dodraw(): sleep 100, 1
wind(1).btn(1).bgcol = &HFFCCCCFF: dodraw(): sleep 100, 1
wind(2).vis = 1: dodraw(): sleep 100, 1
sleep 500, 1

mgoto(100, 200)
wind(2).bgcol = &HFFFFCCCC: dodraw(): sleep 100, 1
wind(2).bgcol = &HFFCCCCCC: dodraw(): sleep 100, 1
wind(4).vis = 1: dodraw()

dim tx as integer
dim ty as integer
dim tz as integer
Dim TSource as String = UCase("Print ""hello world""")
for x as uinteger = 1 to Len(TSource)
    select case TSource[x - 1]
        Case 32: tz = 27
        Case 34: tz = 28
        Case 65 to 90: tz = TSource[x - 1] - 64
    end select
    tx = wind(4).x + wind(4).btn(tz).x + 10
    ty = wind(4).y + wind(4).btn(tz).y + 10
    mgoto(tx, ty)
    wind(4).btn(tz).bgcol = &HFFFFCCCC: dodraw(): sleep 100, 1
    wind(4).btn(tz).bgcol = &HFFCCCCCC: dodraw(): sleep 100, 1
    select case tz
        case 27: wind(2).text += " "
        case 28: wind(2).text += """"
        Case 0 to 26: wind(2).text += chr(tz + 64)
    End Select
    dodraw()
next
tx = wind(4).x + wind(4).btn(29).x + 10: ty = wind(4).y + wind(4).btn(29).y + 10
mgoto(tx, ty)
wind(4).btn(29).bgcol = &HFFFFCCCC: dodraw(): sleep 100, 1
wind(4).btn(29).bgcol = &HFFCCCCCC: dodraw(): sleep 100, 1
sleep 1000, 1
wind(4).vis = 0
sleep 100, 1
wind(3).text = wind(2).text
wind(3).vis = 1
do until inkey() = Chr(27)
    dodraw()
    sleep 10, 1
loop
screen 0
end 0