Page 2 of 3
Re: String2Tiles
Posted: Fri Nov 19, 2010 10:53 pm
by kikito
arquivista wrote:kikito sorry to post this here because is a bit off-topic but is a doubt related with your string2Tiles. I know that this could seem so basic... ermm...
well, I was trying to quickly use your example program that use console and prints. I'm on mac and using console to see messages it's not friendly. There is a way of use "print" commands directly in app window without have to transform them all to love.graphics.print and have to put coordinates (instead of "flow" the text as in a console/terminal)?
thanks.
Well actually I think that if you give the console a chance you will find that it is actually quite suited for development in general. It is actually more friendly than not using it.
I guess you could use an array of messages to hold 'logs'. Something like this (WARNING: completely untested code)
Code: Select all
-- file log.lua
local font = -- ... load a font here
local fontHeight = font:getHeight()
local messagesPerScreen = math.floor(love.graphics.getHeight() / fontHeight)
local logs = {}
function log(msg)
table.insert(logs, msg)
if #logs > messagesPerScreen then table.remove(logs, 0) end
end
function draw_log()
love.graphics.setFont(font)
love.graphics.setColor(255,255,255)
for i,msg in ipairs(logs) do
love.graphics.print(msg, 0, (i-1)*fontHeight)
end
end
Usage:
Code: Select all
-- main.lua
require('log.lua')
function love.update(dt)
log('potato')
log('tomato')
end
function love.draw()
draw_log()
end
This (if it works, I haven't tested it) should allow you to print stuff on the screen. When the screen fills up with messages, any new message should 'move the others up'. This isn't as good as the console because you can't scroll up. Once a message leaves the screen 'upwards', you've lost it. It also doesn't handle lines wider than the screen. And you can't copy and paste.
It could be refined, but seriously, I doubt that would be wise. That effort is best invested in creating your game, while you simply use the console, a wonderful tool for logging.
Re: String2Tiles
Posted: Fri Nov 19, 2010 11:09 pm
by arquivista
I think was a kind of mistake that love.graphics.print must always have coords and don't let to flow text. thanxs kikito I gonna experience this solution.
Well, I don't think Console really friendly on the mac. Here we don't have -console switch to attach the console to the window....
and console here is not like plain terminal and each line is filled with extra info
- Screen shot 2010-11-19 at 10.56.20 PM.png (87.99 KiB) Viewed 1423 times
EDITED: I'm trying to aply String2Tiles to my roguelike engine and studying if i can do a dual Ascii/Tiles system without have to use a pseudo-ascii output.
Re: String2Tiles
Posted: Fri Nov 19, 2010 11:13 pm
by zac352
What the? That's not a console! It's a debug program!
Re: String2Tiles
Posted: Fri Nov 19, 2010 11:14 pm
by kikito
arquivista wrote:I think was a kind of mistake that love.graphics.print must always have coords and don't let to flow text. thanxs kikito I gonna experience this solution.
Well, I don't think Console really friendly on the mac. Here we don't have -console switch to attach the console to the window....
and console here is not like plain terminal and each line is filled with extra info
Screen shot 2010-11-19 at 10.56.20 PM.png
EDITED: I'm trying to aply String2Tiles to my roguelike engine and studying if i can do a dual Ascii/Tiles system without have to use a pseudo-ascii output.
What???
What is that thing?
EDIT (pressed the button by mistake)
ARRGH. I think I see what the problem is. Mac people call "console" to
some weird log-viewing app.
Ok that is SO WRONG.
Consoles are not log-viewers for the rest of the world. When you hear "Console" on this forum, and pretty much any other programming place, what they mean is a "
Terminal".
- Open the mac Terminal (also called console by the rest of the world)
- Go to the folder where your game is, with cd your/game/path
- Execute love . (notice the dot at the end)
You should get a simple text outputted on that console if you do it like that.
Re: String2Tiles
Posted: Fri Nov 19, 2010 11:14 pm
by Robin
arquivista wrote:I think was a kind of mistake that love.graphics.print must always have coords and don't let to flow text. thanxs kikito I gonna experience this solution.
It's not so much of a mistake when you realise LÖVE is a game framework and not a terminal emulator.
arquivista wrote:Well, I don't think Console really friendly on the mac. Here we don't have -console switch to attach the console to the window....
and console here is not like plain terminal and each line is filled with extra info
What, don't you have a Terminal.app or something? I use that when on one of the Macs @ uni.
Re: String2Tiles
Posted: Fri Nov 19, 2010 11:24 pm
by arquivista
Robin wrote:arquivista wrote:I think was a kind of mistake that love.graphics.print must always have coords and don't let to flow text. thanxs kikito I gonna experience this solution.
It's not so much of a mistake when you realise LÖVE is a game framework and not a terminal emulator.
arquivista wrote:Well, I don't think Console really friendly on the mac. Here we don't have -console switch to attach the console to the window....
and console here is not like plain terminal and each line is filled with extra info
What, don't you have a Terminal.app or something? I use that when on one of the Macs @ uni.
Lol, but ascii text games are also games.
Really first time I used love.graphics.print command I found very strange don't let to output without coords.
Yeah but it seems print command is not outputed to terminal.app but to the console.app. I spent some time with terminal open waiting for output there! Only then checked console.app
Re: String2Tiles
Posted: Fri Nov 19, 2010 11:27 pm
by kikito
arquivista wrote:Yeah but it seems print command is not outputed to terminal.app but to the console.app. I spent some time with terminal open waiting for output there! Only then checked console.app
Even when you execute love directly from the terminal?
Re: String2Tiles
Posted: Fri Nov 19, 2010 11:47 pm
by arquivista
kikito wrote:arquivista wrote:Yeah but it seems print command is not outputed to terminal.app but to the console.app. I spent some time with terminal open waiting for output there! Only then checked console.app
Even when you execute love directly from the terminal?
yeah, I tried from terminal "open test.love" It opens and run like it should do but still not outputting to terminal, but still does to the console. see why isn't really friendly?
Re: String2Tiles
Posted: Fri Nov 19, 2010 11:56 pm
by zac352
The linux terminal, to me, is practically my best friend.
Re: String2Tiles
Posted: Sat Nov 20, 2010 1:27 am
by Robin
arquivista wrote:yeah, I tried from terminal "open test.love" It opens and run like it should do but still not outputting to terminal, but still does to the console. see why isn't really friendly?
You probably see something like
right?
It means LÖVE can't talk to the terminal using "open'. Try
love test.love