DrawText FastImage

Blitz3D Forums/Blitz3D Programming/DrawText FastImage

Yue(Posted 2010) [#1]
Function Opciones_Video()
	
	
	
	
	
	Local MX=MouseX(),MY = MouseY()
	
	
	
	If Tipo_Pantalla = 1
		Local PYMarco   = 550
		Local PYRePa    = 480
		Local PYTN      = 450
		Local PYFlechas  = 470
	Else
		PYMarco   = 625
		PYRePa    = 550
		PYTN      = 520
		PYFlechas = 543
	End If 
	
	
		
		StartDraw
		SetAlpha .6
		
		;-----------------------------
		; Marco Fondo Menu
		;-----------------------------
		DrawImageEx Marco1,GraphicsWidth()-490,GraphicsHeight()-PYMarco
		
		
		SetAlpha 1
		
		;-----------------------------
		; Rotulos Informativos Menu
		;-----------------------------
		DrawText ("RESOLUCION PANTALLA",GraphicsWidth()-25,GraphicsHeight()-PYRePa,100,100)
		If Tipo_Pantalla = 1 DrawText ("800 x 600",GraphicsWidth()-65,GraphicsHeight()-PYTN,100,100)
			If Tipo_Pantalla = 2 DrawText ("1024 x 768",GraphicsWidth()-60,GraphicsHeight()-PYTN,100,100)
				
				DrawText("GAMMA",GraphicsWidth()-80,GraphicsHeight()-PYTN+30,100,100)
				
				
				
				DrawText(n/10+"%",GraphicsWidth()-93,GraphicsHeight()-PYTN+50,100,100)
				
				DrawText("ANTIALIAS",GraphicsWidth()-135,GraphicsHeight()-PYTN+135)	
				DrawText("TURBO",GraphicsWidth()-135,GraphicsHeight()-PYTN+164)
				
								
				DrawText("CALIDAD SOMBRAS",GraphicsWidth()-40,GraphicsHeight()-PYTN+80,100,100)
									
				If  Calidad = 0  DrawText("BAJA",GraphicsWidth()-85,GraphicsHeight()-PYTN+110,100,100) 
											
					If  Calidad = 1 DrawText("MEDIA",GraphicsWidth()-85,GraphicsHeight()-PYTN+110,100,100)
						If Calidad = 2 DrawText("ALTA",GraphicsWidth()-85,GraphicsHeight()-PYTN+110,100,100)
							If Calidad = -1 DrawText("SIN SOMBRAS",GraphicsWidth()-57,GraphicsHeight()-PYTN+110,100,100)
														
								
														
								DrawRect (GraphicsWidth()-172,GraphicsHeight()-PYTN+195,150,75,0)											
														
														SetScale .5,.5
														
														
														
														
														
														
		;-----------------------------
		; Flechas -Mouse Move- R.
		;-----------------------------
		If TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas,B_Derecho,255) = False 
			DrawImageEx (B_Derecho,GraphicsWidth()-50,GraphicsHeight()-PYFlechas)
			
		ElseIf TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas,B_Derecho,255) = True 
			SetColor 255,0,0
			DrawImageEx (B_Derecho,GraphicsWidth()-50,GraphicsHeight()-PYFlechas)
			SetColor 255,255,255
			
			SetScale 1,1
			DrawTextRect ("Valores Altos mejoran la calidad gráfica y se puede afectar el rendimiento",GraphicsWidth()-170,GraphicsHeight()-PYTN+200,150,1,4,0)
			SetScale .5,.5
			
		End If
		
		
		If TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas,B_Izquierdo,255) = False 
			DrawImageEx (B_Izquierdo,GraphicsWidth()-180,GraphicsHeight()-PYFlechas)
			
		ElseIf TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas,B_Izquierdo,255) = True 
			SetColor 255,0,0
			DrawImageEx (B_Izquierdo,GraphicsWidth()-180,GraphicsHeight()-PYFlechas)
			SetColor 255,255,255
			
			SetScale 1,1
			DrawTextRect ("Valores Bajos aumentan el rendimiento, y afectan la calida gráfica.",GraphicsWidth()-170,GraphicsHeight()-PYTN+200,150,1,4,0)
			SetScale .5,.5
			
		End If
		
		
		
		;-----------------------------
		; Flechas -Click Mouse- R.
		;-----------------------------
		If TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas,B_Derecho,255) And MouseDown(1)
			SetColor 0,255,0
			DrawImageEx (B_Derecho,GraphicsWidth()-50,GraphicsHeight()-PYFlechas)
			Estado = True 
			SetColor 255,255,255
			
			
		ElseIf TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas,B_Derecho,255) And MouseDown(1) = False And Estado = True 
			Estado = True 
			
			
			
			
			
			If Tipo_Pantalla = 1
				Tipo_Pantalla = 2
				Alto_Pantalla = 768
				Ancho_Pantalla = 1024
				Profundidad_Pantalla = 0
				
			Else
				Tipo_Pantalla = 1
				Alto_Pantalla = 600
				Ancho_Pantalla = 800
				Profundidad_Pantalla = 32
				
			End If 
			
			CambiandoR = True
			PlaySound (Sonido_Click)
			Actualizar()
			
			
			
		End If		
		
		
		If TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas,B_Izquierdo,255) And MouseDown(1) 
			SetColor 0,255,0
			DrawImageEx (B_Izquierdo,GraphicsWidth()-180,GraphicsHeight()-PYFlechas)
			Estado = True 
			SetColor 255,255,255
		ElseIf TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas,B_Izquierdo,255) And MouseDown(1)= False And Estado = True 
			Estado = False 
			If Tipo_Pantalla = 2
				
				Tipo_Pantalla = 1
				Alto_Pantalla = 600
				Ancho_Pantalla = 800
				Profundidad_Pantalla = 0
				
			Else
				
				Tipo_Pantalla = 2
				Alto_Pantalla = 768
				Ancho_Pantalla = 1024
				Profundidad_Pantalla = 0
				
			End If 
			
			PlaySound (Sonido_Click)
			Actualizar()
			CambiandoR = True
			
		End If
		
		
		
		;-----------------------------
		; Flechas -Mouse Move- Gamma.
		;-----------------------------
		If TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+50,B_Derecho,255) = False 
			DrawImageEx (B_Derecho,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+50)
		ElseIf TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+50,B_Derecho,255) = True 
			SetColor 255,0,0
			DrawImageEx (B_Derecho,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+50)
			SetColor 255,255,255
			SetScale 1,1
			DrawTextRect ("Aumenta el brillo de la pantalla, estableciendo parametros a su gusto.",GraphicsWidth()-170,GraphicsHeight()-PYTN+200,150,1,4,0)
			SetScale .5,.5
			
			
		End If
		
		
		If TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+50,B_Izquierdo,255) = False 
			DrawImageEx (B_Izquierdo,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+50)
		ElseIf TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+50,B_Izquierdo,255) = True 
			SetColor 255,0,0
			DrawImageEx (B_Izquierdo,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+50)
			SetColor 255,255,255
			
			SetScale 1,1
			DrawTextRect ("Disminuye el brillo de la pantalla, por si cree que esta muy brillante.",GraphicsWidth()-170,GraphicsHeight()-PYTN+200,150,1,4,0)
			SetScale .5,.5
			
		End If		
		
		
		
		
		;-----------------------------
		; Flechas -Click Mouse- Gamma.
		;-----------------------------
		If TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+50,B_Derecho,255) And MouseDown(1)
			SetColor 0,255,0
			DrawImageEx (B_Derecho,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+50)
			Estado = True 
			SetColor 255,255,255
		ElseIf TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+50,B_Derecho,255) And MouseDown(1) = False And Estado = True 
			Estado = True 
			PlaySound (Sonido_Click)
			n=n+10
			Actualizar()
		End If		
		
		
		If TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+50,B_Izquierdo,255) And MouseDown(1) 
			SetColor 0,255,0
			DrawImageEx (B_Izquierdo,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+50)
			Estado = True 
			SetColor 255,255,255
		ElseIf TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+50,B_Izquierdo,255) And MouseDown(1)= False And Estado = True 
			Estado = False 
			PlaySound (Sonido_Click)
			n=n-10
			
			Actualizar()
			
			
			
		End If
		
		
		
		
		
		;-----------------------------
		; Flechas -Mouse Move- Sombras.
		;-----------------------------
		If TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+110,B_Derecho,255) = False 
			DrawImageEx (B_Derecho,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+110)
		ElseIf TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+110,B_Derecho,255) = True 
			SetColor 255,0,0
			DrawImageEx (B_Derecho,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+110)
			SetColor 255,255,255
			
			SetScale 1,1
			DrawTextRect ("Entra mas alta  mas detalle de la Sombra, puede afectar el rendimiento.",GraphicsWidth()-170,GraphicsHeight()-PYTN+200,150,1,4,0)
			SetScale .5,.5
			
		End If
		
		
		If TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+110,B_Izquierdo,255) = False 
			DrawImageEx (B_Izquierdo,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+110)
		ElseIf TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+110,B_Izquierdo,255) = True 
			SetColor 255,0,0
			DrawImageEx (B_Izquierdo,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+110)
			SetColor 255,255,255
			SetScale 1,1
			DrawTextRect ("Entre mas baja menos detalle de la Sombra. Esto  aumenta el rendimiento.",GraphicsWidth()-170,GraphicsHeight()-PYTN+200,150,1,4,0)
			SetScale .5,.5
			
		End If		
		
		
		
		;--------------------------------
		; Flechas -Click Mouse- Sombras.
		;--------------------------------
		If TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+110,B_Derecho,255) And MouseDown(1)
			SetColor 0,255,0
			DrawImageEx (B_Derecho,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+110)
			Estado = True 
			SetColor 255,255,255
		ElseIf TestImage(MX,MY,GraphicsWidth()-50,GraphicsHeight()-PYFlechas+110,B_Derecho,255) And MouseDown(1) = False And Estado = True 
			Estado = True 
			
			Calidad = Calidad +1
			If Calidad => 2 Calidad = 2
				CambiandoS = True
				Actualizar()
				PlaySound (Sonido_Click)
		End If		
		
		
		If TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+110,B_Izquierdo,255) And MouseDown(1) 
			SetColor 0,255,0
			DrawImageEx (B_Izquierdo,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+110)
			Estado = True 
			SetColor 255,255,255
		ElseIf TestImage(MX,MY,GraphicsWidth()-180,GraphicsHeight()-PYFlechas+110,B_Izquierdo,255) And MouseDown(1)= False And Estado = True 
			Estado = False 
			
			Calidad = Calidad - 1
			If Calidad < -1 Calidad = -1
			CambiandoS = True 
			
			Actualizar()
			PlaySound (Sonido_Click)
			
			
			
		End If		
		
		
		;-----------------------------
		; Opcion AntiAlias 
		;-----------------------------		
		SetScale .6,.6
		If AAlias = False DrawImageEx(Opcion,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+153)
		If AAlias = True  DrawImageEx(Opcion1,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+153)
			
			
			
			If Turbo = True 	DrawImageEx(Opcion,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+183)
				If Turbo = False  DrawImageEx(Opcion1,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+183)
				
		
			
					
				
				
				
				;-----------------------------
				; Estableciendo AntiAlias
				;-----------------------------
				
				If TestImage(MX,MY,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+153,Opcion,255) And MouseDown(1) 
					
					
					Estado = True 
					
				ElseIf TestImage(MX,MY,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+153,Opcion,255) And MouseDown(1)= False And Estado = True  And AAlias = False 
					Estado = False 
					
					AAlias = True 
					Actualizar()
					PlaySound (Sonido_Click)
				End If 
				
				;-----------------------------
				; Desactivando AntiAlias
				;-----------------------------
				If TestImage(MX,MY,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+153,Opcion1,0) And MouseDown(1) 
					
					
					Estado = True 
					
				ElseIf TestImage(MX,MY,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+153,Opcion1,0) And MouseDown(1)= False And Estado = True  And AAlias = True
					Estado = False 
					
					AAlias = False  
					Actualizar()
					PlaySound (Sonido_Click)
				End If				
				
				
				
				;-----------------------------
				; Mose Move Antialias
				;-----------------------------
				If TestImage(MX,MY,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+153,Opcion1,0)
					SetScale 1,1
					DrawTextRect ("Alisa los bordes dentados. Si la configuracion de Harware lo permite.",GraphicsWidth()-170,GraphicsHeight()-PYTN+200,150,1,4,0)
					
				End If 
				;-----------------------------
				; Estableciendo Turbo
				;-----------------------------
				
				If TestImage(MX,MY,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+183,Opcion,255) And MouseDown(1) 
					
					
					Estado = True 
					
				ElseIf TestImage(MX,MY,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+183,Opcion,255) And MouseDown(1)= False And Estado = True  And Turbo = True  
					Estado = False 
					
					Turbo = False 
					Actualizar()
					PlaySound (Sonido_Click)
				End If 
				
				;-----------------------------
				; Desactivando Turbo
				;-----------------------------
				If TestImage(MX,MY,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+183,Opcion1,0) And MouseDown(1) 
					
					
					Estado = True 
					
				ElseIf TestImage(MX,MY,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+183,Opcion1,0) And MouseDown(1)= False And Estado = True  And Turbo = False 
					Estado = False 
					
					Turbo  = True   
					Actualizar()
					PlaySound (Sonido_Click)
				End If
				
				;-----------------------------
				; Mouse Move Turbo
				;-----------------------------
				If TestImage(MX,MY,GraphicsWidth()-175,GraphicsHeight()-PYFlechas+183,Opcion,255)
					SetScale 1,1
					DrawTextRect ("Como última alrternativa en caso de bajo rendimiento, active el turbo.",GraphicsWidth()-170,GraphicsHeight()-PYTN+200,150,1,4,0)
				End If 
				
				
				SetScale 1,1
				
				
				;-----------------------------
				; Boton Rregresar Mouse Move
				;-----------------------------
				
				
				
				
				If TestImage(MX,MY,GraphicsWidth()-160,GraphicsHeight()-PYFlechas+270,Boton_Regresar,255) = False 
					DrawImageEx(Boton_Regresar,GraphicsWidth()-160,GraphicsHeight()-PYFlechas+270)
					
				ElseIf TestImage(MX,MY,GraphicsWidth()-160,GraphicsHeight()-PYFlechas+270,Boton_Regresar,255) = True 
					
					DrawImageEx(Boton_RegresarV,GraphicsWidth()-160,GraphicsHeight()-PYFlechas+270)
					
					
					
					
				End If
				
				
				;-----------------------------
				; Boton Rregresar Click
				;-----------------------------	
				
				If TestImage(MX,MY,GraphicsWidth()-160,GraphicsHeight()-PYFlechas+270,Boton_Regresar,255) And MouseDown(1) 
					
					DrawImageEx(Boton_RegresarV1,GraphicsWidth()-160,GraphicsHeight()-PYFlechas+270)
					Estado = True 
					
				ElseIf TestImage(MX,MY,GraphicsWidth()-160,GraphicsHeight()-PYFlechas+270,Boton_Regresar,255) And MouseDown(1)= False  And Estado = True 
					Estado = False 
					
					
					PlaySound (Sonido_Click)
					Menu = 2
					
				End If	
				
				
				
				
				
		EndDraw 
		
		
		
		
		
		
		
		
		
		
		
		If n => 100 n = 100
			
			If n <= -100 n = -100
		
				
		
		
	
		
	
	
	
	
	
	
				Mouse()
End Function 


Hi, I have a problem, the above function creates a menu of options and I'm using DrawText to display informational signs.




Particularly at the start goes well, the problem is that after entering the level 1 and return to the main menu to do this about four times, Menu Level 1 Menu Tier 1 star and get this.


So it runs three or four times without problems and is not it may be. to remove all functions DrawText and DrawtextRect.

Works fine.