main.bmx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. '
  2. ' Using Lightblend/image as a light
  3. '
  4. Strict
  5. 'Include media in the final file
  6. Incbin "media/fl.png"
  7. Incbin "media/light.png"
  8. Incbin "media/B-Max.png"
  9. 'set the graphics mode
  10. Graphics 640, 480, 32
  11. 'Hide the pointer
  12. HideMouse
  13. 'All images will be handled from the center
  14. AutoMidHandle True
  15. 'Load images in now. incbin points the file to the included images
  16. Global backImage:TImage = LoadImage("incbin::media/fl.png")
  17. Global logoImage:TImage = LoadImage("incbin::media/B-Max.png")
  18. Global lightImage:TImage = LoadImage("incbin::media/light.png")
  19. 'setup some vars now
  20. Local x#, y#, tim#
  21. Local mx, my
  22. Local lightcolor[] = [255,255,255]
  23. Local BackColor[] = [128,128,128]
  24. 'Main Loop
  25. While Not KeyDown(KEY_ESCAPE)
  26. x:+5*Sin(tim)
  27. y:+1
  28. tim:+4
  29. mx = MouseX()
  30. my = MouseY()
  31. 'draw the backgound
  32. SetScale 1,1
  33. SetColor BackColor[0],BackColor[1],BackColor[2]
  34. TileImage backImage,x,y
  35. 'draw the logo
  36. SetBlend MaskBlend
  37. SetColor 0,0,0
  38. DrawImage logoimage,340,260
  39. SetColor 100,100,100
  40. DrawImage logoimage,320,240
  41. 'Draw the light
  42. SetBlend LightBlend
  43. SetColor LightColor[0],LightColor[1],LightColor[2]
  44. SetScale 1.5+1*Cos(tim), 1.5+1*Cos(tim)
  45. DrawImage lightimage, mx, my
  46. 'draw the mousepointer
  47. SetBlend SolidBlend
  48. SetColor 255,255,255
  49. SetScale 1,1
  50. DrawLine mx-5,my,mx+5,my
  51. DrawLine mx,my-5,mx,my+5
  52. Flip
  53. Wend
  54. End