• Re: Transparency when usi

    From Access Denied@VERT/PHARCYDE to Mro on Wed Jun 18 08:28:00 2014
    Hello Mro,

    On 17 Jun 14 20:17, Mro wrote to Kirkman:

    well, fucking escuse me.
    you're displaying ansi graphics and i suggest a method of displaying ansigraphics to pull off what you want. how stupid of me. guess i've
    been doing it wrong for the past 22 years.

    Ease up man. He asked if there was something in the JAVASCRIPT libraries that could do what he was looking to do. You answered with something completely out of the boundary he was asking about.

    whats your bbs url and how long have you ran a bbs?

    E-peen comparison in 2014? Sheesh..

    Regards,
    Nick

    --- GoldED+/LNX 1.1.5-b20130910
    * Origin: Dark Sorrow | darksorrow.us (723:1/701)
    þ Synchronet þ thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin)
  • From Kirkman@VERT/GUARDIAN to MCMLXXIX on Wed Jun 18 12:04:00 2014
    that is correct, but you could apply a filter for a specific color (or specific set of attributes) to your graphic after you load it into a frame by iterating the contents as a 2D array and comparing the .attr property to whatever color you'd like to filter, and just set it to undefined if it matches.


    Okay, so I've written some code doing what you suggested, and it works:

    function maskFrame(theFrame) {
    var w = theFrame.width;
    var h = theFrame.height;
    for (var y = 0; y < h; y++) {
    for (var x = 0; x < w; x++) {
    var theChar = theFrame.getData(x,y);
    // If theChar is empty black space, clear attributes
    // to make it act as transparent.
    if (theChar.ch == ' ' && theChar.attr == 7) {
    theFrame.clearData(x,y);
    }
    }
    }
    }

    function gamePlay() {
    player.sprite = new Sprite.Profile("boy", mapFrame, 1, 1, 'e', 'normal');
    maskFrame(player.sprite.frame);
    player.sprite.frame.draw();

    var userInput = '';
    while( ascii(userInput) != 13 ) {
    userInput = console.getkey(K_UPPER | K_NOCRLF);
    player.sprite.getcmd(userInput);
    maskFrame(player.sprite.frame);
    Sprite.cycle();
    mapFrame.cycle();
    }
    }

    But I did run into a roadblock with sprites. I have a profile sprite that changes depending on whether it is facing left or right. Using the code above, the mask doesn't change when the sprite changes orientation, so basically the wrong characters are being masked.

    What should I do differently to make sure each orientation has its own mask?

    Also, on a related note, where can I find what the numeric values in .attr correspond to? it seems that 7 is black, but some other numbers also seemed like they might be black as well.

    --Josh

    ////--------------------------------------------------
    BiC -=- http://breakintochat.com -=- bbs wiki and blog

    ---
    þ Synchronet
  • From Digital Man@VERT to Kirkman on Wed Jun 18 11:28:00 2014
    Re: Re: Transparency when using frames/sprites
    By: Kirkman to MCMLXXIX on Wed Jun 18 2014 04:04 pm

    Also, on a related note, where can I find what the numeric values in .attr correspond to? it seems that 7 is black, but some other numbers also seemed like they might be black as well.

    the console.attr property value corresponds to the IBM CGA text mode character attribute encoding: http://www.seasip.info/VintagePC/cga.html

    0x07 is light grey (or dark white, depending on how you want to say it) foreground, with a black background.

    0x47 would be light grey foreground with a blue background.

    text/menu/attr.asc has the background color values shown as well. And I think TheDraw has a nice pallette feature.

    digital man

    Synchronet "Real Fact" #44:
    Synchronet External "Plain Old Telephone System" support was introduced in 2007.
    Norco, CA WX: 77.8øF, 45.0% humidity, 14 mph SE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From MCMLXXIX@VERT/MDJ to Kirkman on Wed Jun 18 19:33:00 2014
    Re: Re: Transparency when using frames/sprites
    By: Kirkman to MCMLXXIX on Wed Jun 18 2014 16:04:37

    But I did run into a roadblock with sprites. I have a profile sprite that changes depending on whether it is facing left or right. Using the code abov the mask doesn't change when the sprite changes orientation, so basically th wrong characters are being masked.

    What should I do differently to make sure each orientation has its own mask?

    Also, on a related note, where can I find what the numeric values in .attr correspond to? it seems that 7 is black, but some other numbers also seemed like they might be black as well.

    well, there are two ways to solve the first problem.the problem being that the srite image is larger than the frame, so when you iterate the frame using its dimensions, you are only scanning/modifying that portion of the sprite.

    solution 1: use the "use_offset" argument on the frame.getData() method, which should get the data in the frame using the sprite offset which is what causes it to change direction. this is the easiest fix, but not the most efficient.

    solution 2: iterate frame.data (this returns the entire graphic you loaded in) once, outside of the user input loop. you can do this once, immediately after loding the graphic in, so you arent doing it every single time it runs through your loop.

    you'll find the color values in sbbsdefs.js


    ---
    þ Synchronet þ The BRoKEN BuBBLE (bbs.thebrokenbubble.com)
  • From Kirkman@VERT/GUARDIAN to MCMLXXIX on Fri Jun 20 10:29:00 2014
    solution 2: iterate frame.data (this returns the entire graphic you loaded in) once, outside of the user input loop. you can do this once, immediately after loding the graphic in, so you arent doing it every single time it
    runs through your loop.


    So, the second solution definitely sounds better, since I only need to do it once. I wrote up some code, but the results I'm getting are the same as
    before. The sprite looks great in it's initial orientation, but when I move it a different direction, the mask doesn't match the new orientation.

    Using a little debugger function, I see that the maskFrame function is indeed iterating over all the characters in the entire sprite. So I'm not sure why this isn't working.

    Here's my revised code:

    function maskFrame(theFrame) {
    var x, y, theArray, theChar;
    for (x=0; x<theFrame.data.length; x++) {
    theArray = theFrame.data[x];
    for (y=0; y<theArray.length; y++) {
    theChar = theFrame.data[x][y];
    if (theChar.ch == ' ' && theChar.attr < 15) {
    theFrame.data[x][y].ch = undefined;
    theFrame.data[x][y].attr = undefined;
    }
    }
    }
    }

    function gamePlay() {
    player.sprite = new Sprite.Profile("boy", mapFrame, 1, 1, 'e', 'normal');
    maskFrame(player.sprite.frame);
    player.sprite.frame.draw();
    var userInput = '';
    while( ascii(userInput) != 13 ) {
    userInput = console.getkey(K_UPPER | K_NOCRLF);
    player.sprite.getcmd(userInput);
    Sprite.cycle();
    mapFrame.cycle();
    }
    }


    --Josh

    ////--------------------------------------------------
    BiC -=- http://breakintochat.com -=- bbs wiki and blog

    ---
    þ Synchronet
  • From MCMLXXIX@VERT/MDJ to Kirkman on Fri Jun 20 12:17:00 2014
    Re: Re: Transparency when using frames/sprites
    By: Kirkman to MCMLXXIX on Fri Jun 20 2014 14:29:40

    So, the second solution definitely sounds better, since I only need to do it once. I wrote up some code, but the results I'm getting are the same as before. The sprite looks great in it's initial orientation, but when I move a different direction, the mask doesn't match the new orientation.

    Using a little debugger function, I see that the maskFrame function is indee iterating over all the characters in the entire sprite. So I'm not sure why this isn't working.

    your code looks fine to me, so I'll have to see if I can get it working on my end. If you don't mind giving me a day or two to do find time to do that I'll get back to you.

    ---
    þ Synchronet þ The BRoKEN BuBBLE (bbs.thebrokenbubble.com)
  • From Kirkman@VERT/GUARDIAN to MCMLXXIX on Fri Jun 20 13:25:00 2014
    your code looks fine to me, so I'll have to see if I can get it working on my end. If you don't mind giving me a day or two to do find time to do that I'll get back to you.


    Sure, that would be awesome. Thanks again for all your help.

    --Josh


    ////--------------------------------------------------
    BiC -=- http://breakintochat.com -=- bbs wiki and blog

    ---
    þ Synchronet
  • From MCMLXXIX@VERT/MDJ to Kirkman on Fri Jun 20 17:36:00 2014
    Re: Re: Transparency when using frames/sprites
    By: Kirkman to MCMLXXIX on Fri Jun 20 2014 17:25:59

    your code looks fine to me, so I'll have to see if I can get it working o my end. If you don't mind giving me a day or two to do find time to do th I'll get back to you.


    Sure, that would be awesome. Thanks again for all your help.


    ok. should be all set now if you update frame.js from cvs.synchro.net

    you found a bug. I have squashed it.

    should be ok without any code changes.

    ---
    þ Synchronet þ The BRoKEN BuBBLE (bbs.thebrokenbubble.com)
  • From Kirkman@VERT/GUARDIAN to MCMLXXIX on Fri Jun 20 16:55:00 2014
    Re: Re: Transparency when using frames/sprites
    By: MCMLXXIX to Kirkman on Fri Jun 20 2014 09:36 pm

    ok. should be all set now if you update frame.js from cvs.synchro.net
    you found a bug. I have squashed it.
    should be ok without any code changes.

    Wow, how about that. I'll update as soon as I get home tonight. Thanks again for taking a look and helping learn how to do this.

    --Josh

    ////--------------------------------------------------
    BiC -=- http://breakintochat.com -=- bbs wiki and blog


    ---
    þ Synchronet
  • From MCMLXXIX@VERT/MDJ to Kirkman on Fri Jun 20 20:04:00 2014
    Re: Re: Transparency when using frames/sprites
    By: Kirkman to MCMLXXIX on Fri Jun 20 2014 20:55:35

    Wow, how about that. I'll update as soon as I get home tonight. Thanks again for taking a look and helping learn how to do this.

    I don't recall helping you much. You figured out a great deal of this on your own, apparently. Good luck with your game, I'd like to see it when it's done.

    ---
    þ Synchronet þ The BRoKEN BuBBLE (bbs.thebrokenbubble.com)
  • From Kirkman@VERT/GUARDIAN to MCMLXXIX on Sat Jun 21 06:00:00 2014
    Re: Re: Transparency when using frames/sprites
    By: MCMLXXIX to Kirkman on Sat Jun 21 2014 12:04 am

    I don't recall helping you much. You figured out a great deal of this on your own, apparently. Good luck with your game, I'd like to see it when it's done.

    Well, the game that prompted me to ask about transparency is more of an open-ended discovery project with my daughter. We still don't have a firm concept. If it ever becomes something worthwhile, I'll definitely share it.

    But I did release a game called "Doubles" recently. It's an ansified version of 2048. http://github.com/kirkman/doubles/

    I also have another project called "Sports Stats" that is partially working, but I'm dissatisfied with some parts, so it may be a while before it's truly release-able.

    --Josh

    ////--------------------------------------------------
    BiC -=- http://breakintochat.com -=- bbs wiki and blog


    ---
    þ Synchronet
  • From echicken@VERT/ECBBS to Access Denied on Thu Jun 26 12:08:00 2014
    Re: Re: Transparency when using frames/sprites
    By: Access Denied to Mro on Wed Jun 18 2014 12:28:50

    E-peen comparison in 2014? Sheesh..

    Well, fucking excuuuuuuuuuuuuuuuuuuse ME! My BBS dong is bigger than your BBS dong.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Poindexter Fortran@VERT/REALITY to echicken on Thu Jun 26 11:47:00 2014
    Re: Re: Transparency when using frames/sprites
    By: echicken to Access Denied on Thu Jun 26 2014 04:08 pm

    Well, fucking excuuuuuuuuuuuuuuuuuuse ME! My BBS dong is bigger than your BBS dong.

    Can you type with it?

    ---
    þ Synchronet þ realitycheckBBS -- http://realitycheckBBS.org
  • From echicken@VERT/ECBBS to Poindexter Fortran on Thu Jun 26 19:14:00 2014
    Re: Re: Transparency when using frames/sprites
    By: Poindexter Fortran to echicken on Thu Jun 26 2014 15:47:18

    Can you type with it?

    Sure, albeit slowly. It's kind of a hunt-and-pecker.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Poindexter Fortran@VERT/REALITY to echicken on Fri Jun 27 04:35:00 2014
    echicken wrote to Poindexter Fortran <=-

    Can you type with it?

    Sure, albeit slowly. It's kind of a hunt-and-pecker.

    That man can sling the puns with the best of them...

    --pF



    ... The most important thing is the thing most easily forgotten
    --- MultiMail/Win32 v0.50
    þ Synchronet þ realitycheckBBS -- http://realitycheckBBS.org
  • From Deuce@VERT/SYNCNIX to Poindexter Fortran on Fri Jun 27 15:11:00 2014
    Re: Re: Transparency when using frames/sprites
    By: Poindexter Fortran to echicken on Fri Jun 27 2014 08:35 am

    Sure, albeit slowly. It's kind of a hunt-and-pecker.

    That man can sling the puns with the best of them...

    He's also a meat!


    ---
    http://DuckDuckGo.com/ a better search engine that respects your privacy.
    þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)
  • From Khelair@VERT/TINFOIL to Mro on Wed Jul 16 06:25:00 2014
    Re: Transparency when using frames/sprites
    By: Mro to Kirkman on Tue Jun 17 2014 20:17:26

    well, fucking escuse me.
    you're displaying ansi graphics and i suggest a method of displaying ansigraphics to pull off what you want. how stupid of me. guess i've been doing it wrong for the past 22 years.

    Ah... A return to the original ways of Mro. I was getting on his ass a little bit earlier while catching up, and I was starting to feel bad because his content was decent enough so that he wasn't directly pissing into
    anyone's face or rubbing their fur completely backwards. I don't know why I don't just go and become happy or content with the fact that most people just never change.
    Oh well. At least I don't feel bad about flaming this dipshit now. He's still up to his ways of chasing off the very people that are looking to add their own custom synchronet experience and content. This, just after I attack his ass on a message in which he's talking about how 'these days anybody can run a BBS, anybody can code at a level beyond 2nd year AS compsci degrees, etc etc etc'. This person's doing the other thing he said, no doubt (picking up a book and reading it), yet still, somehow, this guy is someone that he
    should bring his guns to bear on?
    The 'Er,' dipshit, was a nice way to deal with your condescending bullshit. You flaming him for it is over the line.
    I don't advocate straight out murder, like you have in the past, but I'll advocate urging you to kill yourself making the planet a better place. You're locking up all of those amino acids and organic molecules that could actually be adding something useful to the plights on this planet, but no, they've got to sit there rotting in your tub of blubber and guts. Get on with it, pussy.

    To everyone else: pardon me. If it offends I will stop; otherwise I enjoy this despite the fact that he sometimes doesn't get a chance to read it just because I think it's encouraging to some of the people he fucks with. Well, it's gotten some laughs before, too, and I always love to bring a smile to people's faces. :)

    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    This need not feel so strange; pay attention to Lady
    Liberty's Anklets, if you're so inclined.

    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    ---
    þ Synchronet þ Tinfoil Tetrahedron BBS telnet or ssh: tinfoil.synchro.net