#region "Uses"
uses "tbgl", "file", "ui"
#endRegion
type mousecur
position as POINTAPI
direction as Integer
end type
type mycolors
red as byte
green as Byte
blue as Byte
end type
dword htbgl 'handler for draw window
integer max_x = 1280' window dimensions
integer max_y = 720
dim mymouse as mousecur 'Cursor state
dim perfect as Boolean 'toggle for pixel perfect
dim black, white, gray, green, red, orange, blue as mycolors
white.red=255
white.green=255
white.blue=255
gray.red=50
gray.green=50
gray.blue=50
green.green=250
red.red=250
blue.green=125
blue.blue=250
orange.red=250
orange.green=125
function tbMain()
call myini
call draw_loop
tbgl_destroyWindow
end function
function myini()
'Display settings
htbgl = TBGL_CreateWindowEx ("[ ESC ] to quit - [ T ] toggle PERFECT PIXEL_2D ** OFF **", max_x, max_y, 32, %TBGL_WS_WINDOWED | %TBGL_WS_DONTSIZE)
tbgl_ShowWindow
TBGL_ShowCursor false
TBGL_UseVSync true
TBGL_RenderMatrix2D(1, 1, max_x, max_y)
TBGL_Color_set (white)
TBGL_BackColor_set (black)
tbgl_ResetKeyState()
'Font settings
TBGL_UseTexturing (False)
end Function
Function draw_loop()
' -- Main loop
While tbgl_IsWindow(htbgl)
If tbgl_GetWindowKeyState(htbgl, %VK_ESCAPE) Then Exit While
If TBGL_GetWindowKeyOnce(htbgl, %VK_T) then
perfect = not perfect
if perfect then
TBGL_RenderMatrix2D(1,1,max_x,max_y)
TBGL_SetWindowTitle( htbgl, "[ ESC ] to quit - [ T ] toggle PERFECT PIXEL_2D ** OFF **" )
Else
TBGL_RenderMatrix2D(1,1,max_x,max_y, %TBGL_PIXEL_PERFECT_2D)
TBGL_SetWindowTitle( htbgl, "[ ESC ] to quit - [ T ] toggle PERFECT PIXEL_2D ** ON **" )
endif
endif
tbgl_clearFrame
call draw_mouse
call draw_lines
call draw_mouse_cross
tbgl_drawFrame
Wend
end Function
function draw_mouse()
dim position as Integer
mymouse.position.x=TBGL_MouseGetPosX
mymouse.position.y=max_y-TBGL_MouseGetPosy
end function
function draw_lines()
integer ii, jj
for ii = 1 to max_x Step 10
for jj = 1 to max_y step 10
tbgl_line(ii,jj,ii+7,jj+7) ' regular dashes
next ii
next jj
end function
function draw_mouse_cross()
TBGL_PushColor_set(green)
Tbgl_line(mymouse.position.x,1,mymouse.position.x,max_y)
Tbgl_line(1,mymouse.position.y,max_x,mymouse.position.y)
TBGL_PopColor
end function
function TBGL_Color_set (mycolor as mycolors)
TBGL_Color(mycolor.red,mycolor.green,mycolor.blue)
end function
function TBGL_BackColor_set (mycolor as mycolors)
TBGL_BackColor(mycolor.red,mycolor.green,mycolor.blue)
end function
function TBGL_PushColor_set (mycolor as mycolors)
TBGL_PushColor(mycolor.red,mycolor.green,mycolor.blue)
end function
In the meantime, this is a fix for your observation:
Bookmarks