SyntaxBomb - Indie Coders

Languages & Coding => Others => Topic started by: Aurel on December 15, 2019, 09:00:33 AM

Title: The Big Bang - Oxygen Basic
Post by: Aurel on December 15, 2019, 09:00:33 AM
here is a one simple demo in o2 compiler.

Code: [Select]
$ filename "Bigbang.exe"
include "rtl32.inc"
include "window.inc"

Window "Big Bang Theory", 800, 600, 2
sys xscreen =800, yscreen =600, i, sz
'Font 12,24,0,"courier"
sys anzahl=1000

single xmitte = xscreen/2, ymitte = yscreen/2


'=============
class Particle
'=============
 
  single x,y,xv,yv,diam
  sys    sz
  byte   red,green,blue,alpha
  sys    pob
  string sbuf

method index(sys i)
  pob=strptr(sbuf)+i*sizeof particle
end method

method populate(sys e)
  sys i,b
  sbuf=nuls e*sizeof particle
  pob=strptr sbuf
  for i=0 to <e
    rebirth
    pob+=sizeof particle
  next
end method

method rebirth()
  single r,a
  @this = pob
  x     = xmitte
  y     = ymitte
  a     = rand(1,628)*.01
  r     = rand(20,100)*.1
  xv    = r*cos(a)
  yv    = r*sin(a)
  diam  = rand(10,25)*.1
  red   = rand(40,250)
  green = rand(40,250)
  blue  = rand(20,250)
end method

method outside() as sys
  @this=pob
  if x<0 or y<0 or x>=xscreen or y>=yscreen then return 1
end method

method move()
  @this=pob
  single adist,a
  adist=hypot(xmitte-x,ymitte-y)
  a=adist*.002+.1
  x += xv*a
  y += yv*a
  sz=adist*diam*.015+2
end method

method show()
  @this=pob
  Oval x, y, sz, sz, red, green, blue
end method

end class

particle pa
pa.populate anzahl

While Key(27)=0
ClsColor 2,2,2
for i=0 to <anzahl
  pa.index i
  pa.move
  if pa.outside then
    pa.rebirth
  else
    pa.show
  end if
next
'
Events
FlipBuffer
WaitFPS 80
Wend
WinEnd
]
Title: Re: The Big Bang - Oxygen Basic
Post by: Aurel on December 28, 2019, 09:43:39 AM
ListView example:
Code: [Select]
$ Filename "ListView.exe" ' o2
include "RTL32.inc"
include "awinh037.inc"
INT win,wx=200,wy=200,ww=640,wh=420,wstyle = WS_MINMAXSIZE
INT button0,b0ID=100,listv,lvID=1000,static1,st1ID=200, col1,col2,col3
INT static0,stid0 = 199,stIMG
win=SetWindow("GUI:ListView",wx,wy,ww,wh,0,wstyle)
'create static control
stImg = LoadImage(0,"adBook.bmp",0,252,30,16)
If stImg = 0 ' create static with text
static1 = SetStatic(win,10,10,254,32," Adress Book by Aurel",0,0x200,st1ID)
ControlFont (static1, 24, 11, 600, "Courier New")
Else
static0 = SetStatic(win,10,10,254,32,"",0x5000030E,0x200,stid0)
SendMessage static0 ,370, 0, stImg

End if
'crete button-----------------------------------------------------------------------
button0 = SetButton(win,270,10,80,32,"Close (X)",0x50001000,0x200,b0ID)

'create ListView --------------------------------------------------------------------
listv = SetListView (win, 10, 60, 600 , 300 ,"Name", 100, 0, 0x200, lvID)
SendMessage listv, 4150 ,0 , 32  ' extended style - full row select
INT lvImg = LoadImage(0,"add.bmp",0,16,16,16)
print str lvImg
'add listview item {AddLVI hwnd, pos, text, icon}
AddListViewItem (listv, 0, "Charles", lvImg)
AddListViewItem (listv, 1, "Aurel", 0)
AddListViewItem (listv, 2, "Walter", 0)
AddListViewItem (listv, 3, "Markus", 0)
AddListViewItem (listv, 4, "LarryMc", 0)
'add column
col1= AddListViewColumn (listv, 1, 120, "Web Site"  , 0)
'add lv_sub_item
'AddListViewSubItem (lvhandle, lvpos, lvsub , lvstring )
AddListViewSubItem (listv, 0, 1, "Oxygen Basic")
AddListViewSubItem (listv, 1, 1, "AurelSoft")
AddListViewSubItem (listv, 2, 1, "TJP Forum")
AddListViewSubItem (listv, 3, 1, "RetroB Forum")
AddListViewSubItem (listv, 4, 1, "Ionic Wind")
'
col2= AddListViewColumn (listv, 2, 250, "Web Adress"  , 0)
AddListViewSubItem (listv, 0, 2, "http://www.oxygenbasic.org")
AddListViewSubItem (listv, 1, 2, "http://aurelsoft.ucoz.com")
AddListViewSubItem (listv, 2, 2, "http://qb64.thejoyfulprogrammer.com")
AddListViewSubItem (listv, 3, 2, "http://retrogamecoding.org")
AddListViewSubItem (listv, 4, 2, "http://www.ionicwind.com")
'
col3= AddListViewColumn (listv, 3, 124, "Info"  , 0)
AddListViewSubItem (listv, 0, 3, "o2 compiler")
AddListViewSubItem (listv, 1, 3, "Personal Site")
AddListViewSubItem (listv, 2, 3, "Programming Forum")
AddListViewSubItem (listv, 3, 3, "Community Forum")
AddListViewSubItem (listv, 4, 3, "IonicWind Basic")


'------------------------------------------------------------------------------------
Wait()  'message loop
'------------------------------------------------------------------------------------
'func main
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
SELECT hwnd
CASE win
Select wmsg
CASE WM_CLOSE
CloseWindow(win)
EndProgram
End Select
END SELECT
RETURN Default
END FUNCTION
SimplePortal 2.3.6 © 2008-2014, SimplePortal