Paint a texture.

Started by Santiago, April 09, 2020, 04:35:20

Previous topic - Next topic

Santiago

Hello, I have the following dilemma.

I found that making a menu using a shot in front of the camera, and drawing the menu in a texture buffer is very efficient.

The problem I have is that I don't know how to convert my Mousex () & mousey () position to the strings inside the texture.

It would be as if I wanted to paint a texture with the cursor, I remember seeing examples, but I can't find any, would they help me with that?


my menu method works like this. but i use a local mousex and mousey to draw a cursor inside the texture, but i need to use the real mouse screen.


Global camp_ventana
Global camp_textura
Global camp_show_ventana
Global camp_map_texture

Function update_campaing_3d(directorio$) ; PARTIDA CAMPAÑA   3d

DebugLog "INICIANDO CAMPAIGN MENU " + directorio
Local tam = 1024
Local margen = 11
Local escala = 5

Local pivot3d = CreatePivot()
Local pivot_selected = CreatePivot()

Local selected = 0

Local pointer_x#
Local pointer_z#

Local zoom# = 1

map_scale# =.1

c.campaing = First campaing

If camp_ventana = 0 Then
camp_ventana = LoadMesh("maps\sprite.b3d")
ScaleMesh camp_ventana,eo,eo,eo
ScaleEntity camp_ventana,2*escala,2*escala,2*escala
Else
DebugLog "GRAVE ERROR 1"

End If

;update_texture
If camp_textura = 0 Then
camp_map_texture = LoadTexture("maps\map.bmp")
EntityTexture camp_ventana,camp_map_texture
camp_textura = CreateTexture(tam,tam,g_vram_texture*256)
refresh = 1
Else
DebugLog "GRAVE ERROR 2"
End If

PositionEntity cam,0,0,0
RotateEntity cam,0,0,0
CameraRange cam,.001,1000
CameraZoom cam,1
ShowEntity camp_ventana
pos camp_ventana,cam
rot camp_ventana,cam
MoveEntity camp_ventana,0,0,2*escala
PointEntity camp_ventana,cam,-EntityRoll(cam,1)
EntityOrder camp_ventana,-500
EntityFX camp_ventana,1
EntityAlpha camp_ventana,1
EntityPickMode camp_ventana,2

While salir = 0
update_mouse_rel()
mouse_limited(margen,margen,tam-margen,tam-margen)

SetBuffer TextureBuffer(camp_textura)
....




Santiago