Help Writing Input_Box_Ui

  • me4502
    16th May 2011 Member 0 Permalink
    hi...

    im working on a ui bit for my mod and i need some help.

    i want to be able to open an input box using
    const char *example = input_box_ui(vid_buff);

    every time i try writing the ui thing and running it tpt crashes

    could someone please help

    ill put u in credits of my mod if u do

    Thanks

    Me4502
  • The-Fall
    16th May 2011 Member 0 Permalink
    Input box for what?
  • me4502
    16th May 2011 Member 0 Permalink
    @The-Fall (View Post)
    like a popup that can have text entered. then it sets a variable or char to the entered text
  • The-Fall
    16th May 2011 Member 0 Permalink
    Do you have the errors that occur, so that I can get an Idea of how to help.
  • me4502
    16th May 2011 Member 0 Permalink
    @The-Fall (View Post)
    no errors. just crash...

    im just wondering if any one knows how t write this
  • Pilihp64
    16th May 2011 Developer 0 Permalink
    if you compile in debug, you will get some output on what is causing the problem.

    also, the code you have would be very useful for specific problems like this.
  • me4502
    16th May 2011 Member 0 Permalink
    @cracker64 (View Post)
    i deleted it :P

    when i ran into a problem i deleted it...

    it was based of login_ui and it was just confusing...

    edit:::

    on an unrelated crashing problem involving saves

    where would i see the debug info related to the crash on code::blocks

    i checked all tabs and no info

    edit:::

    i kept it yay :D

    char *input_ui(pixel *vid_buf, char *top)
    {
    const char *dataoutput;
    int x0=(XRES-192)/2,y0=(YRES-80)/2,b=1,bq,mx,my,err;
    ui_edit ed1;
    char *res;

    while (!sdl_poll())
    {
    b = SDL_GetMouseState(&mx, &my);
    if (!b)
    break;
    }

    ed1.x = x0+25;
    ed1.y = y0+25;
    ed1.w = 158;
    ed1.nx = 1;
    ed1.def = "[user name]";
    ed1.focus = 1;
    ed1.hide = 0;
    ed1.multiline = 0;
    ed1.cursor = strlen(dataoutput);
    strcpy(ed1.str, dataoutput);

    fillrect(vid_buf, -1, -1, XRES, YRES+MENUSIZE, 0, 0, 0, 192);
    while (!sdl_poll())
    {
    bq = b;
    b = SDL_GetMouseState(&mx, &my);
    mx /= sdl_scale;
    my /= sdl_scale;

    drawrect(vid_buf, x0, y0, 192, 80, 192, 192, 192, 255);
    clearrect(vid_buf, x0, y0, 192, 80);
    drawtext(vid_buf, x0+8, y0+8, top, 255, 255, 255, 255);
    drawtext(vid_buf, x0+12, y0+23, "\x8B", 32, 64, 128, 255);
    drawtext(vid_buf, x0+12, y0+23, "\x8A", 255, 255, 255, 255);
    drawrect(vid_buf, x0+8, y0+20, 176, 16, 192, 192, 192, 255);
    drawtext(vid_buf, x0+11, y0+44, "\x8C", 160, 144, 32, 255);
    drawtext(vid_buf, x0+11, y0+44, "\x84", 255, 255, 255, 255);
    drawrect(vid_buf, x0+8, y0+40, 176, 16, 192, 192, 192, 255);
    ui_edit_draw(vid_buf, &ed1);
    drawtext(vid_buf, x0+5, y0+69, "OK", 255, 255, 255, 255);
    drawrect(vid_buf, x0, y0+64, 192, 16, 192, 192, 192, 255);
    sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));

    ui_edit_process(mx, my, b, &ed1);

    if (b && !bq && mx>=x0+9 && mx=y0+22 && my break;
    if (b && !bq && mx>=x0+9 && mx=y0+42 && my break;
    if (b && !bq && mx>=x0 && mx=y0+64 && my<=y0+80)<br /> break;

    if (sdl_key==SDLK_RETURN || sdl_key==SDLK_TAB)
    {
    if (!ed1.focus)
    break;
    ed1.focus = 0;
    }
    if (sdl_key==SDLK_ESCAPE)
    {
    if (!ed1.focus)
    return;
    ed1.focus = 0;
    }
    }

    strcpy(dataoutput, ed1.str);

    }
  • me4502
    16th May 2011 Member 0 Permalink
    Bump. Still need help
  • Simon
    16th May 2011 Administrator 0 Permalink
    Where does it crash?
  • me4502
    16th May 2011 Member 0 Permalink
    @Simon (View Post)
    as soon as i try calling input_ui