<commit_before>﻿#if MONOGAME
using Microsoft.Xna.Framework;
#elif SFML
using SFML.Graphics;
using Point = SFML.System.Vector2i;
using Rectangle = SFML.Graphics.IntRect;
using SFML.System;
#endif

using SadConsole;
using SadConsole.Input;
using System;
using System.Collections.Generic;
using System.Text;

namespace StarterProject.CustomConsoles
{
    class HexConsole : SadConsole.Consoles.Console
    {
        int lastCell = -1;
        bool lastCellHexRow = false;

        public HexConsole(int width, int height) : base(new HexTextSurface(width, height)) { }

        public override bool ProcessMouse(MouseInfo info)
        {
            var worldLocation = info.ScreenLocation.WorldLocationToConsole(textSurface.Font.Size.X, textSurface.Font.Size.Y);
            var consoleLocation = new Point(worldLocation.X - _position.X, worldLocation.Y - _position.Y);

            // Check if mouse is within the upper/lower bounds of the console
            if (info.ConsoleLocation.Y >= 0 && info.ConsoleLocation.Y <= textSurface.RenderArea.Height - 1)
            {
                bool isHexRow = info.ConsoleLocation.Y % 2 == 1;
                // Check if mouse is on an alternating row
                if (isHexRow)
                    info.ScreenLocation.X -= textSurface.Font.Size.X / 2;

                info.Fill(this);

                if (info.Console == this)
                {
                    FillHexes(lastCell, 176, lastCellHexRow);
                    lastCell = info.ConsoleLocation.ToIndex(textSurface.Width);<commit_msg>Some more minor work on hex console<commit_after>﻿#if MONOGAME
using Microsoft.Xna.Framework;
#elif SFML
using SFML.Graphics;
using Point = SFML.System.Vector2i;
using Rectangle = SFML.Graphics.IntRect;
using SFML.System;
#endif

using SadConsole;
using SadConsole.Input;
using System;
using System.Collections.Generic;
using System.Text;

namespace StarterProject.CustomConsoles
{
    class HexConsole : SadConsole.Consoles.Console
    {
        int lastCell = -1;
        bool lastCellHexRow = false;

        public HexConsole(int width, int height) : base(new HexTextSurface(width, height))
        {
            Position = new Point(3, 2);
            textSurface.Font = Engine.LoadFont("Cheepicus12.font").GetFont(Font.FontSizes.One);

            Fill(Color.Red, null, glyph: 176);

            for (int x = 0; x < width; x++)
            {
                bool isHexColumn = x % 2 == 1;

                for (int y = 0; y < height; y++)
                {
                    bool isHexRow = y % 2 == 1;

                    if (isHexColumn && isHexRow)
                    {
                        SetForeground(x, y, Color.Blue * 0.6f);
                    }
                    else if (isHexRow)
                    {
                        SetForeground(x, y, Color.AliceBlue * 0.6f);
                    }
                    else if (isHexColumn)
                    {
                        SetForeground(x, y, Color.DarkRed);
                    }
                }
            }
        }

        public override bool ProcessMouse(MouseInfo info)
        {
            var worldLocation = info.ScreenLocation.WorldLocationToConsole(textSurface.Font.Size.X, textSurface.Font.Size.Y);
            var consoleLocation = new Point(worldLocation.X - _position.X, worldLocation.Y - _position.Y);

            // Check if mouse is within the upper/lower bounds of the console
            if (info.ConsoleLocation.Y >= 0 && info.ConsoleLocation.Y <= textSurface.RenderArea.Height - 1)
            {
                bool isHexRow = info.ConsoleLocation.Y % 2 == 1;
                // Check if mouse is on an alternating row
                if (isHexRow)
                    info.ScreenLocation.X -= textSurface.Font.Size.X / 2;

                info.Fill(this);

                if (info.Console == this)
                {
                    FillHexes(lastCell, 176, lastCellHexRow);
                    lastCell = info.ConsoleLocation.ToIndex(textSurface.Width);
{'fraction_non_alphanumeric': 0.09303482587064676, 'fraction_numerical': 0.009203980099502488, 'mean_word_length': 1.773103448275862, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5933857', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1064, 'n_words': 271}