Mintoris
Jul 19, 2018, 03:53 PM *
Welcome, Guest.

login

register

Did you miss your activation email?


Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2 3 ... 10
 1 
 on: Jul 18, 2018, 04:05 PM 
Started MikeHersee - Last post by Chuck
Check out the link below. I think ArrayLists are what you are looking for.

Data Structures

 2 
 on: Jul 18, 2018, 08:42 AM 
Started Crazy C - Last post by Chuck
There is a new parameter on the GenFont command in 7.5.17.

font = GenDefaultFont({style, charsize, charsPerRow, charset$, mode})

font = GenFont(fontPath$ {, charsize, charsPerRow, charset$, mode})


if mode is 0 or not specified, the font is created in the old mode for backwards compatibility.

if mode is 1 then the new font method that we developed is used.

 3 
 on: Jul 17, 2018, 10:22 AM 
Started MikeHersee - Last post by MikeHersee
I was looking for a linked list data structure and didn't find one. Specifically, what I want is an array of linked lists. The reason I want it is for a particle simulation program, where you have a large number of particles to simulate. Rather than comparing the distance between each particle to each other particle to see if they're in influence range of each other each cycle, I will have lumped each particle into rough blocks, and then only need to compare a much smaller number of particles each time. Linked lists are better for this as the number of particles in each block will constantly vary, but the overall size won't vary much at all.

I know it might seem unnecessarily complicated to save what might appear to be a small amount of time, but when the number of particles goes up, the number of comparisons goes up exponentially. And I'm developing the code in principle here to be eventually transferred to a pc when it gets to be 3D, and that's when the number of particle distance comparisons becomes ridiculous in relation to the number of particles that influence each other.

So that's why an array of linked lists would be helpful. I can simulate it with arrays, but the code will be more complicated

 4 
 on: Jul 16, 2018, 01:29 PM 
Started Stonemonkey - Last post by Chuck
The drawing can be done outside the interrupt, but continue to do the GenReloadAtlas in the interrupt to avoid flicker. If the update doesn't happen very often then you can do the whole thing outside the interrupt. You can also slow the interrupt down as much as you like. Make it run once a sec if you like.

Oh, also in the example the 60ms is the time between each execution, but that does not limit how long it takes the interrupt to run. So, your drawing can take as long as it needs.


 5 
 on: Jul 16, 2018, 01:25 PM 
Started Stonemonkey - Last post by Stonemonkey
Thanks very much, that's great. I'll have a play around with it and let you know how it goes.
I take it the method of update in the example runs off interrupts, what if the drawing of the overlay takes more than 1/60th sec or if its called in the middle of the code carrying out my calculations?

 6 
 on: Jul 16, 2018, 09:30 AM 
Started Stonemonkey - Last post by Chuck
Basic 7.5.17 has been released. I've also added a new example program GEN005 Bitmap Graphics Overlay in the tutorial section of the game engine board. This example shows how to use the background timer to update the overlay. Using the timer syncs the overlay update with the game engine screen refresh for a flicker free display. Please let me know how things work out.


 7 
 on: Jul 15, 2018, 06:50 PM 
Started Mintoris - Last post by Mintoris
This example requires Basic 7.5.17 or higher to run.

Here is an example program showing how to use conventional graphics drawing commands in the game engine mode. This program draws a simple overlay pattern on the screen. The same technique could be used to dynamically draw on sprites.

Code:
' Camera Feed Overlay
' Written By: Charles Charbonneau
' 07-09-18

include "Game Engine Constants.inc"

init()

do
wait 1000
loop


Sub init()

  Global screenWidth = 2048
  Global screenHeight = 1024

  ' Set the orientation and turn on the Game Engine

  Orientation 2  
  GameEngine On, screenWidth, screenHeight
  GenCameraFeed on

  ' Make the background transparent
  ' so you can see the camera view
  GenSetBackgroundColor 0,0,0,0
 
  Global offset = 1
  Global inc = 4

  ' Create a tile overlay
  Global overlay = GenTileAtlas(screenWidth, screenHeight)

  ' Create the Overlay bitmap
  Global bmOverlay = CreateBitmap(screenWidth, screenHeight)

  ' Set the drawing surface to the star bitmap
  SetDrawingSurface bmOverlay

  ' Put the font into the overlay
  tileset = GenTileSet(bmOverlay)
  GenMapToAtlas overlay,  tileset, 0, 0

  ' Load the overlay into the GPU
  GenLoadAtlas overlay

  background = GenBackground(Background_Fixed, tileset)
  GenSetBackground background

  ' Set the overlay update sub
  SetOnGenBackgroundModifierSub background, onBackgroundUpdate()
  GenSetBackgroundTimerA background, 60

End Sub


Sub onBackgroundUpdate(background, type)

 ' Draw the overlay
  color 0,0,0,0
  cls
  Color 0, 100, 0, 100
  strokewidth 4
  line 0, 0 + offset, screenWidth, screenHeight - offset
  line 0, screenHeight - offset, screenWidth, 0 + offset

  ' Update the overlay
  GenReloadAtlas overlay

  if offset < 1 or offset > 511 then inc = inc * -1
  offset = offset + inc

  ' Repeat in 60 ms
  GenSetBackgroundTimerA background, 60

End Sub

 8 
 on: Jul 14, 2018, 03:59 PM 
Started FabianClub - Last post by Chuck
I remember every suggestion I read and keep them in mind as I re-write the relavent section.

 9 
 on: Jul 12, 2018, 11:59 PM 
Started Stonemonkey - Last post by Stonemonkey
That's great, thanks. Can't wait to try this out.

 10 
 on: Jul 12, 2018, 08:17 PM 
Started Stonemonkey - Last post by Mintoris
I've found and fixed the memory leak issue. Graphics are moving nice and smooth and I will leave the test running for a few hours. I have a few other issues to check out but hope to have a release in a few days.

Pages: [1] 2 3 ... 10
Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.041 seconds with 15 queries.