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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - vurentjie

Pages: [1]
1
Feature requests / bitmask cursor
« on: June 29, 2008, 03:36:58 am »
hi,

this is not really a feature request,

i am adding some bitmask cursors into an application i am building,
they consist of some of the standard cursor types,

i am going to build it into the sfml window package.basically what i will do is have a method say, sfCreate_Cursor(cursor type), and this will automatically hide the default cursor, and display the created cursor which is created from a preset array,

i need this for my prog,  i havent seen it in the source or manual, didnt look very hard though, but wanted to know if you would be interested in this

actually now that i think about this the implentation might be difficult, as the cursor would have to be drawn i guess last in a 2d-opengl overlay, so not quite sure how this would fit in, perhaps if it sounds like something that might add to sfml and you interested, you could give thoughts on the implementation,

2
General / easiest way to hook csfml with sfml workspace
« on: June 26, 2008, 11:58:38 pm »
hi,

yip, another post,

just want to know what the easiest way would be to connect csfml build workspace with the sfml workspace (code::blocks),  

could i just copy the missing includes from the c++ build source, as well as the other stuff like main, zlib, etc,

and the sfml libs to the csfml/libs folder ??

3
Window / mouse coord out until resize by any amount
« on: June 25, 2008, 02:13:40 am »
hi, i tried to simplify my code as much as possible and extract exactly where my problem is occuring, so the code below if copied and pasted wil compile, i have just included the neccessary pieces from multiple files where i have found a problem,

the problem, i set my window as a desktop_mode, then i draw a 2dpanel at the bottom of the viewport that overlays the 3d viewport, if the mouse cursor is over the black 'drag-line' and left mouse is held down, the panel can be resized/dragged up and down,

there could be a problem in my code, but from tests i am guessing something else, if i load the program up and without resizing i try to drag the panel, it misses the mark by about 20px, as soon as i resize by any amount it behaves as it should, the code shouldn't be wrong as i have used it before, but i might be wrong,please check for me,you can just copy paste code....

sorry if it is a bit long but i have tried to preserve exactly how i use it,not usually in one file though

Code: [Select]

#include <SFML/Window.h>
#include<SFML/System.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
#include <stdlib.h>

typedef struct GUI{

   int high, wide;
}GUI;


GUI *mygui;
int init_gui_panel(int w, int h, GUI *gui);
void guidraw();

sfEvent Event;
sfWindow* mywin;

enum   actions {DRAGS, NONE};

static int action = NONE;



void guidraw(){

      glColor3f(0.1,0.1,0.1);
     glBegin(GL_QUADS);
        glVertex2i(mygui->wide, (mygui->high-5));
        glVertex2i(0,(mygui->high-5));
        glVertex2i(0, mygui->high);
        glVertex2i(mygui->wide, mygui->high);

     glColor3f(0.7,0.7,0.7);
        glVertex2i(mygui->wide, 0);
        glVertex2i(0,0);
        glVertex2i(0, (mygui->high-5));
        glVertex2i(mygui->wide, (mygui->high-5));
        glEnd();

}






int init_gui_panel(int w, int h, GUI *gui){

    //this function should encapsulate more than this later!!

   gui->high = (h/4);
   gui->wide = w;

   return gui;

}


int main(){

    sfWindow* mywin;
    sfWindowSettings Settings = {24,8,4};
    mywin = sfWindow_Create(sfVideoMode_GetDesktopMode(), "Quirk", sfResize | sfClose, Settings);


    GUI initgui;
    mygui = init_gui_panel(sfWindow_GetWidth(mywin), sfWindow_GetHeight(mywin),&initgui);

while(sfWindow_IsOpened(mywin)){
const sfInput* input = sfWindow_GetInput(mywin);

     if(sfWindow_GetEvent(mywin, &Event)){

             switch(Event.Type)
             {
                 case sfEvtClosed:
                      sfWindow_Close(mywin);
                 break;

                 case sfEvtMouseButtonPressed:
                    switch(Event.MouseButton.Button){

                        case sfButtonLeft:
                        if( (sfInput_GetMouseY(input) > sfWindow_GetHeight(mywin)-mygui->high)  &&     (  sfInput_GetMouseY(input) < sfWindow_GetHeight(mywin)-mygui->high+5)  ){

                            action=DRAGS;
                        }
                        break;
                    }
                 break;


                 case sfEvtMouseButtonReleased:
                    if( Event.MouseButton.Button == sfButtonLeft)
                        {
                        action = NONE;
                        }
                 break;

                 case sfEvtMouseMoved:

                      switch(action){
                       case DRAGS:
                            mygui->high = (sfWindow_GetHeight(mywin)-(Event.MouseMove.Y));

                            if( ((sfWindow_GetHeight(mywin)-Event.MouseMove.Y) > (sfWindow_GetHeight(mywin)-30)) )
                            {
                            mygui->high = (sfWindow_GetHeight(mywin)-30);
                            }

                            if( Event.MouseMove.Y > (sfWindow_GetHeight(mywin)-30))
                            {
                            mygui->high = 30;
                            }
                            break;
                      }
                 break;

             }
     }

     sfWindow_SetActive(mywin, 1);

     glClearColor(0.5,0.5,0.5,1.0);
     glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );


     //3d
     float aspect;
        aspect = ((float)sfWindow_GetWidth(mywin))/((float)sfWindow_GetHeight(mywin));
        glViewport(0,0,sfWindow_GetWidth(mywin), sfWindow_GetHeight(mywin));
        glMatrixMode (GL_PROJECTION);
        glLoadIdentity ();
        gluPerspective(45.0, aspect, 0.1, 200.0);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();





     //2d
     glMatrixMode (GL_PROJECTION);
        glLoadIdentity ();
        gluOrtho2D(0, sfWindow_GetWidth(mywin), 0, sfWindow_GetHeight(mywin));
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();

    guidraw();



     sfWindow_Display(mywin);

 }




    return 0;
}






