Skip to content

Commit

Permalink
Fixed Integer Types
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogm committed Aug 28, 2016
1 parent d64743d commit 39832ab
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
20 changes: 10 additions & 10 deletions src/termbox/bindings.cr
Expand Up @@ -27,18 +27,18 @@ lib TermboxBindings
end

# API
fun tb_init(): Int
fun tb_init(): Int32
fun tb_shutdown(): Void
fun tb_width(): Int
fun tb_height(): Int
fun tb_width(): Int32
fun tb_height(): Int32
fun tb_clear(): Void
fun tb_set_clear_attributes(fg: UInt16, bg: UInt16): Void
fun tb_present(): Void
fun tb_set_cursor(x: Int, y: Int): Void
fun tb_put_cell(x: Int, y: Int, cell: Pointer(Cell)): Void
fun tb_change_cell(x: Int, y: Int, ch: UInt32, fg: UInt16, bg: UInt16): Void
fun tb_select_input_mode(mode: Int): Int
fun tb_select_output_mode(mode: Int): Int
fun tb_peek_event(event: Pointer(Event), timeout: Int): Int
fun tb_poll_event(event: Pointer(Event)): Int
fun tb_set_cursor(x: Int32, y: Int32): Void
fun tb_put_cell(x: Int32, y: Int32, cell: Pointer(Cell)): Void
fun tb_change_cell(x: Int32, y: Int32, ch: UInt32, fg: UInt16, bg: UInt16): Void
fun tb_select_input_mode(mode: Int32): Int32
fun tb_select_output_mode(mode: Int32): Int32
fun tb_peek_event(event: Pointer(Event), timeout: Int32): Int32
fun tb_poll_event(event: Pointer(Event)): Int32
end
8 changes: 4 additions & 4 deletions src/termbox/border.cr
Expand Up @@ -18,7 +18,7 @@ module Termbox
end

# For special-mode borders (normal, double, solid, cloth_low, cloth_med, cloth_high, dotted)
def initialize(pivot : Position, width : Int, height : Int, mode : String)
def initialize(pivot : Position, width : Int32, height : Int32, mode : String)
# Decide on border character given mode
# For normal/double/char modes, just use X (no use)
case mode
Expand All @@ -40,17 +40,17 @@ module Termbox
end

# Normal mode
def initialize(pivot : Position, width : Int, height : Int)
def initialize(pivot : Position, width : Int32, height : Int32)
initialize(pivot, width, height, "normal")
end

# Border based on a single character
def initialize(pivot : Position, width : Int, height : Int, char : Char)
def initialize(pivot : Position, width : Int32, height : Int32, char : Char)
initialize(pivot, width, height, "char", char)
end

# Master internal constructor
private def initialize(@pivot : Position, @width : Int, @height : Int, @mode : String, @char : Char)
private def initialize(@pivot : Position, @width : Int32, @height : Int32, @mode : String, @char : Char)
@foreground = COLOR_NIL
@background = COLOR_NIL
end
Expand Down
4 changes: 2 additions & 2 deletions src/termbox/cell.cr
Expand Up @@ -6,7 +6,7 @@ module Termbox
getter :position, :char, :foreground, :background

# Make a cell with a specified foreground and background
def initialize(@char : Char, @position : Position, @foreground : Int, @background : Int)
def initialize(@char : Char, @position : Position, @foreground : Int32, @background : Int32)
end

# Make a cell with default colors
Expand All @@ -15,7 +15,7 @@ module Termbox
end

# Make a new cell with a position transformed by x and y
def new_transform(x : Int, y : Int)
def new_transform(x : Int32, y : Int32)
Cell.new(@char, @position.new_transform(x, y), @foreground, @background)
end

Expand Down
2 changes: 1 addition & 1 deletion src/termbox/container.cr
Expand Up @@ -7,7 +7,7 @@ module Termbox
getter :elements

# Accepts a pivot (top left position), width, and height
def initialize(@pivot : Position, @width : Int, @height : Int)
def initialize(@pivot : Position, @width : Int32, @height : Int32)
@elements = [] of Element
end

Expand Down
2 changes: 1 addition & 1 deletion src/termbox/line.cr
Expand Up @@ -4,7 +4,7 @@ module Termbox
class Line < Termbox::Element
getter :cell, :size, :is_vertical

def initialize(@cell : Cell, @size : Int, @is_vertical : Bool = true)
def initialize(@cell : Cell, @size : Int32, @is_vertical : Bool = true)
end

def render : Array(Cell)
Expand Down
4 changes: 2 additions & 2 deletions src/termbox/position.cr
Expand Up @@ -3,10 +3,10 @@ module Termbox
struct Position
getter :x, :y

def initialize(@x : Int, @y : Int)
def initialize(@x : Int32, @y : Int32)
end

def new_transform(x : Int, y : Int)
def new_transform(x : Int32, y : Int32)
Position.new(@x + x, @y + y)
end
end
Expand Down
20 changes: 10 additions & 10 deletions src/termbox/window.cr
Expand Up @@ -41,12 +41,12 @@ module Termbox
end

# Get width of termbox
def width : Int
def width : Int32
TermboxBindings.tb_width()
end

# Get height of termbox
def height : Int
def height : Int32
TermboxBindings.tb_height()
end

Expand Down Expand Up @@ -106,7 +106,7 @@ module Termbox
end

# Put a decomposed cell and decomposed position, bypassing @elements store
private def put_raw(x : Int, y : Int, ch : Int, foreground : Int, background : Int) : Void
private def put_raw(x : Int32, y : Int32, ch : Int32, foreground : Int32, background : Int32) : Void
TermboxBindings.tb_change_cell(x, y, ch, foreground, background)
end

Expand All @@ -116,17 +116,17 @@ module Termbox
end

# Set input mode
def set_input_mode(mode : Int) : Int
def set_input_mode(mode : Int32) : Int32
TermboxBindings.tb_select_input_mode(mode)
end

# Set output mode
def set_output_mode(mode : Int) : Int
def set_output_mode(mode : Int32) : Int32
TermboxBindings.tb_select_output_mode(mode)
end

# Set primary colors
def set_primary_colors(foreground : Int, background : Int) : Void
def set_primary_colors(foreground : Int32, background : Int32) : Void
@foreground = foreground
@background = background
TermboxBindings.tb_set_clear_attributes(foreground, background)
Expand All @@ -139,7 +139,7 @@ module Termbox

# Events

def peek(timeout : Int)
def peek(timeout : Int32)
e = @event_master
TermboxBindings.tb_peek_event(pointerof(e), timeout)
e
Expand All @@ -159,19 +159,19 @@ module Termbox
end

# Write a string horizontal starting at pivot
def write_string(pivot : Position, string : String, foreground : Int, background : Int)
def write_string(pivot : Position, string : String, foreground : Int32, background : Int32)
string.each_char_with_index do |char, i|
put_raw(pivot.new_transform(i, 0), char, foreground, background)
end
end

# Decide on foreground (if nil, use default)
private def decide_foreground(color : Int)
private def decide_foreground(color : Int32)
color != COLOR_NIL ? color : @foreground
end

# Decide on background (if nil, use default)
private def decide_background(color : Int)
private def decide_background(color : Int32)
color != COLOR_NIL ? color : @background
end
end
Expand Down

0 comments on commit 39832ab

Please sign in to comment.