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

Derelict SFML shape circle not drawing ? Solved !

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



Joined: 31 Jul 2011
Posts: 17

PostPosted: Wed Aug 03, 2011 1:57 pm    Post subject: Derelict SFML shape circle not drawing ? Solved ! Reply with quote

did i do something wrong.
my circle shape doesn't draw.
no error comes up.

Code:
// gdc -o dsfml dsfml.d -I/home/.../Derelict2/import -L/home/.../Derelict2/lib -ldl -lDerelictSFMLGraphics -lDerelictSFMLWindow -lDerelictSFMLSystem -lDerelictUtil

import derelict.sfml.graphics;
import derelict.sfml.window;
import derelict.sfml.system;

int main()
{   
   DerelictSFMLGraphics.load();
   DerelictSFMLWindow.load();
   DerelictSFMLSystem.load();
   
   sfEvent event;
   sfWindowSettings Setting = {24,8,0};
   sfVideoMode Mode = {800,600,32};
   
   sfRenderWindow *App = sfRenderWindow_Create(Mode,"SFML Graphics",sfResize|sfClose,Setting);
   
   sfShape *ball = sfShape_CreateCircle(50,50,10,sfColor(0,150,0),2,sfColor(150,0,0));
   //sfShape_SetPosition(ball,50,50);
   
   while(sfRenderWindow_IsOpened(App))
   {
      while(sfRenderWindow_GetEvent(App, &event))
      {
         if(event.Type == sfEvtClosed)
         {
            sfRenderWindow_Close(App);
            break;
         }
      }
      sfRenderWindow_Clear(App,sfColor(0,0,100));
      sfRenderWindow_DrawShape(App,ball);
      sfRenderWindow_Display(App);
      sfSleep(.1);
   }
   
   return 0;
}


my c-code works fine.
Code:
// gcc -Wall -o csfmltest csfmltest.c -lcsfml-graphics -lcsfml-window -lcsfml-system

#include <SFML/Graphics.h>
#include <SFML/Window.h>
#include <SFML/System.h>

int main()
{
   sfEvent event;
   sfWindowSettings Setting = {24,8,0};
   sfVideoMode Mode = {800,600,32};
   
   sfRenderWindow *App = sfRenderWindow_Create(Mode,"SFML Graphics",sfClose,Setting);
   
   sfShape *ball = sfShape_CreateCircle(50,50,10,sfColor_FromRGB(0,150,0),1,sfColor_FromRGB(0,0,0));
   
   while(sfRenderWindow_IsOpened(App))
   {
      while(sfRenderWindow_GetEvent(App,&event))
      {
         if(event.Type == sfEvtClosed)
         {
            sfRenderWindow_Close(App);
            break;
         }
      }
      sfRenderWindow_Clear(App,sfColor_FromRGB(0,0,100));
      sfRenderWindow_DrawShape(App,ball);
      sfRenderWindow_Display(App);
      sfSleep(.1);
   }
   
   sfRenderWindow_Destroy(App);
   return 0;
}
Back to top
View user's profile Send private message
DrakeMagi



Joined: 31 Jul 2011
Posts: 17

PostPosted: Sun Aug 07, 2011 11:25 am    Post subject: Reply with quote

solved by using sfColor_FromRGBA
Code:
sfShape *ball = sfShape_CreateCircle(50,50,10,sfColor_FromRGBA(0,150,0,255),2,sfColor_FromRGBA(0,0,0,255));
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