FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to start with sfml ?

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
moechofe



Joined: 07 Oct 2006
Posts: 25
Location: Paris, France

PostPosted: Wed Mar 24, 2010 1:55 pm    Post subject: How to start with sfml ? Reply with quote

Hi,

I'm trying to open a window with sfml and Derelict2
Code:
module sfmltest;

pragma(lib, "DerelictSFML.lib");
pragma(lib, "DerelictUtil.lib");

import derelict.sfml.sfml;

void main()
{
   DerelictSFMLSystem.load();
   DerelictSFMLWindow.load();

   sfWindowSettings Settings = {24, 8, 0};
   sfVideoMode Mode = {800, 600, 32};
   char* titre = "titre";

   sfRenderWindow* window = sfRenderWindow_Create(
      Mode,
      titre,
      sfResize|sfClose,
      Settings );

   sfRenderWindow_Destroy(window);
}


Result:
Code:
object.Exception: Access Violation - Read at address 0x0


Do I forgot something ?

sorry for my english


Last edited by moechofe on Tue Mar 30, 2010 11:42 am; edited 2 times in total
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Wed Mar 24, 2010 7:44 pm    Post subject: Reply with quote

Ok, something's wrong. I'm getting an Access Violation on Windows with D1. I've narrowed it down to the call to sfRenderWindow_Create, but I haven't yet figured out the cause.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Wed Mar 24, 2010 7:51 pm    Post subject: Reply with quote

OK, I see what the problem is now. sfRenderWindow_Create is part of SFML Graphics, but you aren't loading it. You need to call DerelictSFML_Graphics.load() instead of DerelictSFML_Window.load().
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
moechofe



Joined: 07 Oct 2006
Posts: 25
Location: Paris, France

PostPosted: Thu Mar 25, 2010 1:24 am    Post subject: Reply with quote

Yes, It works for me now.

I don't figure out that SFMLwindow is for sfWindow_Create and SFMLgraphic for sfRenderWindow_Create

Tanks you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group