<commit_before>#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_ttf.h>
#include <SDL/SDL_gfxPrimitives.h>

#define SCREEN_HEIGHT                   240
#define SCREEN_WIDTH                    320
#define SCREEN_BPP                      24

#define MENU_PADDING                    16

struct app
{

    char *name;

};

struct app apps[3] = {
    {"Deluxe Paint"},
    {"Photoshop"},
    {"DOOM"}
};

struct menuitem
{

    char *name;
    unsigned int id;
    void (*callback)(unsigned int id);

};

struct menu
{

    char *name;
    unsigned int parentmenu;
    struct menuitem *items;
    unsigned int total;
    unsigned int currentitem;
    unsigned int x;
    unsigned int y;

};

SDL_Surface *display;
SDL_Surface *background;
SDL_Surface *blur;
TTF_Font *font;
unsigned int currentstate = 1;
unsigned int frame;
unsigned int animating;
unsigned int currentmenu;
unsigned int currentoverlay;
unsigned int currentapp;

void changestate(unsigned int state)
{

    currentstate = state;

}

void menuchange(unsigned int id)
{

    currentmenu = id;

}

void menuapp(unsigned int id)
{

    currentoverlay = 1;
    currentapp = id;

}

void menuexit(unsigned int id)
{

    changestate(0);

}

struct menuitem mainmenuitems[32] = {
    {"Apps", 1, menuchange},
    {"Store", 2, menuchange},
    {"Exit", 0, menuexit}
};

struct menuitem appsitems[32] = {
    {"Deluxe paint", 0, menuapp},
    {"Photoshop", 1, menuapp},
    {"DOOM", 2, menuapp}
};

struct menuitem storeitems[32] = {
    {"Deluxe paint", 0, 0},
    {"Photoshop", 1, 0},
    {"DOOM", 2, 0}
};

struct menu menus[32] = {
    {"Main Menu", 0, mainmenuitems, 3, 0, 32, 32},
    {"Apps", 0, appsitems, 3, 0, 32, 32},
    {"Store", 0, storeitems, 3, 0, 32, 32}
};

void renderbackground()
{

    SDL_BlitSurface(background, NULL, display, NULL);
    SDL_BlitSurface(blur, NULL, display, NULL);

}

void rendermenu()
{

    struct menu *menu = &menus[currentmenu];
    unsigned int i;
    unsigned int start = (menu->currentitem / 6) * 6;
    unsigned int end = (start + 6) > menu->total ? menu->total : start + 6;

    for (i = start; i < end; i++)
    {

        SDL_Surface *text;
        SDL_Color color;
        SDL_Rect rect;

        if (i == menu->currentitem)
        {

            color.r = 240;
            color.g = 240;
            color.b = 240;

            rectangleRGBA(display, MENU_PADDING, menu->y + (i - start) * 32 - 16 + 8, SCREEN_WIDTH - MENU_PADDING, menu->y + (i - start) * 32 + 32 - 8, 0x60, 0xC0, 0xC0, 0xFF);

        }

        else
        {

            color.r = 160;
            color.g = 160;
            color.b = 160;

        }

        rect.x = menu->x;
        rect.y = menu->y + (i - start) * 32;
        rect.w = 100;
        rect.h = 100;

        text = TTF_RenderText_Solid(font, menu->items[i].name, color);

        SDL_BlitSurface(text, NULL, display, &rect);
        SDL_FreeSurface(text);

    }

}