help appreciated

4
Feature requests / detect display size
« on: June 22, 2008, 10:26:01 pm »
hi,

i was wondering if it was at all possible to include a function that will detect the screen width and height, so that windows can be automatically opened at a maximum size,

i did do a bit of research on the topic, if you do consider adding this feature this might help,


On windows:
Code: [Select]

  screenwidth = (GetSystemMetrics( SM_CXFULLSCREEN ));
  screenheight = (GetSystemMetrics( SM_CYFULLSCREEN ));


On X11:
Code: [Select]

  Display *display_name;

 display_name = XOpenDisplay(NULL);

             screenwidth = DisplayWidth(display_name,screen);
             screenheight = DisplayHeight(display_name,screen);


On mac, using carbon
Code: [Select]

   
   Rect outAvailableRect;

        GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect);

        screenwidth = outAvailableRect.right - outAvailableRect.left;
        screenheight = outAvailableRect.bottom - outAvailableRect.top;


I am not sure if these are totally correct or if it is covers all that is needed, but please consider this.

later
vurentjie

5
Feature requests / opengl flicker overlap riddance
« on: March 26, 2008, 08:55:31 pm »
hi i don't know if you have ever noticed that when you run an opengl app on windows xp that has been built with sfml, if you hover your mouse over the bottom windows taskbar and wait for a pop-up hint to display,if this pop up hint overlap the opengl window it flickers madly, it happens on the edges of the start menu as well, i dont know why, but it is an ugly thing to see, it happens with sdl as well, i wonder what causes it?

6
General / c help
« on: March 26, 2008, 08:00:53 pm »
can anyone tell me what would be drastically wrong with the following code, it builds but then bombs out as soon as it opens,

Code: [Select]
#include <SFML/Window.h>
#include <GL/gl.h>
#include <GL/glu.h>

int main()
{
    //sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL");
    sfVideoMode Mode = {800, 600, 32};
    sfWindow *mywin;
    int Running = 1;
    sfEvent Event;


    mywin = sfWindow_Create(Mode, "Quirk", sfResize | sfClose, 0);


    glClearColor(0.3,0.3,0.3,1.0);
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

    glViewport(0,0,800,600);

        glMatrixMode (GL_PROJECTION);
        glLoadIdentity ();

        gluPerspective(45.0, (float)(800.0/600.0), 0.1, 200.0);

        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glEnable (GL_DEPTH_TEST);


    while (Running)
     {
         /* Process events */
         while (sfWindow_GetEvent(mywin, &Event))
         {
             /* Close window : exit */
             if (Event.Type == sfEvtClosed)
                 Running = 0;
         }

    sfWindow_SetCurrent(mywin);

    sfWindow_Display(mywin);

    //App.Display();
     }


    return 0;
}




----------------------------------------------------------
ok i seem to be coming right- i have edited code above a bit, it no longer bombs out, i didn't call sfWindow_Display(mywin); at the end and my calls are a in a bit of a wrong order, but i seem to be getting there....


--------------------------------
okie dokie, i have edited code again, quik fix and very simple sfml C opengl render window, this works, thanks a bunch, i am so looking forward to using sfml, it is so great to see year 2008 displayed on your site, keep up the excellent work!

7
General discussions / using C with sfml and C++
« on: March 25, 2008, 04:58:40 pm »
hi,

i am not new to opengl and c anymore,however i am not super fluent yet either, just a bit more than capable...my c++ needs a bit of practice but nothing experience wont fix.

i am currently looking for an alternative to sdl, my developing opengl program is written in plain C, other than the some of the normal tweaks between C and C++ would there be anything else to watch out for?

Pages: [1]