October 17, 2021, 11:26:22

Author Topic: [bb] Pattern Image by EsseEmmeErre [ 1+ years ago ]  (Read 517 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Pattern Image by EsseEmmeErre [ 1+ years ago ]
« on: June 29, 2017, 00:28:39 »
Title : Pattern Image
Author : EsseEmmeErre
Posted : 1+ years ago

Description : This program let you create a 64x64 tiles 3x3 cubed to draw white dots onto by the mouse.
Pressing the left mouse button let you draw or pressing right mouse button let you leave the drawing.
the 9 tiles are to see the pattern effect!
At end you can leave the program pressign the Esc key.


Code :
Code: BlitzBasic
  1. ;-> PatternImage by Stefano Maria Regattin
  2. ;i> 1 Dec 2012
  3. ;--------------
  4. Const BorderSize=8
  5. Const EmptyShape=0
  6. Const EscKey=27
  7. Const ImageSize=64
  8. Const LeftMouseButton=1
  9. Const RightMouseButton=2
  10. Global WindowSize=BorderSize*2+ImageSize*3
  11. AppTitle("PatternImage public by Stefano Maria Regattin","Press RMB or Esc to leave.")
  12. Graphics(WindowSize,WindowSize,0,2)
  13. For Fading=0 To BorderSize-1
  14.  Color(63+Fading*4,63+Fading*4,63+Fading*4)
  15.  Rect(Fading,Fading,GraphicsWidth()-Fading*2,GraphicsHeight()-Fading*2,EmptyShape)
  16. Next
  17. Color(255,255,255)
  18. EndOfTheProgram=False
  19. Repeat
  20.  KeyPressed=GetKey()
  21.  If KeyPressed=EscKey Then EndOfTheProgram=True
  22.  If MouseDown(RightMouseButton)=True Then EndOfTheProgram=True
  23.  If MouseDown(LeftMouseButton)=True Then
  24.   MouseXPos=MouseX():MouseXPos=MouseY()
  25.   If MouseXPos>=BorderSize And MouseXPos<WindowSize-BorderSize Then
  26.    If MouseYPos>=BorderSize And MouseYPos<WindowSize-BorderSize Then
  27.     PointX=(MouseXPos-BorderSize) Mod ImageSize
  28.     PointY=(MouseYPos-BorderSize) Mod ImageSize
  29.     For ImageCopyY=0 To 2
  30.      For ImageCopyX=0 To 2
  31.       ImageCopyXPos=ImageSize*ImageCopyX
  32.       ImageCopyYPos=ImageSize*ImageCopyY
  33.       Plot(PointX+ImageCopyXPos+BorderSize,PointY+ImageCopyY+BorderSize)
  34.      Next
  35.     Next
  36.    EndIf
  37.   EndIf
  38.  EndIf
  39. Until EndOfTheProgram=True
  40. EndGraphics()
  41. End


Comments :


virtlands(Posted 1+ years ago)

 Well, I certainly tried it.From my viewpoint left-clicking does nothing.There could be logic bug somewhere. [img]imagizer.imageshack.us/a/img856/7043/patternimage391x177.html">


gpete(Posted 4 months ago)

 this line is the error: MouseXPos=MouseX():MouseXPos=MouseY()it should be:  MouseXPos=MouseX():MouseYPos=MouseY()It works then..but not sure it is useful for anything :)


TomToad(Posted 4 months ago)

 There is another bug as well.      Plot(PointX+ImageCopyXPos+BorderSize,PointY+ImageCopyY+BorderSize)should be changed to      Plot(PointX+ImageCopyXPos+BorderSize,PointY+ImageCopyYPos+BorderSize)


Bobysait(Posted 4 months ago)

 well ...
Code: [Select]
Graphics 800,600,0,2
t=64:i=CreateImage(t,t)
Repeat
If MouseDown(1) WritePixel(MouseX()Mod t,MouseY()Mod t,-1,ImageBuffer(i)) : TileImage i:Flip
Until KeyDown(1)


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal