<commit_before>#include "SDL/SDL.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_gfxPrimitives.h"
#include <map>
#include <vector>
#include <iostream>
using namespace std;

// ----> GUI BGCOLOR
struct stGuiRgbColor {
  Uint8 r;
  Uint8 g;
  Uint8 b;
};
class GuiBgColor {
  protected:
    bool hasBgColor;
    struct stGuiRgbColor bgColor;
  public:
    GuiBgColor();
    void setBgColor(int, int, int);
};
GuiBgColor::GuiBgColor() {
  hasBgColor = false;
}
void GuiBgColor::setBgColor(int _r, int _g, int _b) {
  if (_r > -1 && _g > -1 && _b > -1) {
    bgColor.r = _r;
    bgColor.g = _g;
    bgColor.b = _b;
    hasBgColor = true;
  }
}

// ----> GUI EVENT AREAS
class GuiEventAreas {
  protected:
    map<string, SDL_Rect> areas;
  public:
    void add(string, Uint16, Uint16, Uint16, Uint16);
    void update(string, Uint16, Uint16);
    bool isEventInArea(string, Uint16, Uint16);
};
void GuiEventAreas::add(
         string _name, Uint16 _x, Uint16 _y, Uint16 _w, Uint16 _h
       ) {
  SDL_Rect area;
  area.x = _x;
  area.y = _y;
  area.w = _w;
  area.h = _h;
  areas[_name] = area;
}
void GuiEventAreas::update(string _name, Uint16 _x, Uint16 _y) {
  areas[_name].x = _x;
  areas[_name].y = _y;
}
bool GuiEventAreas::isEventInArea(string _name, Uint16 _eventX, Uint16 _eventY) {
  if (_eventX > areas[_name].x &&
      _eventX < areas[_name].x + areas[_name].w &&
      _eventY > areas[_name].y &&
      _eventY < areas[_name].y + areas[_name].w) {
    return true;
  }
  return false;
}

// ----> GUI FRAME
class GuiFrame: public GuiBgColor {
  protected:
    Uint8 bpp;
    SDL_Surface *frame;
    SDL_Rect frameRect;
    SDL_Rect innerRect;
    bool hasFrame;
    bool hasBorder;
    Uint8 borderWidth;
    struct stGuiRgbColor borderColor;
  public:
    GuiFrame(Uint8);
    void set(Uint16, Uint16, Uint16, Uint16);
    void setBorder(Uint8, Uint8, Uint8, Uint8);
    void move(Uint16, Uint16);
    SDL_Rect *getRect();
    SDL_Rect *getInnerRect();<commit_msg>correction action area detection<commit_after>#include "SDL/SDL.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_gfxPrimitives.h"
#include <map>
#include <vector>
#include <iostream>
using namespace std;

// ----> GUI BGCOLOR
struct stGuiRgbColor {
  Uint8 r;
  Uint8 g;
  Uint8 b;
};
class GuiBgColor {
  protected:
    bool hasBgColor;
    struct stGuiRgbColor bgColor;
  public:
    GuiBgColor();
    void setBgColor(int, int, int);
};
GuiBgColor::GuiBgColor() {
  hasBgColor = false;
}
void GuiBgColor::setBgColor(int _r, int _g, int _b) {
  if (_r > -1 && _g > -1 && _b > -1) {
    bgColor.r = _r;
    bgColor.g = _g;
    bgColor.b = _b;
    hasBgColor = true;
  }
}

// ----> GUI EVENT AREAS
class GuiEventAreas {
  protected:
    map<string, SDL_Rect> areas;
  public:
    void add(string, Uint16, Uint16, Uint16, Uint16);
    void update(string, Uint16, Uint16);
    bool isEventInArea(string, Uint16, Uint16);
};
void GuiEventAreas::add(
         string _name, Uint16 _x, Uint16 _y, Uint16 _w, Uint16 _h
       ) {
  SDL_Rect area;
  area.x = _x;
  area.y = _y;
  area.w = _w;
  area.h = _h;
  areas[_name] = area;
}
void GuiEventAreas::update(string _name, Uint16 _x, Uint16 _y) {
  areas[_name].x = _x;
  areas[_name].y = _y;
}
bool GuiEventAreas::isEventInArea(string _name, Uint16 _eventX, Uint16 _eventY) {
  if (_eventX > areas[_name].x &&
      _eventX < areas[_name].x + areas[_name].w &&
      _eventY > areas[_name].y &&
      _eventY < areas[_name].y + areas[_name].h) {
    return true;
  }
  return false;
}

// ----> GUI FRAME
class GuiFrame: public GuiBgColor {
  protected:
    Uint8 bpp;
    SDL_Surface *frame;
    SDL_Rect frameRect;
    SDL_Rect innerRect;
    bool hasFrame;
    bool hasBorder;
    Uint8 borderWidth;
    struct stGuiRgbColor borderColor;
  public:
    GuiFrame(Uint8);
    void set(Uint16, Uint16, Uint16, Uint16);
    void setBorder(Uint8, Uint8, Uint8, Uint8);
    void move(Uint16, Uint16);
    SDL_Rect *getRect();
    SDL_Rect *getInnerRect();
{'fraction_non_alphanumeric': 0.13479234021387715, 'fraction_numerical': 0.028351156428749066, 'mean_word_length': 3.189583333333333, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 27, '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': '592885', 'n_tokens_mistral': 1733, 'n_tokens_neox': 1610, 'n_words': 382}