saibot216
|
|
« on: April 12, 2014, 01:19:38 PM » |
|
Anyone care to tell me how I remedy the following error? Traceback (most recent call last): File "C:\Users\Connor\Documents\NetBeansProjects\RoguelikeTutorial\src\libtcodpy.py", line 57, in <module> _lib = ctypes.cdll['./libtcod-mingw.dll'] File "c:\Python34\lib\ctypes\__init__.py", line 426, in __getitem__ return getattr(self, name) File "c:\Python34\lib\ctypes\__init__.py", line 421, in __getattr__ dll = self._dlltype(name) File "c:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 is not a valid Win32 application
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\Connor\Documents\NetBeansProjects\RoguelikeTutorial\src\rogueliketutorial.py", line 9, in <module> import libtcodpy as libtcod File "C:\Users\Connor\Documents\NetBeansProjects\RoguelikeTutorial\src\libtcodpy.py", line 60, in <module> _lib = ctypes.cdll['./libtcod-VS.dll'] File "c:\Python34\lib\ctypes\__init__.py", line 426, in __getitem__ return getattr(self, name) File "c:\Python34\lib\ctypes\__init__.py", line 421, in __getattr__ dll = self._dlltype(name) File "c:\Python34\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found
My code is as follows and I'm following a tutorial. It should be correct, but apparently it's not? # import libtcodpy import libtcodpy as libtcod
#set screensize SCREEN_WIDTH = 80 SCREEN_HEIGHT = 50 LIMIT_FPS = 20
#import font libtcod.console_set_custom_font('font16x16.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD) #specifying size libtcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT, 'NetBeansProjects/RoguelikeTutorial', False) #for realtime roguelike add the following line, ignore this line to keep it turn based libtcod.set_sys_fps(LIMIT_FPS) #this line runs code while the window is not closed while not libtcod.console_is_window_closed(): libtcod.console_set_default_foreground(0, libtcod.white) libtcod.console_put_char(0, 1, 1, '@', libtcod.BKGND_NONE) libtcod.console_flush()
|
|
|
Logged
|
|
|
|
nikki
|
|
« Reply #1 on: April 13, 2014, 01:51:16 AM » |
|
is python 3.4 even supported for libtcod ?
My guess would be it wants 2.7
what steps are you following? can you post a link?
|
|
|
Logged
|
|
|
|
saibot216
|
|
« Reply #2 on: April 13, 2014, 07:20:56 AM » |
|
|
|
|
Logged
|
|
|
|
nikki
|
|
« Reply #3 on: April 13, 2014, 08:11:21 AM » |
|
We recommend that you install Python 2.7 and go through at least the first parts of the Python Tutorial ... Python 2 is the most used version, and it's very stable. Currently libtcod is not compatible with Python 3.
|
|
|
Logged
|
|
|
|
saibot216
|
|
« Reply #4 on: April 13, 2014, 08:12:35 AM » |
|
dang... if only I could read... Ok, so now I gotta find a place to download python 2.7...
|
|
|
Logged
|
|
|
|
nikki
|
|
« Reply #5 on: April 13, 2014, 08:14:46 AM » |
|
|
|
|
Logged
|
|
|
|
saibot216
|
|
« Reply #6 on: April 13, 2014, 08:20:24 AM » |
|
Blamo. I'm also looking for a version for NetBeans.
|
|
|
Logged
|
|
|
|
|
saibot216
|
|
« Reply #8 on: April 13, 2014, 08:28:20 AM » |
|
Ok, cool. Well, NetBeans seems to be ok with it. I am not getting any errors, however, when I run the program I get nothing. It's running, but it isn't showing the '@'.
|
|
|
Logged
|
|
|
|
nikki
|
|
« Reply #9 on: April 13, 2014, 08:35:14 AM » |
|
ah compilation so nice , Does this code help? import libtcodpy as libtcod #actual size of the window SCREEN_WIDTH = 80 SCREEN_HEIGHT = 50 LIMIT_FPS = 20 #20 frames-per-second maximum def handle_keys(): global playerx, playery #key = libtcod.console_check_for_keypress() #real-time key = libtcod.console_wait_for_keypress(True) #turn-based if key.vk == libtcod.KEY_ENTER and key.lalt: #Alt+Enter: toggle fullscreen libtcod.console_set_fullscreen(not libtcod.console_is_fullscreen()) elif key.vk == libtcod.KEY_ESCAPE: return True #exit game #movement keys if libtcod.console_is_key_pressed(libtcod.KEY_UP): playery -= 1 elif libtcod.console_is_key_pressed(libtcod.KEY_DOWN): playery += 1 elif libtcod.console_is_key_pressed(libtcod.KEY_LEFT): playerx -= 1 elif libtcod.console_is_key_pressed(libtcod.KEY_RIGHT): playerx += 1 ############################################# # Initialization & Main Loop ############################################# libtcod.console_set_custom_font('arial10x10.png', libtcod.FONT_TYPE_GREYSCALE | libtcod.FONT_LAYOUT_TCOD) libtcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT, 'python/libtcod tutorial', False) libtcod.sys_set_fps(LIMIT_FPS) playerx = SCREEN_WIDTH/2 playery = SCREEN_HEIGHT/2 while not libtcod.console_is_window_closed(): libtcod.console_set_default_foreground(0, libtcod.white) libtcod.console_put_char(0, playerx, playery, '@', libtcod.BKGND_NONE) libtcod.console_flush() libtcod.console_put_char(0, playerx, playery, ' ', libtcod.BKGND_NONE) #handle keys and exit game if needed exit = handle_keys() if exit: break
|
|
|
Logged
|
|
|
|
saibot216
|
|
« Reply #10 on: April 13, 2014, 08:55:09 AM » |
|
Nope. I just get this: Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>>
>>> ================================ RESTART ================================ >>>
|
|
|
Logged
|
|
|
|
nikki
|
|
« Reply #11 on: April 13, 2014, 09:37:42 AM » |
|
that looks like an interactive python environment, I don't know why that is showing.
I actually had to download libtcod to further help you (but I don't use windows and netbeans so it might not help) anyway in my case 1) I just downloaded libtcod 1.5.1 2) I went in the directory after unpacking and ran: python2.7 samples_py.py to test if it worked; it did 3) then I saved the source code I just posted above to a file named test.py 4) I changed one line to load the font from the correct path : 'data/fonts/arial10x10.png' 5) and ran it with python2.7 test.py
and a '@' controlled by the cursor keys in a window appeared! can you try these steps and tell me where it fails ?
|
|
|
Logged
|
|
|
|
saibot216
|
|
« Reply #12 on: April 13, 2014, 10:04:31 AM » |
|
Ok, all of that worked. So then clearly the issue lies within the way my project file is structured, correct?
|
|
|
Logged
|
|
|
|
nikki
|
|
« Reply #13 on: April 13, 2014, 10:17:59 AM » |
|
good news that all is working, I don't know about project files; I just use a texteditor and the terminal
|
|
|
Logged
|
|
|
|
saibot216
|
|
« Reply #14 on: April 13, 2014, 10:22:46 AM » |
|
So, my project file in NetBeans is structured like all of the files the tutorial calls for are all in one folder labeled "src." This includes the tutorial python file, libtcodpy, sdl.dll, font16x16, and libtcod-mingw.dll. Soooooooooooooooooooooooooooooooooooo I may just switch over to using the python editor and not NetBeans.
|
|
|
Logged
|
|
|
|
saibot216
|
|
« Reply #15 on: April 15, 2014, 02:12:24 PM » |
|
Figured out my issue - I wasn't using a valid libtcod font. Ok. That fixed, I am attempting to use an ASCII terminal font "smiley face," how do I go about inputting that into python?
|
|
|
Logged
|
|
|
|
nikki
|
|
« Reply #16 on: April 15, 2014, 11:47:18 PM » |
|
http://doryen.eptalys.net/data/libtcod/doc/1.5.1/html2/console_ascii.htmlbecause of the location of the smileys in the tileset you can deduce it's index to be 1, or 2 for the inverted smiley, but those consts are a better idea. edit: tried id, the consts are named slightly differnt in python then in main docs, check libtcodpy.py starting at line 580. anyway to draw/putchar a smiley you use 'libtcod.CHAR_SMILIE'
|
|
« Last Edit: April 16, 2014, 12:03:41 AM by nikki »
|
Logged
|
|
|
|
saibot216
|
|
« Reply #17 on: April 16, 2014, 05:41:40 AM » |
|
AH! I have been looking for a binding document! Thank you! Should there be any reason that my document won't simply close and instead freezes and stops responding when I try to close it?
|
|
|
Logged
|
|
|
|
herror
|
|
« Reply #18 on: April 18, 2014, 02:27:43 PM » |
|
Should there be any reason that my document won't simply close and instead freezes and stops responding when I try to close it?
Have you tried running the game from the terminal? Navigate to the folder and type "python myfile.py" Netbeans might be interfering with closing the game (IDLE does that) re IDE: I use Komodo Edit (free), and works just fine. It has the right amount of features. Doesn't force you to use any kind of file structure. It doesn't come with a 'build and run' command, but you can create one easily. ps - you might have trouble displaying the smileys and such - the first 8 characters are linked to control characters (like changing the color on the fly).
|
|
|
Logged
|
|
|
|
saibot216
|
|
« Reply #19 on: April 18, 2014, 03:03:46 PM » |
|
I've actually just switched over to using IDLE instead of NetBeans. For some reason NetBeans does not want to open up a console to run all of this. ...ok, just ran with the Python Command Line and it does not freeze when I go to close it, so it's some IDLE issue. Good to know that I'm not so bad at programming that I broke it already, haha!
|
|
|
Logged
|
|
|
|
|