void render()
{

    renderbackground();<commit_msg>more work<commit_after>#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_ttf.h>
#include <SDL/SDL_gfxPrimitives.h>

#define SCREEN_HEIGHT                   240
#define SCREEN_WIDTH                    320
#define SCREEN_BPP                      24
#define MENU_PADDING                    24
#define MENU_ROWS                       8
#define MENU_ROWHEIGHT                  24
#define TEXT_XPADDING                   16
#define TEXT_YPADDING                   4

struct app
{

    char *name;

};

struct app apps[3] = {
    {"Deluxe Paint"},
    {"Photoshop"},
    {"DOOM"}
};

struct menuitem
{

    char *name;
    unsigned int id;
    void (*callback)(unsigned int id);

};

struct menu
{

    char *name;
    unsigned int parentmenu;
    struct menuitem *items;
    unsigned int total;
    unsigned int currentitem;
    unsigned int x;
    unsigned int y;
    unsigned int w;
    unsigned int h;

};

SDL_Surface *display;
SDL_Surface *background;
SDL_Surface *blur;
TTF_Font *font;
unsigned int currentstate = 1;
unsigned int frame;
unsigned int animating;
unsigned int currentmenu;
unsigned int currentoverlay;
unsigned int currentapp;

void changestate(unsigned int state)
{

    currentstate = state;

}

void menuchange(unsigned int id)
{

    currentmenu = id;

}

void menuapp(unsigned int id)
{

    currentoverlay = 1;
    currentapp = id;

}

void menuexit(unsigned int id)
{

    changestate(0);

}

struct menuitem mainmenuitems[32] = {
    {"Apps", 1, menuchange},
    {"Store", 2, menuchange},
    {"Exit", 0, menuexit}
};

struct menuitem appsitems[32] = {
    {"Deluxe paint", 0, menuapp},
    {"Photoshop", 1, menuapp},
    {"DOOM", 2, menuapp}
};

struct menuitem storeitems[32] = {
    {"Deluxe paint", 0, 0},
    {"Photoshop", 1, 0},
    {"Deluxe paint", 0, 0},
    {"Photoshop", 1, 0},
    {"Deluxe paint", 0, 0},
    {"Photoshop", 1, 0},
    {"Deluxe paint", 0, 0},
    {"Photoshop", 1, 0},
    {"Deluxe paint", 0, 0},
    {"Photoshop", 1, 0},
    {"Deluxe paint", 0, 0},
    {"DOOM", 2, 0}
};

struct menu menus[32] = {
    {"Main Menu", 0, mainmenuitems, 3, 0, 0, 112, 320, 128},
    {"Apps", 0, appsitems, 3, 0, 0, 0, 320, 240},
    {"Store", 0, storeitems, 12, 0, 0, 0, 320, 240}
};

void renderbackground()
{

    SDL_BlitSurface(background, NULL, display, NULL);
    SDL_BlitSurface(blur, NULL, display, NULL);

}

void rendermenu()
{

    struct menu *menu = &menus[currentmenu];
    unsigned int i;
    unsigned int start = (menu->currentitem / MENU_ROWS) * MENU_ROWS;
    unsigned int end = (start + MENU_ROWS) > menu->total ? menu->total : start + MENU_ROWS;
    SDL_Color color;

    color.r = 240;
    color.g = 240;
    color.b = 240;

    for (i = start; i < end; i++)
    {

        SDL_Surface *text;
        SDL_Rect rect;
        unsigned int offx = menu->x;
        unsigned int offy = menu->y + (i - start) * MENU_ROWHEIGHT;

        if (i == menu->currentitem)
            rectangleRGBA(display, offx + MENU_PADDING, offy + MENU_PADDING, offx + menu->w - MENU_PADDING - 1, offy + MENU_PADDING + MENU_ROWHEIGHT - 1, 0x60, 0xC0, 0xC0, 0xFF);

        rect.x = offx + MENU_PADDING + TEXT_XPADDING;
        rect.y = offy + MENU_PADDING + TEXT_YPADDING;
        rect.w = offx + menu->w - MENU_PADDING - 1 - TEXT_XPADDING;
        rect.h = offy + MENU_PADDING + MENU_ROWHEIGHT - 1 - TEXT_YPADDING;

        text = TTF_RenderText_Solid(font, menu->items[i].name, color);

        SDL_BlitSurface(text, NULL, display, &rect);
        SDL_FreeSurface(text);

    }

}

void render()
{

    renderbackground();
{'fraction_non_alphanumeric': 0.13411300121506683, 'fraction_numerical': 0.033110571081409475, 'mean_word_length': 2.445839874411303, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '147656', 'n_tokens_mistral': 2645, 'n_tokens_neox': 2337, 'n_words': 638}