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.


Messages - vurentjie

Pages: 1 [2] 3
16
Window / mouse coord out until resize by any amount
« on: June 26, 2008, 08:00:05 pm »
hi,

i had a look through the svn and downloaded some of the source for window and video, i think i am going to have to download the c++ source, and i am going to see if i can try help debug this - or at least find out if it is a code bug or my display or something, at least to teach myself a bit more about what is going on behind the scenes,  
I had a look at the msdn DEVMODE docs, and will start from there and then go through the window creation, even if i dont come up with a solution I will definitely gain from trying, later.....

17
Window / mouse coord out until resize by any amount
« on: June 26, 2008, 11:07:48 am »
hi,

i dont know if you had time to look at this, if you did could you pls inform me if you encountered same thing.
it is not a serious issue for me at the moment in any case,

later

18
Window / mouse coord out until resize by any amount
« on: June 25, 2008, 08:21:42 pm »
earlier you said you don't see relation between video mode and input, i think there might be,you know this but just to recap

mouse-y starts at top=(0)

opengl-y starts at bottom=(0)

if i draw a simple line across the screen in opengl using orthographic 192px  from bottom,

and i everytime i click mouse on the line and print out -> window-height,  mouse-ypos (from top),   line-height(from bottom),

these are results:

open as desktop mode, no resize just one click on line,
window height  768
mouse y from top 556
line height from bottom  192
windowheight  minus  mousey gives 212 (20px out  - possibly taskbar)


open as desktop mode, maximize,  just one click on line,
window height  708
mouse y from top 508
line height from bottom  192
windowheight  minus  mousey gives 202 (10px out ?)

open as desktop mode, drag windows left edge slightly inward,  just one click on line,
window height  742
mouse y from top 548 (-edit:550)
line height from bottom  192
windowheight  minus  mousey gives 192 -----CORRECT



open as 800X600, no resize,  just one click on line,
window height  600
mouse y from top 408
line height from bottom  192
windowheight  minus  mousey gives 192 -----CORRECT


have you tried this?

19
Window / mouse coord out until resize by any amount
« on: June 25, 2008, 03:03:44 pm »
cool thanks, sorry for the hassle, if you notice anything blatantly wrong in my code just let me know, i don't need a full solution, maybe just a tip,

i don't think this should matter, but i build in code::blocks...

20
Window / mouse coord out until resize by any amount
« on: June 25, 2008, 01:59:43 pm »
ok after double checking this,

if instead of
Code: [Select]

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


i use say,

Code: [Select]

    sfWindow* mywin;
    sfVideoMode Mode = {800, 600, 32};
    sfWindowSettings Settings = {24,8,4};
    mywin = sfWindow_Create(Mode, "Quirk", sfResize | sfClose, Settings);


then my mouse input records just fine without having to resize the window,


which leads me to ask, is there something wrong how i am calling sfVideoMode_GetDesktopMode()?? or is it something else??

21
Window / mouse coord out until resize by any amount
« on: June 25, 2008, 10:22:17 am »
ok, no reply??mmm....maybe i shouldnt have pasted all that code, well i am not asking it to be fixed if it is wrong on my part. but later today i will try post an even simpler example of what i mean,


oh and by resize i mean resize the window,
if i load the window with getdesktop and i try adjust the panel (that i draw in opengl) it wont work, if i just adjust the window size by even 1px i can now adjust the panel by click-and-hold on it's drag-line...

this is on windowsxp, sfml 1.3, i am going to test it on 1.2 and check if it does same thing..

but as i say i have used this code before....except for the getdesktopmode part.

22
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

23
Feature requests / detect display size
« on: June 23, 2008, 08:48:20 am »
great!

24
Feature requests / opengl flicker overlap riddance
« on: June 22, 2008, 10:29:10 pm »
i haven't looked at this post in a long time, should've come back here, yes, duh, thanks, i did sort out my problem quite a while ago, it was realy simple yes, i was a bit of a banana!

25
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

26
Feature requests / understand cause now...
« on: March 28, 2008, 12:34:08 am »
ok this should really not be in this thread anymore, i understand what the cause is, but have not got a fully workin solution,
basically i need to halt drawing/repainting while waiting for next event to take place that way the window is not persistently repaint, any advice??

you may move this thread if you please.

27
Feature requests / repainted?
« on: March 27, 2008, 04:20:12 pm »
ja, it is a strange matter, is there not any way to stop the window or 'pause/unpause' it when the mouse enters/exits the window, but that is actually stupid cos what would happen to animated stuffs.

but sadly i am going to have to live with it for now, there must be some way to fix it i am thinking, but wouldnt know where to start, i know that glut is the only opengl extension lib (that i have tried) that doesnt have this issue, but glut lacks with a lot of other things, so as i am not an experienced enough coder to get into the nitty gritty of opengl support, i am going to have to wait it out......mmm....where would one start to learn about the intrinsics of this stuff?

thanks for the reply

28
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?

29
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!

30
General discussions / i should'v read the docs first,mmmm
« on: March 25, 2008, 08:22:51 pm »
ok, so i just found out that i can use sfml for C, great stuff.
i am going to read through the rest of the docs now, but would like to know if sfml supports things like mouse scrolling, mouse move, etc, i am assuming so...

Pages: 1 [2] 3
anything