I need help with xwindows!

Discussion in 'C' started by Johnathanx, Nov 26, 2007.

  1. Johnathanx

    Johnathanx New Member

    Nov 26, 2007
    Likes Received:
    Trophy Points:

    I am really having trouble with xwindows.

    I have managed to create a colour chooser, that creates a rectangle and allows the user to change the colour by typing in values accordingly.

    I want to be able to create a moving rectangle that will rotate clock-wise on the same window as my previous changing colour box.

    The code i have so far is as follows.

    #include "mywin.h"
    #include "button.h"
    #include "textwin.h"
    #include <stdio.h>
    Button B1, B2;       /* Buttons must be declared, then Created */
                     /* before they become live */
    Textwin red, green, blue;
    char mousestr[100];
    Colour makeColour(int red, int green, int blue)
    void move()
    void draw2()
        XClearWindow  (display, main_win);
        XFillRectangle(display, main_win, gc_1, 50, 50, 100, 100);
        XSetForeground(display, gc_1, makeColour (atoi(red.text), atoi(green.text), atoi(blue.text)));
    void B1fn()
    void B2fn()
    void draw()       /* AKA FormPaint */
        XClearWindow  (display, main_win);
        XFillRectangle(display, main_win, gc_1, 50, 50, 100, 100);
    int main()
        make_window(600, 400, "Colour Chooser");    
        Textwin_Create(&red, 10, 200, 170, 28, "Red", "red");
        Textwin_Create(&green, 10, 250, 170, 28, "Green", "green");
        Textwin_Create(&blue, 10, 300, 170, 28, "Blue", "blue");
        Button_Create( &B1, 10, 350, 170, 28, "Double-Click to update", &B1fn);
    	Button_Create( &B2, 200, 200, 170, 28, "Start Revolving Square", &B2fn);
        return -1;
    Anybody have any idea at all how i can make the move() function create a rotating rectangle?!

    Any help on this at all is greatly appreciated

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice