Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subpanels problem #4

Closed
Krypticdator opened this issue Jun 5, 2015 · 1 comment
Closed

Subpanels problem #4

Krypticdator opened this issue Jun 5, 2015 · 1 comment
Assignees

Comments

@Krypticdator
Copy link

Hello dear sir!

Before I post my problem I must thank you for this great library, it has really made libtcod available to me. Secondly I must apologize because this is not really a bug-report, but I couldn't find your contact information otherwise and I'm so sorry.

Anyways, I want to make Python 3 version of the tutorial from RogueBasin, called "Complete Roguelike Tutorial, using python+libtcod". The tutorial is great, but outdated if you consider Python 3.0 and requires too much tinkering with C-libraries, unlike your dtl-library.

In order to do new tutorial, I of course want to complete the original as faithful as I can with your library. Unfortunately I can't figure out how to do specific feature in your library, when comparing to libtcod. I'm trying to add statusbar to my tutorial-roguelike, as described in here: http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,_using_python%2Blibtcod,_part_7

Full example-code after the exercise, using original libtcod library should look like this:
http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,_using_python%2Blibtcod,_part_7_code

I got it working, kinda but not quite. Here's my version of the one-file project so far:
https://github.com/Krypticdator/Complete-Roguelike-Tutorial--using-python-3-libtcod-tdl-/

I'm trying to create statusbar according to the tutorial on codelines: 429-451. I saved the tutorials code in comments for reference.

If you could help me with this I would very much appreciate it, and so would probably those others who love python 3 and would want to go trought this amazing tutorial in the future.

With best regards
Toni Nurmi
toni.nurmi@hotmail.com

@HexDecimal HexDecimal self-assigned this Jun 6, 2015
@HexDecimal
Copy link
Collaborator

No problem, I'm always looking for any kind of feedback with the project.

python-tdl's printStr method isn't nearly as flexible as in native libtcod. You're mostly supposed to use Python's native string functions to format strings and draw them that way.

The setColors method has no affect on draw* operations and you also need to use the move method to place the virtual cursor before calling printStr, this is why the text was only placed in the upper left corner in your example. And because they don't change the defaults of draw* methods those drawRect calls were drawing empty white on black rectangles.

It might be confusing actually, draw* calls always default to white on black without any exceptions. I could try changing it but because they're so frequently called that any added behaviors often have major impacts on the speed of the library.

I fixed the render_bar issues in the project you gave me, I basically commented out setColors and printStr and replaced them with only draw* calls and Python string formatting, you should see a pull request for it on GitHub somewhere soon.

If you have any other issues I'll be willing to help with them.

Kyle Stewart - 4b796c65+github@gmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants