RayGUI Example

new topic     » topic index » view thread      » older message » newer message

Hi all,

Well after some snags here and there, I've finally been able to wrap RayGUI for Euphoria. However I can't get this example to work correctly. You should be able to drag the gui window inside the main raylib window, but it doesn't move at all.

EuRayGUI Repo: https://github.com/gAndy50/EuRayGUI

Trying to make a euphoria version of this: https://github.com/raysan5/raygui/blob/master/examples/portable_window/portable_window.c

Oh yeah, thanks again Greg!

EDIT: 1/10/24 Alright, still can't figure out why none of the values are changing even though I basically made a euphoria version of portable_window.c

include std/ffi.e 
 
include raylib.e 
include raygui.e 
 
constant WIDTH = 800 
constant HEIGHT = 600 
 
constant TRUE = 1, FALSE = 0 
 
SetConfigFlags(FLAG_WINDOW_UNDECORATED) 
InitWindow(WIDTH,HEIGHT,"RayGUI Example") 
 
sequence mousePos = {0.0,0.0} 
sequence windowPos = {500,200} 
sequence panOffset = mousePos 
 
atom dragWindow = FALSE 
 
SetWindowPosition(windowPos[1],windowPos[2]) 
 
atom exitWindow = FALSE 
 
SetTargetFPS(60) 
 
while exitWindow = FALSE and not WindowShouldClose() do 
 
	GuiEnable() 
 
	mousePos = GetMousePosition() 
	 
	if IsMouseButtonPressed(MOUSE_BUTTON_LEFT) and dragWindow = FALSE then 
		if CheckCollisionPointRec(mousePos,{0,0,WIDTH,20}) then 
			dragWindow = TRUE 
			panOffset = mousePos 
		end if 
	end if 
	 
	if dragWindow = TRUE then 
		windowPos[1] += (mousePos[1] - panOffset[1]) 
		windowPos[2] += (mousePos[2] - panOffset[2]) 
		 
		SetWindowPosition(windowPos[1],windowPos[2]) 
		 
		if IsMouseButtonReleased(MOUSE_BUTTON_LEFT) then 
			dragWindow = FALSE 
		end if 
	end if 
 
	BeginDrawing() 
	 
	ClearBackground(RAYWHITE) 
	 
	exitWindow = GuiWindowBox({0,0,WIDTH,HEIGHT},"GUI Win") 
	 
	DrawText(TextFormat("Mouse: [%f, %f]",mousePos[1]+mousePos[2]),10,40,10,DARKGRAY) 
	DrawText(TextFormat("Win: [%f, %f]",windowPos[1]+windowPos[2]),10,60,10,DARKGRAY) 
	 
	EndDrawing() 
	 
	GuiDisable() 
	 
end while 
 
CloseWindow() 
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu