#Rendering stuff on the terminal doesnt go as expected - python
268 messages ยท Page 1 of 1 (latest)
def render(image, x, y, width, height):
tmpx = 0
tmpy = 0
if x > 126:
x = 126 - width
if y > 16:
y = 16 - height
for line in image:
for char in line:
bitmap[y + tmpy][x+tmpx] = char
tmpx+=1
tmpx=0
tmpy +=1
render(water, 6, 3, 6, 3)
render(tree, 129, 5, 21, 9)
for line in bitmap:
for char in line:
print(char, end='')
print('')
tree = [" caecceqeao ",
" acqqgpwdoOeoOa ",
" eaaOoropOacWacdQ ",
" opao#ppo\@|a/aoqaoO ",
" #aOd@@@\|/@o##@$ ",
" }|{ ",
" }|{ ",
" }|{ ",
" }|{ "
]
here is tree, for an example, for how the sprites look
it displays somewhat like this
i really hoped i could ๐
didnt know this was ur thread
spacing issue
also is it suppose to render at the end
i mean right
and not center?
yes
thats what is supposed to
the x position gets clamped to width of the terminal (129) - width of the sprite
so it should display right at the end
elaborate 
i will run it and see
but my guess is its cause of the way you're calculating the x pos
if x > 126:
x = 126```
@fast linden
well is x = 126 then the next characters will be displayed on the next line
wont they
the code adjusts the x coords if it exceeds 126. However, it sets the x-coordinate to 126 - width, which is causing the second sprite to be shifted to the left by the width of the sprite.
perhaps wrapping
well then i get a list : out of index error
gotta do some wrapping to fix it
nothing unexpected 
the size of the list is only 126 wide
oh wait that makes more sense
we are still getting the same problem
oh wait btw
is it worth noting that im using sty
because somehow it isnt there without sty
without color
s o o o o o o
yea
okay lets give that a try
wait a sec
doesn't python version 10.x+ comes with rich
library
it can be used to color too
yes it does
3.10+ you mean btw?
yea
๐
i accidently created python 10
dunno how that suppose to look
prolly will come with gpt models inside of it
or quantum computing
๐
probably will be voice-typed
if that makes sense
anyway, rich only supports print
makes much more sense 
so i will have to tweak the renderer to directly print it out
but that makes the bitmap useless 
soorry i thought u wrote twerk
too much social media :p
the bitmap returns right
if so then yea
but rich isnt the oonly option
there are others
im looking into colorama atm
or what you can do it when you print the output from bitmap
then color it
at that moment
okay so
colorama had better results
the offset is still there though
but its less?
hmmm well honestly i dont think the render function there does anything to fck this up 
i doubt its the bitmap thing
so the code for bitmap might actually help
its the color module
wym?
the colorama
you used it to color? even tho the trees still white
..
so u used it somewhere
....in the sky
i mean i only wanted to test
...i
nvm art is art ๐
im not sure if we can push that chunk of the tree
in the render thing
by setting it back to 186
or 126
wut it was earlier
126
yea try that
not helping 




trees are green 

well its fine
its a text game
thats my excuse 
some other day i suppose
the colors
yes! 
!! 
how to help someone whos in need? simple just tell em to make an exception and forget the issue and the thing that caused the issue 

i'll keep this thread open if some genius decides to help
..i
sent a dm
o h
display names r shit
indeed they are
@naive bobcat i figured it out last night
every time we concatenate anything from sty or colorama for color, we are adding another character to the bitmap
but since the character are empty characters "" they make the spacing error
now why did sty have more error than colorama? well because i was adding it continously for every character in the sprite
so fg + bg + character + rs.all means 3x the characters than just one character
3x6 = 18 so its pretty close to 21, which was the width of the tree sprite, thats why it seemed like that
anyway, time to quadruple the size of the bitmap
ok turns out i still have the dumb but now it suddenly works somehow
whatm.
thanks for the help tho @naive bobcat 
maybe the world being colorful is naice 
you turning this into a crime scene 
sherlock
that looks much better doe
still the water is floating in the sky

it sounds cooler
@naive bobcat
HHAA LOOK
damn did you turn an image into ascii?
it would take alot more time to draw ascii art by hand
i made/copy pasted ascii art, i was too lazy to write a script for that
yeah it would
most of it is copy pasted
although some of the simpler ones were by hand
no, this is all for a game i am making
although if it becomes polished, and people want it, i'd post it on github
cool
๐ that sounds sick
ppl will want anything. if not the entire project some part of it
is definitely helpful to someone out there
yeah, given the fact i really found nothing related to tui libraries involving graphics
without them being too verbose
wha
i hoped curses lib would work but it didnt
the typing-effect for the text just broke
so
i'll see if i can get a better input system
implement what
except the jam corrodes the bread 
that makes no sense but
curses is breaking my text system
thats all
and if it does that then, my whole rendering library is gone
i baked my own bread too ๐ญ
lets see how it goes
or else i just give up and make the player press RETURN all the time
yea u never know, afterall its code 

i didnt find the cow meme
there is a keyboard module
yea and a mouse
tho the thing is its a bit slow

no need for mouse in a terminal 
if you want more low level access and fast try hook
DO YA THINK I WANT LOW LEVEL BS?
if you're a sucker for speed like me then ๐
๐
even tho idk wut i;ll do with so much speed
sociopaths 

its better tho. my brain just wont let me work with python just cuz someone yt dude said its slow 
even tho it works just fine
who needss code that runs like a rocket
same, i wasnt really wanting to work with python
but C's disastrous libraries made me switch
i had over 500 lines in C already done 
then i rewrote in python with OOP this time 


