Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Is this A Bug?[Solved]  (Read 2865 times)

0 Members and 1 Guest are viewing this topic.

MetalCoder

  • Newbie
  • *
  • Posts: 31
    • View Profile
Is this A Bug?[Solved]
« on: July 07, 2023, 03:14:41 am »
Hello,

I am currently writing a wrapper of SFML 2.6 for the OpenEuphoria programming language. I'm using the most updated version of CSFML for easier portability. Does using sfVideoMode causes the screen to go fullscreen, even though I have set the parameters so that it is a window.

https://openeuphoria.org/index.wc

My GPU is a RTX 3070 8GB.

Shouldn't the window appear as a normal window by default and not fullscreen, the video mode becomes 800x600, 32 when I test my program. I can post a actual C example if it makes it easier. Just wondering if this is a bug or something.

Code: [Select]
--Wrapper Code
public constant sfVideoMode = define_c_struct({
C_UINT, --width
C_UINT, --height
C_UINT --bitsPerPixel
})

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

Code: [Select]
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)
« Last Edit: July 07, 2023, 09:28:09 pm by MetalCoder »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Is this A Bug?
« Reply #1 on: July 07, 2023, 08:46:15 am »
To test whether it's a bug in your binding of CSFML or SFML, you'd have to reproduce it in each.
So I suggest to write the example in C using CSFML and then in C++ using SFML, that way you should be able to narrow things down further.

Quote
I know that using sfVideoMode causes the screen to go fullscreen
When you say "you know", how do you know?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MetalCoder

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Is this A Bug?
« Reply #2 on: July 07, 2023, 09:27:18 am »
To test whether it's a bug in your binding of CSFML or SFML, you'd have to reproduce it in each.
So I suggest to write the example in C using CSFML and then in C++ using SFML, that way you should be able to narrow things down further.

Quote
I know that using sfVideoMode causes the screen to go fullscreen
When you say "you know", how do you know?

That was a typo in my words. I meant to ask if using sfVideoMode causes the screen to go fullscreen.  I'll have to test and see why the renderWindow is going full-screen even though it should appear as a regular window that is 800x600.

EDIT: I had the flags set to the wrong values. Its working as it should now.


--Wrong values
public enum type sfWindowStyle
   sfNone = 0,
   sfTitlebar = 1,
   sfResize = 2,
   sfClose = 8,
   sfDefaultStyle = 11 -- sfTitlebar | sfResize | sfClose
end type


public enum type sfWindowStyle
   --Correct values
    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
« Last Edit: July 07, 2023, 09:27:33 pm by MetalCoder »