Coder Social home page Coder Social logo

libtcod's People

Contributors

audy avatar mistydemeo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

libtcod's Issues

Specify FFI dependency version

I get an error (see below) when I run the example script in the readme after gem install libtcod(0.0.9) using Ruby 1.9.3

The error is coming from FFI. The version of FFI that came with this ruby (p545) is 1.0.9. When I upgrade to ffi-1.9.3 the error goes away.

/usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/ffi-1.0.9/lib/ffi/struct_layout_builder.rb:151:in `field_for_type': invalid struct field type #<FFI::Type::Builtin:BOOL size=1 alignment=1> (TypeError)
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/ffi-1.0.9/lib/ffi/struct_layout_builder.rb:85:in `add'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/ffi-1.0.9/lib/ffi/struct.rb:281:in `array_layout'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/ffi-1.0.9/lib/ffi/struct.rb:200:in `layout'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/libtcod-0.0.9/lib/libtcod/struct.rb:10:in `layout'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/libtcod-0.0.9/lib/libtcod/bindings.rb:80:in `<class:Key>'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/libtcod-0.0.9/lib/libtcod/bindings.rb:79:in `<module:TCOD>'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/libtcod-0.0.9/lib/libtcod/bindings.rb:3:in `<top (required)>'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/gems/1.9.1/gems/libtcod-0.0.9/lib/libtcod.rb:5:in `<top (required)>'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
    from /usr/local/var/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from test.rb:1:in `<main>'

Is mouse support supported?

I've not managed to get mouse support working. Waiting for any event will not respond to mouse events and explicitly calling mouse_get_status returns an empty struct (zeroed out by fffi I think). Has anyone else had simillar problems?

libtcod-mingw.dll not found

Ran the example script. Here's what I got.
PS C:\Users\TOSHIBA\desktop\Games\EZRogue> ruby rogue2.rb C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/ffi-1.9.10-x86-mingw32/lib/ffi/library.rb:133:inblock in ffi_lib'
(LoadError)open library 'libtcod-mingw': The specified module could not be found.
.
Could not open library 'libtcod-mingw.dll': The specified module could not be found.
.
Could not open library 'C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libtcod-0.1.1/clib/i686/libtcod-mingw.dll':
The specified module could not be found.
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/ffi-1.9.10-x86-mingw32/lib/ffi/library.rb:100:in `map'

    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/ffi-1.9.10-x86-mingw32/lib/ffi/library.rb:100:in `ffi_

lib'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libtcod-0.1.1/lib/libtcod/bindings.rb:23:in <module:T COD>' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libtcod-0.1.1/lib/libtcod/bindings.rb:3:in<top (requ
ired)>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/libtcod-0.1.1/lib/libtcod.rb:5:in <top (required)>' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:inrequire'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in rescue in require' from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:inrequire'
from rogue2.rb:1:in <main>' PS C:\Users\TOSHIBA\desktop\Games\EZRogue>

Suspected issue in Console class

I was rewriting some of the code when I came across a typo in the "console.rb". @height is assigned the value for width:

def initialize(w, h, root=false)
if root
@ptr = nil
else
@width = w
@height = w
@ptr = TCOD.console_new(w, h)
end

  ObjectSpace.define_finalizer(self, self.class.finalize(ptr))
end

Suggestion: Subclassing root console

Not sure if you're still actively developing, but if you are, then you might consider sub-classing Console and get the root_console as a separate class. It'll allow you to get rid of having that third parameter in the constructor while still being able to pass rootconsoles everywhere you pass regular consoles. It seems more rubyesque to do it that way.

Here's an example from my port:

module Rogue
  class RootConsole < Console
    def initialze(width, height)
      if width < 0
        fail ArgumentError, "width must be non-negative, was #{width}"
      elsif height < 0
        fail ArgumentError, "width must be non-negative, was #{width}"
      end

      @width = width
      @height = height
      @clear_cell = Console.clear_cell
      @out_of_bounds_cell = Console.out_of_bounds_cell
      @ptr = nil

      ObjectSpace.define_finalizer(self, self.class.finalize(@ptr))
    end

    def self.instance
      @instance ||= create_instance
    end

    def self.create_instance
      unless Rogue::System.initialized?
        error_message = "Rogue::System.initialize has not been called yet."
        fail error_message 
      end

      RootConsole.new(System.SCREEN_WIDTH, System.SCREEN_HEIGHT)
    end
    private_class_method :create_instance
  end
end

libtcod-ruby-test hangs on quit

The example program libtcod-ruby-test works fine on my system. However, when I exit by pressing ESC, the program closes the main window and hangs. Standard CTRL+C kills the program.

I placed a puts at the end of the program and that executes.

I've tried recompiling libtcod from source against my system's SDL and I still get the same behaviour. Doing a backtrace in gdb shows it's hanging in pthread_join called from SDL_WaitThread() and (via some intermediate functions) SDL_Quit().

I'm running 64-bit Ubuntu 13.10 on an AMD system.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.