CP - Alien Breed Remake - 7

Miscellaneous Forums/Blitz Showcase/CP - Alien Breed Remake - 7

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm playing with the editor, purely user-friendliness for now, to avoid having a complex manual. Just a quick update for now though. Replace the arrow key scrolling in editor.bb with the below to have the mouse do the same job on the edges of the map. Very handy for drawing long walls or big rooms...
	
	; map movement code (arrow keys)
	key_left=False:key_right=False:key_up=False:key_down=False	
	If (MouseX()<640 And MouseY()<480) Then 
		MouseOverMap = True 
		If MouseX()<5 Then key_left=True
		If MouseX()>635 Then key_right=True
		If MouseY()<5 Then key_up=True
		If MouseY()>475 Then key_down=True		
		If key_left Or key_right Or key_up Or key_down Then
			If Not mousescroll Then mousescroll=True:scrolldelay=setscrolldelay
		Else
			mousescroll=False
		End If
	Else
		MouseOverMap = False
	EndIf

	If KeyDown(205) Then key_right=True
	If KeyDown(203) Then key_left=True
	If KeyDown(200) Then key_up=True
	If KeyDown(208) Then key_down=True
	
	; slow down the scrolling a bit
	If scrolldelay < 0
		If key_right And sc_x<7552 Then sc_x=sc_x+32 : scrolldelay = setscrolldelay
		If key_left And sc_x>0 Then sc_x=sc_x-32 : scrolldelay = setscrolldelay
		If key_up And sc_y>0 Then sc_y=sc_y-32 : scrolldelay = setscrolldelay
		If key_down And sc_y<7552 Then sc_y=sc_y+32 : scrolldelay = setscrolldelay
	Else
		scrolldelay = scrolldelay - 1
	EndIf

Also, for better tooltips, replace (and add) the following to gui.bb
;;;;;;;;;;;;;;;;;;;;
; FUNCTION ToolTip ;
;;;;;;;;;;;;;;;;;;;;

Global tt_txt$,tt_x,tt_y,tt_w,tt_h

Function ToolTip(x,y,txt$)
	tt_txt$=txt$
	tt_w=StringWidth(txt$)+4
	tt_h=FontHeight()+4
	If x+tt_w+4>GraphicsWidth() Then tt_x=GraphicsWidth()-tt_w Else tt_x=x
	If y+tt_h+4>GraphicsHeight() Then tt_y=GraphicsHeight()-tt_h Else tt_y=y
End Function

Function DrawToolTip()
	If tt_txt$<>"" Then
		Color 255,255,225
		Rect tt_x,tt_y,tt_w,tt_h,True
		Color 0,0,0
		Rect tt_x,tt_y,tt_w,tt_h,False
		Text tt_x+2,tt_y+2,tt_txt$
		tt_txt$=""
	End If
End Function

And add DrawToolTip() just before all Flips.

Nothing uses this as yet, but I intend to add some to the main editor screen...