I've also been experimenting with an editing grid for a program I'm working on. The code below is what I'm currently using to do the grid.
It requires a 256 x 256 texture with 10 pixel wide opaque lines across the top and down the left side, and with the remainder of the image transparent.
; -- Setup code.
; -- Grid positioning variables.
Global grid_height#
Global grid_height_spacer# = 0.003
Global grid_scale# = 1.0
;^^^^^^
Global grid = CreatePlane ()
Global grid_tex = LoadTexture ( "C:\Documents and Settings\Owner\Desktop\B3D VIEWER\media\images\Copy3 of Copy of grid.png", 11 )
EntityTexture grid, grid_tex
EntityFX grid, 13
MoveEntity grid, -0.0195312, grid_height_spacer#, -0.0195312
the_grid2 = CopyEntity ( grid, grid )
MoveEntity the_grid2, 0.0, -grid_height_spacer#, 0.0
ScaleEntity the_grid2, 1.0, -1.0, 1.0, True
; -- Update function.
Function move_and_size_grid()
If KeyHit ( 18 ) ; The 'E' key.
grid_height# = grid_height# + grid_scale#
PositionEntity grid, -0.0195312, grid_height# + grid_height_spacer#, -0.0195312, True
do_update = True
EndIf
If KeyHit ( 16 ) ; The 'Q' key.
grid_height# = grid_height# - grid_scale#
PositionEntity grid, -0.0195312, grid_height# + grid_height_spacer#, -0.0195312, True
do_update = True
EndIf
If KeyHit ( 13 ) ; The '+/=' key.
grid_scale# = grid_scale# * 2.0
ScaleTexture grid_tex, grid_scale#, grid_scale#
do_update = True
EndIf
If KeyHit ( 12 ) ; The '-/_' key.
grid_scale# = grid_scale# / 2.0
ScaleTexture grid_tex, grid_scale#, grid_scale#
do_update = True
EndIf
End Function
It requires a 256 x 256 texture with 10 pixel wide opaque lines across the top and down the left side, and with the remainder of the image transparent.
; -- Setup code.
; -- Grid positioning variables.
Global grid_height#
Global grid_height_spacer# = 0.003
Global grid_scale# = 1.0
;^^^^^^
Global grid = CreatePlane ()
Global grid_tex = LoadTexture ( "C:\Documents and Settings\Owner\Desktop\B3D VIEWER\media\images\Copy3 of Copy of grid.png", 11 )
EntityTexture grid, grid_tex
EntityFX grid, 13
MoveEntity grid, -0.0195312, grid_height_spacer#, -0.0195312
the_grid2 = CopyEntity ( grid, grid )
MoveEntity the_grid2, 0.0, -grid_height_spacer#, 0.0
ScaleEntity the_grid2, 1.0, -1.0, 1.0, True
; -- Update function.
Function move_and_size_grid()
If KeyHit ( 18 ) ; The 'E' key.
grid_height# = grid_height# + grid_scale#
PositionEntity grid, -0.0195312, grid_height# + grid_height_spacer#, -0.0195312, True
do_update = True
EndIf
If KeyHit ( 16 ) ; The 'Q' key.
grid_height# = grid_height# - grid_scale#
PositionEntity grid, -0.0195312, grid_height# + grid_height_spacer#, -0.0195312, True
do_update = True
EndIf
If KeyHit ( 13 ) ; The '+/=' key.
grid_scale# = grid_scale# * 2.0
ScaleTexture grid_tex, grid_scale#, grid_scale#
do_update = True
EndIf
If KeyHit ( 12 ) ; The '-/_' key.
grid_scale# = grid_scale# / 2.0
ScaleTexture grid_tex, grid_scale#, grid_scale#
do_update = True
EndIf
End Function