Code: Select all
Procedure DrawGlowText(x.i, y.i, text$,glowcolor,textcolor=16777215)
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(x-2, y , text$,glowcolor)
DrawText(x+2, y , text$,glowcolor)
DrawText(x , y+2, text$,glowcolor)
DrawText(x , y-2, text$,glowcolor)
DrawText(x-1, y-1, text$,glowcolor)
DrawText(x+1, y+1, text$,glowcolor)
DrawText(x+1, y-1, text$,glowcolor)
DrawText(x-1, y+1, text$,glowcolor)
DrawText(x , y, text$,textcolor)
EndProcedure
Procedure DrawGlowMouseText(x.i, y.i, text$, glowcolor, textcolor, mousexpos, mouseypos)
DrawingMode(#PB_2DDrawing_Transparent)
If mousexpos>x And mousexpos<x+TextWidth(text$) And mouseypos>y And mouseypos<y+TextHeight(text$)
DrawText(x-2, y , text$,glowcolor)
DrawText(x+2, y , text$,glowcolor)
DrawText(x , y+2, text$,glowcolor)
DrawText(x , y-2, text$,glowcolor)
DrawText(x-1, y-1, text$,glowcolor)
DrawText(x+1, y+1, text$,glowcolor)
DrawText(x+1, y-1, text$,glowcolor)
DrawText(x-1, y+1, text$,glowcolor)
EndIf
DrawText(x , y, text$,textcolor)
EndProcedure
Code: Select all
;draw glow text example
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
MessageRequester("Error", "Modules can't be initialized", 0)
End
EndIf
Procedure DrawGlowText(x.i, y.i, text$,glowcolor,textcolor=16777215)
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(x-2, y , text$,glowcolor)
DrawText(x+2, y , text$,glowcolor)
DrawText(x , y+2, text$,glowcolor)
DrawText(x , y-2, text$,glowcolor)
DrawText(x-1, y-1, text$,glowcolor)
DrawText(x+1, y+1, text$,glowcolor)
DrawText(x+1, y-1, text$,glowcolor)
DrawText(x-1, y+1, text$,glowcolor)
DrawText(x , y, text$,textcolor)
EndProcedure
Procedure DrawGlowMouseText(x.i, y.i, text$, glowcolor, textcolor, mousexpos, mouseypos)
DrawingMode(#PB_2DDrawing_Transparent)
If mousexpos>x And mousexpos<x+TextWidth(text$) And mouseypos>y And mouseypos<y+TextHeight(text$)
DrawText(x-2, y , text$,glowcolor)
DrawText(x+2, y , text$,glowcolor)
DrawText(x , y+2, text$,glowcolor)
DrawText(x , y-2, text$,glowcolor)
DrawText(x-1, y-1, text$,glowcolor)
DrawText(x+1, y+1, text$,glowcolor)
DrawText(x+1, y-1, text$,glowcolor)
DrawText(x-1, y+1, text$,glowcolor)
EndIf
DrawText(x , y, text$,textcolor)
EndProcedure
If OpenWindow(0, 0, 0, 650, 490, "Game Menu", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
If OpenWindowedScreen(WindowID(0), 5, 5, 640, 480, 0, 0, 0) = 0
MessageRequester("Error", "Can't open windowed screen!", 0)
End
EndIf
; == Main loop ==
Repeat
; window event loop
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
EndSelect
Until Event = 0
ExamineKeyboard()
ExamineMouse()
mouseX = MouseX()
mouseY = MouseY()
ClearScreen(RGB(55,55,55))
StartDrawing(ScreenOutput())
DrawGlowMouseText(200,200,"Draw Glow Mouse Text 1",RGB(255,0,0),RGB(255,255,255),mouseX,mouseY)
DrawGlowMouseText(200,225,"Draw Glow Mouse Text 2",RGB(255, 255, 0),RGB(0,0,0),mouseX,mouseY)
DrawGlowText(50, 100, "X: "+Str(mouseX)+" Y: "+Str(mousey),RGB(0,0,255))
DrawGlowText(50, 125, "Hello World !",RGB(0,0,0))
DrawGlowText(50, 150, "Hello World !",RGB(0,0,255),RGB(255,0,0))
DrawText(50, 175, "Hello World !", RGB(255,255,255))
Box(mouseX, mouseY, 2, 2) ; epic mouse pointer :)
StopDrawing()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
EndIf
End