Jump to content

debayan

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by debayan

  1. i dont get any warning during compilation and its pretty clean. I hav an updated gfxconf.h and board file. The only issue i face is flipping of the button text or rather of any gwidget, otherwise the program runs smoothly. Can u plz provide me a link of the latest UGFX release with all the new fonts and drivers?

    Thanks..

  2. Hi...Actually the code is running well in my setup too but the issue is the button text is getting flipped whenever i m changing the orientation from 0 to 90. If you aren't facing such issues with the same code, then maybe i need an updated version. Plz suggest something.

    Thanks...

  3. #include "gfx.h"
    //#include "func.h"
    static GListener gl;
    static GHandle GW1,GB1,GB2,GR1,GR2,GC1;
    static GHandle create_button(int x,int y,int w,int h)
    {
    GHandle GH;
    GWidgetInit butt1;
    butt1.customDraw = 0;
    butt1.customParam = 0;
    butt1.customStyle = 0;
    //strcpy(rad1.text,t);
    butt1.text="OPEN";
    butt1.g.show = TRUE;
    butt1.g.x = x;butt1.g.y = y;
    butt1.g.width = w;butt1.g.height = h;
    GH=gwinButtonCreate(NULL,&butt1);
    return GH;
    }
    static GHandle create_radio(int x,int y,int w,int h)
    {
    GHandle GH;
    GWidgetInit rad1;
    rad1.customDraw = 0;
    rad1.customParam = 0;
    rad1.customStyle = 0;
    //strcpy(rad1.text,t);
    rad1.text="START";
    rad1.g.show = TRUE;
    rad1.g.x = x;rad1.g.y = y;
    rad1.g.width = w;rad1.g.height = h;
    GH=gwinRadioCreate(NULL,&rad1,0);
    return GH;
    }

    static void create_console(int x,int y,int w,int h)
    {
    GWindowInit con1;
    con1.x=x;con1.y=y;
    con1.width=w;con1.height=h;
    con1.show=TRUE;
    GC1 = gwinConsoleCreate(NULL, &con1);
    }
    int main(void)
    {
    GEvent* pe;
    uint8_t count=0;
    char msg[8]="WELCOME";
    const char name[6]="START";
    const char name1[5]="STOP";
    const char name2[5]="Back";
    uint8_t i=0,j=120;
    font_t font1,font2;
    gfxInit();
    //gdispSetOrientation(GDISP_ROTATE_90);
    gdispClear(Lime);
    font1 = gdispOpenFont("UI2 Double");
    font2 = gdispOpenFont("Small");
    GWindowInit w1;
    w1.x=0;w1.y=0;
    w1.width=320;w1.height=240;
    GW1=gwinWindowCreate(NULL,&w1);
    gwinSetBgColor(GW1,Red);
    gwinClear(GW1);
    gwinSetFont(GW1,font1);
    gfxSleepMilliseconds(2000);
    while(j<=225)
    {
    gwinDrawChar(GW1,j,100,msg[i]);
    i++;
    j+=15;
    gfxSleepMilliseconds(500);
    }
    gfxSleepMilliseconds(1000);
    // Set the widget defaults
    gwinSetDefaultFont(font2);
    gwinSetDefaultStyle(&BlackWidgetStyle, FALSE);
    gdispClear(White);

    // Attach the mouse input
    gwinAttachMouse(0);
    gdispClear(Red);
    gdispSetOrientation(GDISP_ROTATE_90);
    // create the widget

    GB1=create_button(120,100,100,40);


    geventListenerInit(&gl);
    gwinAttachListener(&gl);
    //geventListenerInit(&gl1);
    //gwinAttachListener(&gl1);
    while(1) {
    // Get an Event
    pe = geventEventWait(&gl, TIME_INFINITE);
    switch(pe->type){
    case GEVENT_GWIN_BUTTON:
    if (((GEventGWinButton*)pe)->button == GB1) {
    gdispClear(Purple);

    GR1=create_radio(20,180,100,40);
    gwinSetText(GR1,name,FALSE);
    GR2= create_radio(180,180,100,40);
    gwinSetText(GR2,name1,FALSE);
    create_console(0,40,320,60);
    gwinSetBgColor(GC1,Red);
    gwinClear(GC1);
    GB2=create_button(280,10,40,20);
    gwinSetText(GB2,name2,FALSE);
    }
    if (((GEventGWinButton*)pe)->button == GB2) {
    gwinDestroy(GR1);
    gwinDestroy(GR2);
    gwinDestroy(GC1);
    gdispClear(Navy);
    gwinRedraw(GB1);
    }
    break;
    case GEVENT_GWIN_RADIO:
    if(((GEventGWinRadio*)pe)->radio==GR1){
    //if (palReadPad(GPIOA, GPIOA_BUTTON)){
    //tdispSetCursor(40,40);
    //gdispSetOrientation(GDISP_ROTATE_180);
    count+=1;
    gwinPrintf(GC1,"LEDs are toggling..and count=%d\n",count);
    palSetPadMode(GPIOD, GPIOD_LED4, PAL_MODE_OUTPUT_PUSHPULL);
    while(1){
    palSetPad(GPIOD,GPIOD_LED4);
    gfxSleepMilliseconds(500);
    palClearPad(GPIOD,GPIOD_LED4);
    gfxSleepMilliseconds(500);
    if(((GEventGWinRadio*)pe)->radio==GR2)
    break;
    }
    }
    if(((GEventGWinRadio*)pe)->radio==GR2)
    {
    gwinPrintf(GC1,"Green led has stopped blinking..\n");
    //palSetPadMode(GPIOD, GPIOD_LED6, PAL_MODE_OUTPUT_PUSHPULL);
    palSetPad(GPIOD, GPIOD_LED4);
    pe->type=0;
    }
    break;

    default:
    break;
    }
    }
    return 0;
    }




    I am using the current release too..

    Thanks..

  4. HI...i m new to this forum and this s my 1st post. I m using ugfx on a DM-LCD35RT along with a EMBEST ST32F4 DISCOVERY kit . My issue is when i m rotating the display with the command :

    gdispControl(GDISP_CONTROL_ORIENTATION, (void*)GDISP_ROTATE_90);

    the individual letters of the text of any created button is getting mirrored or flipped . For example if the button text in gh.text="pi", then on rotating by 90 degrees, the "p" becomes "q". I m not getting any clue from the header files to rectify this problem so plz help....

    Thanks in advance..

×
×
  • Create New...