It is currently Wed Oct 21, 2020 2:42 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: What are you working on?
PostPosted: Sun Jun 07, 2020 8:10 pm 
Offline
Addict
Addict

Joined: Sat Jul 11, 2009 4:57 am
Posts: 943
Location: United States
Kuron wrote:
I appreciate your comments. Post-TBI, life is a struggle (complicated by my Asperger's) and in all honesty, if I had life insurance, I would have already "accidentally" stepped in front of a bus so my wife could have a decent life. Not well-liked here (people with Asperger's often rub folks the wrong way without meaning to) so rarely post anymore, and given moving to get married back in 2015, my friends were left behind, and being at the age where I am now retired, I do not have a chance to make any new friends, so dealing with my TBI recovery on my own. Haven't given up, yet... *shrugs*

these days i rarely post myself, but i still enjoy browsing the forums to see what people are up to. personally, i've found a lot of happiness by growing plants hehe. it's peaceful and my hard work and patience rewards me with tasty little treats like strawberries even in the dead of winter :D

as for this talk about making games.. i decided to give it a go in purebasic!! i worked on this mostly yesterday morning and a few hours today for cleanup and botched particles.. after coming back to the language from so many years it's difficult to tell which way is the right way to do things so i just guessed at it all haha. i have about 250 lines left to use in the demo though :|

warning!! it has been a long time since I played with purebasic so if this gives anyone nightmares.. well that's on you!

A Breakout/Arkanoid style prototype:
Code:
Enumeration 0
  #Ball
  #Brick
  #Text1
  #Text2
  #Paddle
  #Particle1
EndEnumeration

Structure Object
  id.l ; set when added to object list

  type.l ;
  *parent;
  x.d;
  y.d;
  w.d; ; width/height
  h.d;
  dir.d[2] ; movement vector
  speed.l
 
  removed.b; removes from object list
  expires.l ; similar to removed.b but delayed!
 
  ; function pointers
  *fnConstructor ; unused, but could probably replace type
  *fnDestructor
  *fnRender
  *fnStep
 
  *extends  ; pointer to an object defining structure
EndStructure

Structure BrickObject
  hp.l
EndStructure

Structure PaddleObject
  x2.d
EndStructure

Structure BallObject
  lastParticleCreation.l
EndStructure

Structure ParticleObject
EndStructure

Structure Profile
  fps.l
  fpsc.l
  fpst.l; frame rate timer
  sps.l
  spsc.l
  c.l
  q.l
EndStructure

Structure State
  width.l ; window dimensions
  height.l
 
  dt.l
  now.l
  running.b
 
  score.l
  continues.l
 
  profiler.Profile
 
  uuidAccumulator.l ; used to create unique id's for objects
 
  Array objectsList.Object(1)
  Array objectsQueue.Object(1)
EndStructure

; object declarations
Declare Paddle(*ref.Object, x.l, y.l) ; constructor
Declare paddleDestructor(*ref.Object)
Declare paddleDraw(*ref.Object, dt.l)
Declare paddleStep(*ref.Object, *state.State)

Declare Ball(*ref.Object, x.l, y.l)
Declare ballDestructor(*ref.Object)
Declare ballDraw(*ref.Object, dt.l)
Declare ballStep(*ref.Object, *state.State)

Declare Brick(*ref.Object, x.l, y.l, hp.l)
Declare brickDestructor(*ref.Object)
Declare brickDraw(*ref.Object, dt.l)
Declare brickStep(*ref.Object, *state.State)

Declare Particle(*ref.Object, x.l, y.l, expires.l = 50, *parent.Object=#Null)
Declare particleDestructor(*ref.Object)
Declare particleDraw(*ref.Object, dt.l)
Declare particleStep(*ref.Object, *state.State)

; boring things declarations
Declare intersect2d(*a.Object, *b.Object)
Declare addObject(*game.State, *ref);
Declare flush(*state.State)
Declare update(*state.State)
Declare render(*state.State)
Declare isOffScreen(*this.Object, *state.State)

;-Paddle definition
Procedure Paddle(*ref.Object, x.l, y.l)
  *ptr.PaddleObject = AllocateStructure(PaddleObject)
  *ptr\x2 = x
  With *ref
    \extends = *ptr
    \x = x
    \y = y
    \removed = 0
    \w = 100
    \h = 25
    \fnRender = @paddleDraw()
    \fnStep = @paddleStep()
    \fnConstructor = @Paddle()
    \fnDestructor = @paddleDestructor()
    \type = #Paddle
  EndWith
EndProcedure

Procedure paddleDestructor(*ref.Object)
  FreeMemory(*crash);FreeStructure(*ref\extends)
EndProcedure

Procedure paddleStep(*this.Object, *state.State);
  *self.PaddleObject = *this\extends
  *self\x2 = *self\x2 + MouseDeltaX()
  *this\x = *this\x + ((*self\x2 - *this\x) / 5) ; make the paddle accumulate towards a position instead of instant movement
EndProcedure

Procedure paddleDraw(*this.Object, dt.l)
  ZoomSprite(#Paddle, *this\w, *this\h)
  DisplayTransparentSprite(#Paddle, *this\x, *this\y)
EndProcedure

;-Ball definition
Procedure Ball(*ref.Object, x.l, y.l)
  *ptr.BallObject = AllocateStructure(BallObject)
  *ptr\lastParticleCreation = 0
  With *ref
    \extends = *ptr
    \parent = *parent
    \x = x;width / 2
    \y = y;height - 50 ;
    \removed = 0        ;
    \speed = 5
    \w = 20 ;
    \h = 20
    \dir[0] = 0.0
    \dir[1] = -1.0
    \fnRender = @ballDraw()
    \fnStep = @ballStep()
    \fnConstructor = @Ball()
    \fnDestructor = @ballDestructor()
    \type = #Ball
  EndWith
EndProcedure

Procedure ballDestructor(*ref.Object)
  FreeStructure(*ref\extends)
EndProcedure

Procedure ballStep(*this.Object, *state.State);
  *self.BallObject = *this\extends

  tmp.Object
  With tmp ; a copy of the object with future transforms applied to it
    \x = *this\x + (*this\dir[0] * *this\speed)
    \y = *this\y + (*this\dir[1] * *this\speed)
    \w = *this\w
    \h = *this\h
  EndWith
 
  For i = 0 To ArraySize(*state\objectsList()) - 1
    that.Object = *state\objectsList(i);
    If (*this\id <> that\id And intersect2d(tmp, that) = 1)
      If (that\type = #Brick)
        *ptr.BrickObject = that\extends
        *ptr\hp = *ptr\hp - 1
        *this\dir[0] = -(*this\dir[0])
        *this\dir[1] = -(*this\dir[1])
        *state\score + 1
      ElseIf (that\type = #Paddle)
        rads = (((that\x - *this\x) + ((that\w - *this\w )/2) )) * #PI
        *this\dir[0] = -Sin(rads / 180)
        *this\dir[1] = -Cos(rads / 180)
      EndIf
           
    EndIf
  Next

  If (isOffScreen(tmp, *state))
    *this\dir[0] = -(*this\dir[0])
    *this\dir[1] = -(*this\dir[1])
  EndIf
 
  With *this
    \x = \x + (\dir[0] * \speed)
    \y = \y + (\dir[1] * \speed)
  EndWith
 
  If (*state\dt > *self\lastParticleCreation + 10)
    *self\lastParticleCreation = *state\dt
    For i = 0 To 15
      Particle(particleObj.Object, 0, 0, *state\dt + Random(300, 50), *this)
      addObject(*state, particleObj)
    Next
  EndIf
   
EndProcedure

Procedure ballDraw(*this.Object, dt.l)
  ZoomSprite(#Ball, *this\w, *this\h)
  DisplayTransparentSprite(#Ball, *this\x, *this\y);
EndProcedure

;-Particle definition
Procedure Particle(*ref.Object, x.l, y.l, expires.l = 50, *parent.Object=#Null)
  *ptr.ParticleObject = AllocateStructure(ParticleObject)
  s = Random(5, 1)
  With *ref
    \extends = *ptr
    \parent = *parent
    \x = x;width / 2
    \y = y;height - 50 ;
    \w = s ;
    \h = s
    \expires = expires
    \dir[0] = 0.0
    \dir[1] = -1.0
    \fnRender = @particleDraw()
    \fnStep = @particleStep()
    \fnConstructor = @Particle()
    \fnDestructor = @particleDestructor()
    \type = #Particle1
  EndWith
  If (*parent <> #Null)
    *ref\dir[0] = -(*parent\dir[0])
    *ref\dir[1] = -(*parent\dir[1])
    *ref\speed = Random(5, 1);
    *ref\x = *parent\x + (s*2);
    *ref\y = *parent\y + (s*2);
  EndIf
EndProcedure

Procedure particleDestructor(*ref.Object)
  FreeStructure(*ref\extends)
EndProcedure

Procedure particleStep(*this.Object, *state.State);
 
  *self.ParticleObject = *this\extends
  With *this
    \x = \x + (\dir[0] * \speed)
    \y = \y + (\dir[1] * \speed)
  EndWith
   
EndProcedure

Procedure particleDraw(*this.Object, dt.l)
  ZoomSprite(#Particle1, *this\w, *this\h)
  DisplayTransparentSprite(#Particle1, *this\x, *this\y);
EndProcedure
;-Brick definition
Procedure Brick(*ref.Object, x.l, y.l, hp.l)
  *ptr.BrickObject = AllocateStructure(BrickObject)
  *ptr\hp = hp
  With *ref
    \type = #Brick
    \extends = *ptr
    \x = x
    \y = y
    \removed = 0;
    \w = 50;
    \h = 25;
    \fnRender = @brickDraw()
    \fnStep = @brickStep()
    \fnConstructor = @Brick()
    \fnDestructor = @brickDestructor()
  EndWith
EndProcedure

Procedure brickDestructor(*ref.Object)
  ;*self.BrickObject = *ref\extends
  ;FreeMemory(*self\ptrtest)
  FreeStructure(*ref\extends)
EndProcedure

Procedure brickStep(*this.Object, *state.State);
 
  *self.BrickObject = *this\extends

  If (*self\hp < 1)
    *this\removed = 1
  EndIf
   
EndProcedure

Procedure brickDraw(*this.Object, dt.l)
  ZoomSprite(#Brick, *this\w, *this\h)
  DisplayTransparentSprite(#Brick, *this\x, *this\y);
EndProcedure

;-#
Procedure update(*state.State)
  size = ArraySize(*state\objectsList());
  For k = 0 To size - 1
    If (*state\objectsList(k)\removed = 1)
      Continue
    EndIf
   
    *addr = *state\objectsList(k)\fnStep;
    CallFunctionFast(*addr, *state\objectsList(k), *state);
  Next
EndProcedure

Procedure render(*state.State)
 
  ClearScreen(RGB(50,100,140));

  For k = 0 To ArraySize(*state\objectsList()) - 1
    If (*state\objectsList(k)\removed = 1)
      Continue
    EndIf
   
    *addr = *state\objectsList(k)\fnRender;
    CallFunctionFast(*addr, *state\objectsList(k), *state);
  Next 
 
  DisplayTransparentSprite(#Text1, *state\width - 150, 10);
  DisplayTransparentSprite(#Text2, 10, 10)
 
  FlipBuffers();
EndProcedure

Procedure addObject(*game.State, *ref)
  o = ArraySize(*game\objectsQueue());
  ReDim *game\objectsQueue.Object(o+1);
  CopyStructure(*ref, @dref.Object, Object)
  *game\objectsQueue(o) = dref;
EndProcedure

Procedure remakeHUDSprite(*state.State) 
  If (IsSprite(#Text2))
    FreeSprite(#Text2)
  EndIf
 
  CreateSprite(#Text2, 200, 75);
  StartDrawing(SpriteOutput(#Text2))

  DrawingMode(#PB_2DDrawing_Transparent)
  DrawText(0, 0, "Score: " + Str(*state\score), RGB(1, 0, 0));
  DrawText(0, 20, "Continues: " + Str(*state\continues), RGB(1, 0, 0));
  StopDrawing()
EndProcedure

Procedure remakeProfileSprite(*prof.Profile) 
  If (IsSprite(#Text1))
    FreeSprite(#Text1)
  EndIf
 
  CreateSprite(#Text1, 200, 75);
  StartDrawing(SpriteOutput(#Text1))

  DrawingMode(#PB_2DDrawing_Transparent)
  DrawText(0, 0, Str(*prof\fps) + " - frames per sec", RGB(1, 0, 0));
  DrawText(0, 20, Str(*prof\sps) + " - steps per sec", RGB(1, 0, 0));
  DrawText(0, 40, Str(*prof\c) + " - object count", RGB(1, 0, 0)) ;
  DrawText(0, 60, Str(*prof\q) + " - queue count", RGB(1, 0, 0))  ;
  StopDrawing()
EndProcedure

Procedure init(*state.State)
  remakeProfileSprite(*state\profiler);
  remakeHUDSprite(*state)
 
  CreateSprite(#Ball, 20, 20);
  StartDrawing(SpriteOutput(#Ball))
  Box(0, 0, 20, 20, RGB(0, 0, 0))       ;
  DrawingMode(#PB_2DDrawing_Default)
  Circle(10, 10, 5, RGB(255, 255, 255));
  StopDrawing()
 
  CreateSprite(#Brick, 50, 25);
  StartDrawing(SpriteOutput(#Brick))
  Box(0, 0, 20, 20, RGB(0, 0, 0))       ;
  DrawingMode(#PB_2DDrawing_Default)
  Box(0, 0, 50, 25, RGB(255, 255, 255));
  StopDrawing() 
 
  CreateSprite(#Particle1, 25, 25);
  StartDrawing(SpriteOutput(#Particle1))
  Box(0, 0, 20, 20, RGB(0, 0, 0))       ;
  DrawingMode(#PB_2DDrawing_Default)
  Box(0, 0, 50, 25, RGB(255, 255, 255));
  StopDrawing()
 
  CreateSprite(#Paddle, 100, 50);
  StartDrawing(SpriteOutput(#Paddle))
  Box(0, 0, 20, 20, RGB(0, 0, 0))       ;
  DrawingMode(#PB_2DDrawing_Default)
  Box(0, 0, 100, 50, RGB(255, 255, 255));
  StopDrawing()
 
  Paddle(paddleObj.Object, *state\width / 2 - 50, *state\height - 100)
  addObject(*state, paddleObj)
 
  Ball(ballObj.Object, *state\width / 2, *state\height - 150)
  addObject(*state, ballObj)
 
  For x = 0 To 99
    tx = 50 + ((x % 10) * 70)
    ty = 100 + ((x / 10) * 50)
    Brick(brickObj.Object, tx, ty, 1)
    addObject(*state, brickObj)
  Next
EndProcedure

Procedure isOffScreen(*this.Object, *state.State)
  If (*this\x < 0) Or (*this\x > *state\width) Or (*this\y < 0) Or (*this\y > *state\height)
    ProcedureReturn 1
  EndIf
EndProcedure

Procedure intersect2d(*o.Object, *b.Object)
  ax.d = *o\x
  ay.d = *o\y
  au.d = *o\x + *o\w
  av.d = *o\y + *o\h
   
  bx.d = *b\x
  by.d = *b\y
  bu.d = *b\x + *b\w
  bv.d = *b\y + *b\h
 
  If (ax <= bu And au >= bx And ay <= bv And av >= by)
    ProcedureReturn 1
  EndIf
  ProcedureReturn 0
EndProcedure

Procedure flush(*state.State)
  size = ArraySize(*state\objectsList())
  For i = 0 To size - 1 ; clean up objects that were marked for removal
    If (*state\objectsList(i)\removed = 1 Or (*state\objectsList(i)\expires > 0 And *state\dt > *state\objectsList(i)\expires))
      *addr = *state\objectsList(i)\fnDestructor;
      CallFunctionFast(*addr, *state\objectsList(i));
      ; i dont know how to properly resize arrays in purebasic so hopefully this won't be too slow :(
      *state\objectsList(i) = *state\objectsList(size - 1) ; swap removing object with one at end
      ReDim *state\objectsList.Object(size - 1)
      size = size -1; have to modify loop or bad things will happen
      i = i - 1; the object that was swapped must also be checked for removal
    EndIf
  Next

  n = ArraySize(*state\objectsQueue());
  If (n > 0) ; merge queued objects into the object list
    o = ArraySize(*state\objectsList());
    If (o >= 1000) ; this is just an arbitrary size limit for the number of objects to allow
      ReDim *state\objectsQueue(0);
      ProcedureReturn
    EndIf

    ReDim *state\objectsList(o+n);
    For k = 0 To n ; the merge part
      *state\uuidAccumulator = *state\uuidAccumulator + 1
      *state\objectsList(o+k) = *state\objectsQueue(k);
      *state\objectsList(o+k)\id = *state\uuidAccumulator
    Next
    ReDim *state\objectsQueue(0)
  EndIf
EndProcedure

With game.State
  \width = 800
  \height = 800
  \running = 1
  \score = 0
  \continues = 0
  \now = ElapsedMilliseconds()
  \dt = ElapsedMilliseconds();
  \profiler\fps = 0;
  \profiler\fpsc = 0;
  \profiler\fpst = 0;
  \profiler\sps = 0;
  \profiler\spsc = 0;
  \profiler\c = 0   ;
  \profiler\q = 0   ;
  Dim \objectsQueue.Object(0)
  Dim \objectsList.Object(0)
EndWith

InitSprite()
InitMouse()

OpenWindow(0, 0, 0, game\width, game\height, "Nostalgia", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget);
OpenWindowedScreen(WindowID(0), 0, 0, game\width, game\height); 

init(game)
While game\running = 1
  Select WindowEvent()
    Case #PB_Event_CloseWindow
      game\running = 0
  EndSelect

  ExamineMouse()

  flush(game)

  If (game\dt > game\profiler\fpst + 1000)
    game\profiler\fps = game\profiler\fpsc;
    game\profiler\fpsc = 0  ;
    game\profiler\sps = game\profiler\spsc;
    game\profiler\spsc = 0  ;
    game\profiler\fpst = game\dt ;
    game\profiler\c = ArraySize(game\objectsList())
    game\profiler\q = ArraySize(game\objectsQueue())
    remakeProfileSprite(game\profiler);
  EndIf

  game\now = ElapsedMilliseconds();
 
  If (game\now - game\dt > 1000) ; skip some logic steps because previous one took too long
    game\dt = game\now;
  EndIf
 
  CopyStructure(@game, @prev.State, State)
  While game\dt < game\now ; step game objects at a constant rate
    game\dt = game\dt + 1000/30;
    update(game);
    game\profiler\spsc=game\profiler\spsc+1;
  Wend
 
  If (prev\score <> game\score Or prev\continues <> game\continues)
    remakeHUDSprite(game)
  EndIf
 

  render(game)
  game\profiler\fpsc=game\profiler\fpsc+1; 
Wend

_________________
▓▓▓▓▓▒▒▒▒▒░░░░░


Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Mon Jun 15, 2020 12:18 am 
Offline
Addict
Addict

Joined: Sat Jul 11, 2009 4:57 am
Posts: 943
Location: United States
Well the weekend is finally over... No!!!

I finished working on my brickbreaker clone! *finished* it... i ran out of lines to use in the demo!! But I think everything that makes a brickbreaker clone is there. :D I didn't get to add all the powerups i wanted to unfortunately.

Image

Code:
Enumeration 0
  #Ball
  #Brick0
  #RGB1
  #RGB2
  #RGB3
  #RGB4
  #Text1
  #Text2
  #Text3
  #Paddle1
  #Particle1
  #Sheet1
  #Paddle2
  #Paddle3
  #Pickup0; base image
  #Pickup1
  #Pickup2;
  #Pickup3;
  #Pickup4;
  #Pickup5;
  #Pickup6;
  #Pickup7;
  #Pickup8;
  #Pickup9;
  #Pickup10;
  #Font1
EndEnumeration
;-Object structure
Structure Object
  id.l ; set when added to object list
  type.l ;
  *parent;
  x.d;
  y.d;
  w.d; ; width/height
  h.d;
  dir.d[2] ; movement vector
  speed.l
  intangible.b ; used for skipping objects that don't need collision testing such as particles
  removed.b; removes from object list
  expires.l ; similar to removed.b but delayed!
  ; function pointers
  *fnConstructor ; unused, but could probably replace type
  *fnDestructor
  *fnRender
  *fnStep
  *extends  ; pointer to an object defining structure
EndStructure
Structure BrickObject
  hp.l
  gfx.b;
EndStructure
Structure PickupObject
  type.l
EndStructure
Structure PaddleObject
  size.l
  x2.d
EndStructure
Structure BallObject
  lastParticleCreation.l
EndStructure
Structure ParticleObject
EndStructure
Structure Vector
  x.d
  y.d
EndStructure
Structure Profile
  tps.l
  tpsc.l
  tpst.l
  count1.l
  count2.l
EndStructure
;-Game state structure
Structure State
  width.l ; window dimensions
  height.l
  dt.l
  now.l
  running.b
  active.b ;
  score.l
  balls.l
  bricks.l
  gameover.b;
  continues.l
  drawing.Profile
  logic.Profile
  uuidAccumulator.l ; used to create unique id's for objects
  *paddle.Object; used for
  Array objectsList.Object(1)
  Array objectsQueue.Object(1)
EndStructure

;-Object declarations
Declare Paddle(*state.State, *ref.Object, x.l, y.l) ; constructor
Declare paddleDestructor(*ref.Object)
Declare paddleDraw(*ref.Object, dt.l)
Declare paddleStep(*ref.Object, *state.State)

Declare Ball(*state.State, *ref.Object, x.l, y.l)
Declare ballDestructor(*ref.Object)
Declare ballDraw(*ref.Object, dt.l)
Declare ballParticleSpawner(*this.Object, *state.State, delay.l=100, reverseDir.b = 1)
Declare ballStep(*ref.Object, *state.State)

Declare Brick(*state.State, *ref.Object, x.l, y.l, hp.l)
Declare brickDestructor(*ref.Object)
Declare brickDraw(*ref.Object, dt.l)
Declare brickStep(*ref.Object, *state.State)
Declare brickParticleSpawner(*this.BallObject, *state.State, delay.l=100, reverseDir.b=1)

Declare Particle(*state.State, *ref.Object, *parent.Object, x.l, y.l, *direction.Vector, expires.l)
Declare particleDestructor(*ref.Object)
Declare particleDraw(*ref.Object, dt.l)
Declare particleStep(*ref.Object, *state.State)

Declare Pickup(*state.State, *ref.Object, x.l, y.l, type.l)
Declare pickupDestructor(*ref.Object)
Declare pickupDraw(*ref.Object, dt.l)
Declare pickupStep(*ref.Object, *state.State)

; boring things declarations
Declare intersect2d(*a.Object, *b.Object)
Declare addObject(*game.State, *ref);
Declare flush(*state.State)
Declare update(*state.State)
Declare render(*state.State)
Declare isOffScreen(*this.Object, *state.State)
;Declare

;-Particle definition
Procedure Pickup(*state.State, *ref.Object, x.l, y.l, type.l);, reverseDir.b = 1)
  *ptr.PickupObject = AllocateStructure(PickupObject)
  *ptr\type = #Pickup0 + type
  With *ref
    \extends = *ptr
    \parent = *parent
    \x = x
    \y = y
    \w = 32 ;
    \h = 32
    \expires = 0
    \dir[0] = 0.0
    \dir[1] = 1.0
    \speed = 3
    \fnRender = @pickupDraw()
    \fnStep = @pickupStep()
    \fnConstructor = @Pickup()
    \fnDestructor = @pickupDestructor()
    \intangible = 0
  EndWith
EndProcedure
Procedure pickupDestructor(*ref.Object)
  FreeStructure(*ref\extends)
EndProcedure
Procedure pickupApply(*state.State, *this.Object, type.l=-1)
  *self.PickupObject = *this\extends
  *thatObj.PaddleObject = *state\paddle\extends
  If (type.l = -1)
    type = *self\type
  EndIf
 
  Select type
    Case #Pickup1:
      *state\continues+1
    Case  #Pickup4:
      *thatObj\size + 1
    Case  #Pickup5:
      If (*thatObj\size > 1)
        *thatObj\size - 1
      EndIf
    Case  #Pickup7:
      Ball(*state, obj.Object, *this\x, *this\y)
      addObject(*state, obj);
    Case  #Pickup8:
      pickupApply(*state, *this, Random(9,0));
    Default: *state\score = *state\score / 0.25
  EndSelect
  ProcedureReturn 0
EndProcedure
   
Procedure pickupStep(*this.Object, *state.State);
  *self.PickupObject = *this\extends
  With *this
    \x = \x + (\dir[0] * \speed)
    \y = \y + (\dir[1] * \speed)
  EndWith
  If (isOffScreen(*this, *state))
    *this\removed = 1
  EndIf
    *that.Object = *state\paddle
    collision = intersect2d(*this, *that)
    If (*that\fnConstructor = @Paddle() And collision > 0 And *this\removed = 0)
      pickupApply(*state, *this)
      *this\removed = 1
      ballParticleSpawner(*this, *state, 10, 1)
    EndIf
EndProcedure
Procedure pickupDraw(*this.Object, dt.l)
  *self.PickupObject = *this\extends
  DisplayTransparentSprite(#Pickup0, *this\x, *this\y);
  DisplayTransparentSprite(*self\type, *this\x, *this\y);
EndProcedure
;-Paddle definition
Procedure Paddle(*state.State, *ref.Object, x.l, y.l)
  *ptr.PaddleObject = AllocateStructure(PaddleObject)
  *ptr\size = 5
  With *ref
    \extends = *ptr
    \x = x
    \y = y
    \removed = 0
    \w = 100
    \h = 16
    \fnRender = @paddleDraw()
    \fnStep = @paddleStep()
    \fnConstructor = @Paddle()
    \fnDestructor = @paddleDestructor()
  EndWith
EndProcedure
Procedure paddleDestructor(*ref.Object)
EndProcedure
Procedure paddleParticleSpawner(*this.Object, *state.State, side.b);
  For k = 1 To 2
    dir.Vector\y = 1.0 + ((-4 + Random(8, 0)) / 10);;
    dir\x = 0.0  + ((-4 + Random(8, 0)) / 10)
    pos.Vector\x = *this\x + 5
    pos\y = *this\y + *this\h;
    If (side = 1)
      pos\x = *this\x + *this\w - 10
    EndIf
    Particle(*state, particleObj.Object, *this, pos\x, pos\y, dir, *state\dt + Random(300, 100))
    addObject(*state, particleObj)
  Next
EndProcedure
Procedure paddleStep(*this.Object, *state.State);
  *state\paddle = *this
  *self.PaddleObject = *this\extends
  *this\x = MouseX()
  *this\w = 32 + (*self\size * 6 * 2)
  If (*this\x + *this\w > *state\width)
    *this\x = *state\width - *this\w 
  EndIf 
  paddleParticleSpawner(*this, *state, 0)
  paddleParticleSpawner(*this, *state, 1)
EndProcedure
Procedure paddleDraw(*this.Object, dt.l)
  *self.PaddleObject = *this\extends
  size = *self\size * 2
  DisplayTransparentSprite(#Paddle1, *this\x, *this\y)
  DisplayTransparentSprite(#Paddle3, *this\x + 17 + (6 * size), *this\y)
  For l = 1 To size
    DisplayTransparentSprite(#Paddle2, *this\x + 5 + ( 6 * l), *this\y + 1)
  Next
EndProcedure
;-Ball definition
Procedure Ball(*state.State, *ref.Object, x.l, y.l)
  *state\balls + 1;
  *ptr.BallObject = AllocateStructure(BallObject)
  *ptr\lastParticleCreation = 0
  With *ref
    \extends = *ptr
    \parent = *parent
    \x = x;width / 2
    \y = y;height - 50 ;
    \removed = 0        ;
    \speed = 10
    \w = 16 ;
    \h = 16
    \dir[0] = 0.0
    \dir[1] = -1.0
    \fnRender = @ballDraw()
    \fnStep = @ballStep()
    \fnConstructor = @Ball()
    \fnDestructor = @ballDestructor()
  EndWith
EndProcedure
Procedure ballDestructor(*ref.Object)
  FreeStructure(*ref\extends)
EndProcedure
Procedure ballParticleSpawner(*this.Object, *state.State, delay.l=100, reverseDir.b = 1)
  *self.BallObject = *this\extends
  If (*state\dt > *self\lastParticleCreation + delay)
    *self\lastParticleCreation = *state\dt
    For i = 0 To 10
      dir.Vector\x = -((-8 + Random(16, 0)) / 10)
      dir\y = -((-8 + Random(16, 0)) / 10)
      Particle(*state, particleObj.Object, *this, *this\x, *this\y, dir, *state\dt + Random(300, 50))
      addObject(*state, particleObj)
    Next
  EndIf
EndProcedure
Procedure ballStep(*this.Object, *state.State);
  *self.BallObject = *this\extends
 
  If (*state\active = 1)
    tmp.Object
    With tmp ; a copy of the object with future transforms applied to it
      \x = *this\x + (*this\dir[0] * *this\speed)
      \y = *this\y + (*this\dir[1] * *this\speed)
      \w = *this\w
      \h = *this\h
    EndWith
   
    For i = 0 To ArraySize(*state\objectsList()) - 1
      that.Object = *state\objectsList(i);
      ; todo: collision will fail if a balls speed is more than the width or height of an object it could collide with
      collision = intersect2d(tmp, that)
      If (*this\id <> that\id And that\intangible = 0 And collision > 0)
        If (that\fnConstructor = @Brick())
          *ptr.BrickObject = that\extends
          *ptr\hp = *ptr\hp - 1
         
          top.Object\x = that\x + 1
          top\y = that\y - that\h
          top\w = that\w - 2
          top\h = that\h + 5
          bot.Object\x = that\x + 1;
          bot\y = that\y + that\h - 5
          bot\w = that\w - 2
          bot\h = that\h
         
         
          left.Object\x = that\x - that\w
          left\y = that\y + 1
          left\w = that\w + 5
          left\h = that\h - 2
          right.Object\x = that\x + that\w - 5;
          right\y = that\y + 1
          right\w = that\w
          right\h = that\h - 2
          If (intersect2d(tmp, top) Or intersect2d(tmp, bot))
            *this\dir[1] = -(*this\dir[1])
          ElseIf (intersect2d(tmp, left) Or intersect2d(tmp, right))
            *this\dir[0] = -(*this\dir[0])
          Else
            *this\dir[0] = -(*this\dir[0])
            *this\dir[1] = -(*this\dir[1])
          EndIf
         
          *state\score + 1
          ballParticleSpawner(*this, *state, 10, 1)
        ElseIf (that\fnConstructor = @Paddle())
          rads = (((that\x - *this\x) + ((that\w - *this\w )/2) )) * #PI
          *this\dir[0] = -Sin(rads / 180)
          *this\dir[1] = -Cos(rads / 180)
          ballParticleSpawner(*this, *state, 10, 1)
        EndIf
      EndIf
    Next
   
    c2 = isOffScreen(tmp, *state)
    If (c2 = 4) ; bottom of the screen hit
      *this\removed = 1
      *state\balls - 1
    ElseIf (c2 = 3) ; top
      *this\dir[1] = -(*this\dir[1])
    ElseIf (c2 > 0)
      *this\dir[0] = -(*this\dir[0])
    EndIf
   
    If (c2 > 0)
      ballParticleSpawner(*this, *state, 10, 0)
    EndIf
   
    With *this
      \x = \x + (\dir[0] * \speed)
      \y = \y + (\dir[1] * \speed)
    EndWith
  Else
    With *this
      \x = *state\paddle\x + ((*state\paddle\w/2) - (\w/2))
      \y = *state\paddle\y - 20
    EndWith
  EndIf
EndProcedure
Procedure ballDraw(*this.Object, dt.l)
  DisplayTransparentSprite(#Ball, *this\x, *this\y);
EndProcedure
;-Particle definition
Procedure Particle(*state.State, *ref.Object, *parent.Object, x.l, y.l, *direction.Vector, expires.l);, reverseDir.b = 1)
  *ptr.ParticleObject = AllocateStructure(ParticleObject)
  s = Random(5, 1)
  With *ref
    \extends = *ptr
    \parent = *parent
    \x = x
    \y = y
    \w = s ;
    \h = s
    \expires = expires
    \dir[0] = *direction\x
    \dir[1] = *direction\y
    \speed = Random(10, 0);
    \fnRender = @particleDraw()
    \fnStep = @particleStep()
    \fnConstructor = @Particle()
    \fnDestructor = @particleDestructor()
    \intangible = 1
  EndWith
EndProcedure
Procedure particleDestructor(*ref.Object)
  FreeStructure(*ref\extends)
EndProcedure
Procedure particleStep(*this.Object, *state.State);
  *self.ParticleObject = *this\extends
  With *this
    \x = \x + (\dir[0] * \speed)
    \y = \y + (\dir[1] * \speed)
    \speed = \speed/2; - \speed
  EndWith   
EndProcedure
Procedure particleDraw(*this.Object, dt.l)
  ZoomSprite(#Particle1, *this\w, *this\h)
  DisplayTransparentSprite(#Particle1, *this\x, *this\y);
EndProcedure
;-Brick definition
Procedure Brick(*state.State, *ref.Object, x.l, y.l, hp.l)
  *state\bricks + 1
  *ptr.BrickObject = AllocateStructure(BrickObject)
  *ptr\hp = hp
  *ptr\gfx = Random(3, 0);
  With *ref
    \extends = *ptr
    \x = x
    \y = y
    \removed = 0;
    \w = 64;
    \h = 32;
    \fnRender = @brickDraw()
    \fnStep = @brickStep()
    \fnConstructor = @Brick()
    \fnDestructor = @brickDestructor()
  EndWith
EndProcedure
Procedure brickDestructor(*ref.Object)
  ;*self.BrickObject = *ref\extends
  ;FreeMemory(*self\ptrtest)
  FreeStructure(*ref\extends)
EndProcedure

Procedure brickStep(*this.Object, *state.State);
  *self.BrickObject = *this\extends
  If (*self\hp < 1 And *this\removed = 0)
    *this\removed = 1
    *state\bricks - 1
    Pickup(*state, obj.Object, *this\x, *this\y, Random(10, 1))
    addObject(*state, obj);
  EndIf
EndProcedure
Procedure brickDraw(*this.Object, dt.l)
  *self.BrickObject = *this\extends
  DisplayTransparentSprite(#Brick0, *this\x, *this\y);
  DisplayTransparentSprite(#RGB1 + (*self\gfx), *this\x, *this\y);
EndProcedure
Procedure update(*state.State)
  size = ArraySize(*state\objectsList());
  For k = 0 To size - 1
    If (*state\objectsList(k)\removed = 1)
      Continue
    EndIf
   
    *addr = *state\objectsList(k)\fnStep;
    CallFunctionFast(*addr, *state\objectsList(k), *state);
  Next
  If (*state\bricks = 0 And *state\gameover = 0)
    *state\gameover = 1
  EndIf
  If (*state\balls = 0 And *state\gameover = 0)
    If (*state\continues = 0)
      *state\gameover = 2
    Else
      *state\continues - 1
      *state\active = 0
      Ball(*state, obj.Object, 0, 0)
      addObject(*state, obj)
    EndIf
  EndIf
  If (*state\active = 0 And MouseButton(#PB_MouseButton_Left) = 1)
    *state\active = 1
  EndIf
EndProcedure
Procedure render(*state.State)
  ClearScreen(RGB(50, 100, 140));

  For k = 0 To ArraySize(*state\objectsList()) - 1
    item.Object = *state\objectsList(k)
    If (item\removed = 1)
      Continue
    EndIf
    *addr = *state\objectsList(k)\fnRender;
    CallFunctionFast(*addr, *state\objectsList(k), *state);
    ;StartDrawing(ScreenOutput()) ; show bounds
    ;Line(item\x, item\y, item\w, 1, #Red)
    ;Line(item\x, item\y+item\h, item\w, 1, #Red)
    ;Line(item\x, item\y, 1, item\h, #Red)
    ;Line(item\x+item\w, item\y, 1, item\h, #Red)
    ;Line(item\x, item\y, item\w, item\h, #Red)
    ;StopDrawing()
  Next 

  DisplayTransparentSprite(#Text1, *state\width - 150, 10);
  DisplayTransparentSprite(#Text2, 10, 10)
  If (*state\gameover > 0 Or *state\active = 0)
    DisplayTransparentSprite(#Text3, *state\width/2 - 150, *state\height/2)
  EndIf
   
  FlipBuffers();
EndProcedure
Procedure addObject(*game.State, *ref)
  o = ArraySize(*game\objectsQueue());
  ReDim *game\objectsQueue.Object(o+1);
  CopyStructure(*ref, @dref.Object, Object)
  *game\objectsQueue(o) = dref;
EndProcedure
Procedure remakeHUDSprite(*state.State) 
  If (IsSprite(#Text2))
    FreeSprite(#Text2)
  EndIf
 
  CreateSprite(#Text2, 200, 75);
  StartDrawing(SpriteOutput(#Text2))
  DrawingMode(#PB_2DDrawing_Transparent)
  DrawText(0, 0, "Score: " + Str(*state\score), RGB(1, 0, 0));
  DrawText(0, 20, "Continues: " + Str(*state\continues), RGB(1, 0, 0));
  StopDrawing()
EndProcedure
Procedure remakeGameOverSprite(*state.State, msg.s)
  If (IsSprite(#Text3))
    FreeSprite(#Text3)
  EndIf
  CreateSprite(#Text3, 300, 100);
  StartDrawing(SpriteOutput(#Text3))
  DrawingMode(#PB_2DDrawing_Transparent)
  DrawingFont(FontID(#Font1))
  DrawText(0, 0, msg, RGB(1, 0, 0));
  StopDrawing()
EndProcedure
Procedure remakeProfileSprite(*state.State) 
  If (IsSprite(#Text1))
    FreeSprite(#Text1)
  EndIf
 
  CreateSprite(#Text1, 200, 120);
  StartDrawing(SpriteOutput(#Text1))

  DrawingMode(#PB_2DDrawing_Transparent)
  DrawText(0, 0, Str(*state\drawing\tps) + " - frames per sec", RGB(1, 0, 0));
  DrawText(0, 20, Str(*state\logic\tps) + " - steps per sec", RGB(1, 0, 0));
  DrawText(0, 40, Str(*state\logic\count1) + " - object count", RGB(1, 0, 0)) ;
  DrawText(0, 60, Str(*state\logic\count2) + " - queue count", RGB(1, 0, 0)) 
  DrawText(0, 80, Str(*state\balls) + " - balls", RGB(1, 0, 0)) 
  DrawText(0, 100, Str(*state\bricks) + " - bricks", RGB(1, 0, 0))  ;
  StopDrawing()
EndProcedure
Procedure init(*state.State)
  LoadFont(#Font1, "Arial", 32, #PB_Font_Bold)
  remakeProfileSprite(*state);
  remakeHUDSprite(*state)
  remakeGameOverSprite(*state, "Click to Start!")
  LoadSprite(#Sheet1, "E:/assets/brickbreaker.png", #PB_Sprite_AlphaBlending);
 
  CopySprite(#Sheet1, #Paddle1, #PB_Sprite_AlphaBlending) ; left
  ClipSprite(#Paddle1, 0, 0, 16, 16)
  CopySprite(#Sheet1, #Paddle2, #PB_Sprite_AlphaBlending) ; blue thing
  ClipSprite(#Paddle2, 16, 0, 16, 16)
  CopySprite(#Sheet1, #Paddle3, #PB_Sprite_AlphaBlending) ; right
  ClipSprite(#Paddle3, 32, 0, 16, 16) 
 
  CopySprite(#Sheet1, #Ball, #PB_Sprite_AlphaBlending)
  ClipSprite(#Ball, 16 * 3, 0, 16, 16)
 
  CopySprite(#Sheet1, #Brick0, #PB_Sprite_AlphaBlending)
  ClipSprite(#Brick0, 0, 64, 64, 32)

  CreateSprite(#Particle1, 25, 25);
  StartDrawing(SpriteOutput(#Particle1))
  Box(0, 0, 20, 20, RGB(0, 0, 0))       ;
  DrawingMode(#PB_2DDrawing_Default)
  Box(0, 0, 50, 25, RGB(255, 255, 255));
  StopDrawing()
 
  For k = 0 To 3
    CreateSprite(#RGB1 + k, 64, 32, #PB_Sprite_AlphaBlending);
    StartDrawing(SpriteOutput(#RGB1 + k))
    DrawingMode(#PB_2DDrawing_AlphaChannel)
    Box(0, 0, 64, 32, $00000000)
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    Box(0, 0, 64, 32, RGBA(Random(255, 0), Random(255, 0), Random(255, 0), 100))
    DrawingMode(#PB_2DDrawing_AlphaChannel)
    Box(0, 0, 2, 2, $00000000)
    Box(62, 0, 2, 2, $00000000)
    Box(0, 30, 2, 2, $00000000)
    Box(62, 30, 2, 2, $00000000)
    StopDrawing()
  Next
 
  CopySprite(#Sheet1, #Pickup0, #PB_Sprite_AlphaBlending)
  ClipSprite(#Pickup0, 64, 0, 16, 16)
  ZoomSprite(#Pickup0, 32, 32)
  For k = 0 To 10
    CopySprite(#Sheet1, #Pickup1 + k, #PB_Sprite_AlphaBlending)
    ClipSprite(#Pickup1 + k, (16 * k), 16, 16, 16)
    ZoomSprite(#Pickup1 + k, 32, 32)
  Next
   
  Paddle(*state, paddleObj.Object, *state\width / 2 - 50, *state\height - 100)
  addObject(*state, paddleObj)
 
  Ball(*state, ballObj.Object, 0, 0)
  addObject(*state, ballObj)
 
  For x = 0 To 59;99
    tx = 50 + ((x % 10) * 70)
    ty = 100 + ((x / 10) * 50)
    Brick(*state, brickObj.Object, tx, ty, 1+(ty%3))
    addObject(*state, brickObj)
  Next
EndProcedure
Procedure isOffScreen(*this.Object, *state.State)
  If (*this\x < 0) : ProcedureReturn 1 ; left
  ElseIf (*this\x + *this\w > *state\width) : ProcedureReturn 2 ; right
  ElseIf (*this\y < 0) : ProcedureReturn 3 ; top
  ElseIf (*this\y + *this\h > *state\height) : ProcedureReturn 4 : EndIf ; bottom
  ProcedureReturn 0
EndProcedure
Procedure intersect2d(*o.Object, *b.Object)
  ax.d = *o\x
  ay.d = *o\y
  au.d = *o\x + *o\w
  av.d = *o\y + *o\h
   
  bx.d = *b\x
  by.d = *b\y
  bu.d = *b\x + *b\w
  bv.d = *b\y + *b\h
 
  If (ax <= bu And au >= bx And ay <= bv And av >= by)
    ProcedureReturn 1
  EndIf
  ProcedureReturn 0
EndProcedure
Procedure flush(*state.State)
  size = ArraySize(*state\objectsList())
  For i = 0 To size - 1 ; clean up objects that were marked for removal
    If (*state\objectsList(i)\removed = 1 Or (*state\objectsList(i)\expires > 0 And *state\dt > *state\objectsList(i)\expires))
      *addr = *state\objectsList(i)\fnDestructor;
      CallFunctionFast(*addr, *state\objectsList(i));
      ; i dont know how to properly resize arrays in purebasic so hopefully this won't be too slow :(
      *state\objectsList(i) = *state\objectsList(size - 1) ; swap removing object with one at end
      ReDim *state\objectsList.Object(size - 1)
      size = size -1; have to modify loop or bad things will happen
      i = i - 1; the object that was swapped must also be checked for removal
    EndIf
  Next

  n = ArraySize(*state\objectsQueue());
  If (n > 0) ; merge queued objects into the object list
    o = ArraySize(*state\objectsList());
    If (o >= 1000) ; this is just an arbitrary size limit for the number of objects to allow
      ReDim *state\objectsQueue(0);
      ProcedureReturn
    EndIf

    ReDim *state\objectsList(o+n);
    For k = 0 To n ; the merge part
      *state\uuidAccumulator = *state\uuidAccumulator + 1
      *state\objectsList(o+k) = *state\objectsQueue(k);
      *state\objectsList(o+k)\id = *state\uuidAccumulator
      If (*state\objectsList(o+k)\fnConstructor = @Paddle())
        *state\paddle = *state\objectsList(o+k)
      EndIf
    Next
    ReDim *state\objectsQueue(0)
  EndIf
EndProcedure

With game.State
  \width = 800
  \height = 800
  \running = 1
  \score = 0
  \continues = 1
  \now = ElapsedMilliseconds()
  \dt = ElapsedMilliseconds();
  Dim \objectsQueue.Object(0)
  Dim \objectsList.Object(0)
EndWith

InitSprite()
InitMouse()
UsePNGImageDecoder()

OpenWindow(0, 0, 0, game\width, game\height, "Nostalgia", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget);
OpenWindowedScreen(WindowID(0), 0, 0, game\width, game\height, #False, #Null, #Null, #PB_Screen_NoSynchronization ); 

init(game)
;-Loop
While game\running = 1
  Select WindowEvent()
    Case #PB_Event_CloseWindow
      game\running = 0
  EndSelect

  ExamineMouse()

  If (game\dt > game\drawing\tpst + 1000)
    game\drawing\tps = game\drawing\tpsc;
    game\drawing\tpsc = 0  ;
    game\logic\tps = game\drawing\tpsc;
    game\logic\tpsc = 0  ;
    game\drawing\tpst = game\dt ;
    game\logic\count1 = ArraySize(game\objectsList())
    game\logic\count2 = ArraySize(game\objectsQueue())
    remakeProfileSprite(game);
  EndIf
 
  flush(game)
 
  game\now = ElapsedMilliseconds();
  If (game\now - game\dt > 1000) ; skip some logic steps because previous one took too long
    game\dt = game\now;
  EndIf
 
  CopyStructure(@game, @prev.State, State) ; a copy of state to compare with after updating
  While game\dt < game\now ; step game objects at a constant rate
    game\dt = game\dt + 1000/30;
    update(game);
    game\logic\tpsc=game\logic\tpsc+1;
  Wend
 
  If (prev\score <> game\score Or prev\continues <> game\continues)
    remakeHUDSprite(game)
  EndIf
  If (prev\gameover <> game\gameover Or prev\active <> game\active)
    msg.s = "Click to start!"
    If (game\gameover = 2)
      msg.s = "Game over!!"
    ElseIf (game\gameover = 1)
      msg.s = "You win!"
    EndIf
    remakeGameOverSprite(game, msg)
  EndIf
   
  render(game)
  game\drawing\tpsc=game\drawing\tpsc+1; 
Wend




Hope everyone is still working on their stuff!! Stay safe out there!

_________________
▓▓▓▓▓▒▒▒▒▒░░░░░


Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Mon Jun 15, 2020 1:25 am 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1851
Been working mostly on modules and utilities, nothing too visually exciting :D

Ported the "BlurHash" algorithm to PureBasic
https://github.com/kenmo-pb/blurhash-purebasic
See https://blurha.sh for explanation

Released v1.3 of my PureBasic image viewer "Photon"
Webpage
Started because I hated the Windows 10 Photo Viewer :lol:

Just pushed a bunch of updates to my GitHub repo of PB includes
https://github.com/kenmo-pb/includes

Planning to soon release my "MenuManager" which automatically builds menus and keyboard shortcuts from an XML file


Eventually I will get back to work on PB IDE features!

_________________
On GitHub: PB Includes - IDE Tools - Color Themes - IDE Branches - TabBarGadget Mods


Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Thu Jul 09, 2020 1:51 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Jun 23, 2014 1:18 pm
Posts: 214
For a Company I worked on a little tool
Image

It generates an XSD (Multi-XSDs), Example XML based on RegEx-Tokes, CSV/Excel/Markdown/HTML (Plain and Confluence) Documentations


Last edited by Cyllceaux on Thu Jul 09, 2020 2:05 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Thu Jul 09, 2020 1:56 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Jun 23, 2014 1:18 pm
Posts: 214
Another tool is, I have a big database of icons.
Image
Image

This program generates imports codes and data-sections based on filetypes.

The "Import" Tab reads an existing file.


Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Thu Jul 09, 2020 2:14 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Jun 23, 2014 1:18 pm
Posts: 214
This tool enriches the DialogManager.
Image

You write your xml, this generates the codes. If files exists, it doesn't override existing procedures.
Each Dialog has his own types and structures based on its elements.

It uses some canvas-gui-elements to. so you can change on the fly gadget.

eg
Code:
<listicon name="lstTest"...
<col text="ID" width="100" flags="#integer" align="#right"/>
<col text="Name" width="100"/>
...

to
Code:
<canvas type="listEx" name="lstTest"...
<col text="ID" width="100" flags="#integer" align="#right"/>
<col text="Name" width="100"/>
...


you don't have to change the code, just the xml.


Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Sun Aug 02, 2020 9:25 pm 
Offline
Addict
Addict

Joined: Sat Jul 11, 2009 4:57 am
Posts: 943
Location: United States
Cyllceaux wrote:
*awesomeness*


yes!! this is EXACTLY what I wanted to see people post! MORE!!

i haven't done anything lately, been a plant hobo all summer long. gotta grow the taters!! :mrgreen: as soon as winter gets here i can't wait to sit down and start working on my project again. the thought about having a quadtree and 20k objects colliding with one another is exciting, but still daunting.

_________________
▓▓▓▓▓▒▒▒▒▒░░░░░


Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Mon Aug 03, 2020 6:43 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Jun 23, 2014 1:18 pm
Posts: 214
Here are some other things... but mostly for my own. https://www.purebasic.fr/english/viewtopic.php?f=17&t=75785


Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Mon Aug 03, 2020 5:41 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Jun 05, 2020 12:47 am
Posts: 119
I am working on a Point Of Sale program (almost finished, it is fully working now)

I did it on Amiga, back in 1993 or so, using Amos basic.

Around 2001 I made it on Blitz Basic, and now it is done in PureBasic.

I have been using it on my shop since then.

It is called "KISS-PoS" (Keep It Simple Stupid).


Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Tue Aug 04, 2020 10:22 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jan 22, 2016 5:33 pm
Posts: 134
Location: Spain
This thread would be good to get nice projects to show in the PB showcase page (very outdated).


Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Fri Sep 25, 2020 8:45 am 
Offline
Addict
Addict

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1641
Location: Somewhere in the midwest
I am currently working on not being in bed so I can get up for work...
I've been trying to get back into programming again. Unfortunately my interests are spread too thin, so we'll see if I stick around.

I came back because I was playing with GoDot and couldn't wrap my head around its GUI creation process, or the parent/child nesting issues I was having with something as simple as replicating the GoDot editors GUI layout... lol

So I started working on a solution for replacing the RichEdit (editor gadget) control, with Scintilla, for purposes related to the TextRPG I at one point actually wanted to make.
The past two nights have mostly been me tinkering around, consulting Scintilla and PB documentation (would you believe all the SCI messages related to scrolling and caret position flat out do not work? At least in PB... in the ways I tried. But I did solve the problem)
I don't have much to show but once I get over the hurdle of designing a series of steps to let me Style text at the character, or at least whole word level, I hope I will be able to write it all up neatly and maybe release the code as a PBI / module or something. If it works out I hope to test out how portable the code / results are on one of my linux virtual machines.

Wish me luck.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: What are you working on?
PostPosted: Fri Sep 25, 2020 11:30 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3549
Location: New Zealand
Zach wrote:
I am currently working on not being in bed so I can get up for work...


sounds like you need an RPG.
https://www.bbc.co.uk/programmes/articl ... ry-edition

You wake up. The room is spinning very gently round your head. Or at least is would be if you could see it which you cant!
It is pitch black.
>

I'm currently tinkering with a PB LLVM 10 front end, though it's not getting much attention at the moment.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye