<commit_before>// Copyright (c) 2013-2017 <NAME>. All rights reserved.
// Licensed under a simplified BSD license (see LICENSE file).

package mtx

//------------------------------------------------------------------------------

import (
	"fmt"
	"github.com/drakmaniso/glam/color"
	micro "github.com/drakmaniso/glam/internal/microtext"
)

//------------------------------------------------------------------------------

// Size returns the size of the MTX screen.
func Size() (x, y int) {
	return micro.Size()
}

// Clamp restricts the given coordinates to the screen boundaries. Negative
// coordinates are anchored to the bottom right instead of the top left.
func Clamp(x, y int) (int, int) {
	sx, sy := micro.Size()

	if x < 0 {
		x += sx
		if x < 0 {
			x = 0
		}
	}
	if x >= sx {
		x = sx - 1
	}

	if y < 0 {
		y += sy
		if y < 0 {
			y = 0
		}
	}
	if y >= sy {
		y = sy - 1
	}

	return x, y
}

//------------------------------------------------------------------------------

// Color sets the foreground and background color.
func Color(fg, bg color.RGB) {
	micro.SetColor(fg, bg)
}

// Opaque selects wether the background is drawn or not. If set to false,
// letters are drawn without background. If set to true, letters are drawn on
// colored background. In all cases but blank space is always transparent.
//
// Note: You can toggle this settings in game, using Control+Alt+NumPadEnter.
func Opaque(t bool) {
	micro.SetBgAlpha(t)
}

// IsOpaque returns wether the background is currently opaque or not.
func IsOpaque() bool {
	return micro.GetBgAlpha()
}

//------------------------------------------------------------------------------

// Clear erases the MTX screen.
func Clear() {
	micro.Clear()
	micro.Touch()
}
<commit_msg>Tweak comments<commit_after>// Copyright (c) 2013-2017 <NAME>. All rights reserved.
// Licensed under a simplified BSD license (see LICENSE file).

package mtx

//------------------------------------------------------------------------------

import (
	"fmt"
	"github.com/drakmaniso/glam/color"
	micro "github.com/drakmaniso/glam/internal/microtext"
)

//------------------------------------------------------------------------------

// Size returns the size of the MTX screen.
func Size() (x, y int) {
	return micro.Size()
}

// Clamp restricts the given coordinates to the screen boundaries. Negative
// coordinates are anchored to the bottom right instead of the top left.
func Clamp(x, y int) (int, int) {
	sx, sy := micro.Size()

	if x < 0 {
		x += sx
		if x < 0 {
			x = 0
		}
	}
	if x >= sx {
		x = sx - 1
	}

	if y < 0 {
		y += sy
		if y < 0 {
			y = 0
		}
	}
	if y >= sy {
		y = sy - 1
	}

	return x, y
}

//------------------------------------------------------------------------------

// Color sets the foreground and background color.
func Color(fg, bg color.RGB) {
	micro.SetColor(fg, bg)
}

// Opaque selects wether the background is drawn or not. When set to false, the
// text is drawn directly over the game screen. When set to true, it is are
// drawn over a colored background. Note that blank space (i.e. areas without
// MTX content, not white space) is always transparent.
//
// Note: It's possiblt to toggle this settings in game, using
// Control+Alt+NumPadEnter.
func Opaque(t bool) {
	micro.SetBgAlpha(t)
}

// IsOpaque returns wether the background is currently opaque or not.
func IsOpaque() bool {
	return micro.GetBgAlpha()
}

//------------------------------------------------------------------------------

// Clear removes all MTX content.
//
// Note that the text won't disappear from the screen until the screen itself is
// cleared or drawn over.
func Clear() {
	micro.Clear()
	micro.Touch()
}

{'fraction_non_alphanumeric': 0.26713819368879216, 'fraction_numerical': 0.008705114254624592, 'mean_word_length': 1.583977512297962, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, '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': '700651', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1060, 'n_words': 418}