1. SFML Wrapper Fullscreen Bug?

Hello,

While using Greg's FFI library I am currently working on wrapping CSFML 2.5.2/2.6. When I went to make an example program, the window appeared as a full-screen, even though I set the video mode to 800x600,32. I'm not sure if this is a bug with SFML or the Euphoria side of things.

https://github.com/SFML/CSFML - C binding of SFML using the most recent build as of today

https://katfile.com/61tfpd1p1808/SFML2.6.zip.html - Current source code and DLLs (in case for testing/debugging purposes) - Still working on the audio side of the wrapper

public constant sfVideoMode = define_c_struct({ 
	C_UINT, --width 
	C_UINT, --height 
	C_UINT --bitsPerPixel 
}) 
 
public enum type sfWindowStyle 
	sfNone = 0, 
	sfTitlebar = 1, 
	sfResize = 2, 
	sfClose = 8, 
	sfDefaultStyle = 11 -- sfTitlebar | sfResize | sfClose 
end type 
 
public enum type sfContextAttribute 
	sfContextDefault = 0, 
	sfContextCore = 1, 
	sfContextDebug = 4 
end type 
 
public constant sfContextSettings = define_c_struct({ 
	C_UINT, --depthBits 
	C_UINT, --stencilBits 
	C_UINT, --antialiaslevel 
	C_UINT, --majorVersion 
	C_UINT, --minorVersion 
	C_UINT32, --attributeFlags 
	C_BOOL --sRgbCapable 
}) 
 
public constant xsfRenderWindow_create = define_c_func(gfx,"+sfRenderWindow_create",{sfVideoMode,C_STRING,C_UINT32,C_POINTER},C_POINTER) 
 
public function sfRenderWindow_create(sequence mode,sequence title,sfWindowStyle style,atom settings) 
	return c_func(xsfRenderWindow_create,{mode,title,style,settings}) 
end function 
include std/ffi.e 
include std/math.e 
 
include sfml_system.e 
include sfml_window.e 
include sfml_graphics.e 
 
sequence mode = {800,600,32} 
 
atom win = sfRenderWindow_create(mode,"Window",sfClose,NULL) 
 
if win = -1 then 
	puts(1,"Failed to create window!\n") 
	abort(0) 
end if 
 
atom evt = allocate_struct(sfEvent) 
atom evt_type = 0 
 
while sfRenderWindow_isOpen(win) do 
 
	while sfRenderWindow_pollEvent(win,evt) do 
			evt_type = peek_type(evt,C_UINT32) 
			if evt_type = sfEvtClosed then 
				sfRenderWindow_close(win) 
			end if 
	end while 
	 
	sfRenderWindow_clear(win,sfBlue) 
	 
	sfRenderWindow_display(win) 
end while 
 
sfRenderWindow_destroy(win) 
 
new topic     » topic index » view message » categorize

2. Re: SFML Wrapper Fullscreen Bug?

Looks like sfClose is 4 and sfFullscreen is 8. And that means sfDefaultStyle is 7. See include/SFML/Window/Window.h

public enum type sfWindowStyle 
    sfNone         = 0, 
    sfTitlebar     = 1, -- 1 << 0 
    sfResize       = 2, -- 1 << 1 
    sfClose        = 4, -- 1 << 2 
    sfFullscreen   = 8, -- 1 << 3 
    sfDefaultStyle = 7  -- sfTitlebar | sfResize | sfClose 
end type 

-Greg

new topic     » goto parent     » topic index » view message » categorize

3. Re: SFML Wrapper Fullscreen Bug?

ghaberek said...

Looks like sfClose is 4 and sfFullscreen is 8. And that means sfDefaultStyle is 7. See include/SFML/Window/Window.h

public enum type sfWindowStyle 
    sfNone         = 0, 
    sfTitlebar     = 1, -- 1 << 0 
    sfResize       = 2, -- 1 << 1 
    sfClose        = 4, -- 1 << 2 
    sfFullscreen   = 8, -- 1 << 3 
    sfDefaultStyle = 7  -- sfTitlebar | sfResize | sfClose 
end type 

-Greg

Thanks Greg. I must have overlooked that part a little. It pays to use the programmer calculator under Windows.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu