brent_hamel's Recent Forum Activity

  • This is absolutely the answer I needed. I never once thought to put the js file in the project files folder... I just had it as a standalone file in the scripts folders. Awesome... I feel like I'm THIS close to have a working NES soundchip, at least in terms of the instruments and playback capability (it doesn't read roms or nsfs...yet)

    Ultimately, this combined with the WebMIDI plugin (which is awesome and I would LOVE to see become an official plugin) will alllow users to make their own NES music

  • Does C3 allow AudioWorklets in scripting? And if so, how can I implement them, as currently I'm trying to register a simple noise generator, but get a "registerProcessor" is undefiuned error.

    registerProcessor( "Noise", class extends AudioWorkletProcessor {
    	constructor(){ 
    		super();
    	}
    	process( inputs, outputs ) {
    		const output = outputs[0][0];
    		for ( let i = 0; i < out.length; i++ ) {
    			output[ i ] = ( Math.random() * 2 ) - 1;
    		}
    		return true;
    	}
    });
    

    I'm doing this because using the existing audioBufferNode is too limited in terms of updating in realtime, and the built in oscillators are not great...

    Ultimately the goal is to replicate the NES's APU, which consists of:

    - 2 PulseWave Channels (needs to facilitate 12.5%, 25%, 50%, and 75% (25% inverted) duty cycles)

    - Triangle Channel (a real NES has a malformed and stepped triangle, rather than a smooth triangle, so a custom waveform is needed here)

    - Noise Channel (the NES could generate 16 preset pitches of noise across 2 "modes" of noise, as well as a long form noise generation)

    - DPCM Channel (this handled all the sample playback as heard in games like "Double Dribble" and "Lifeforce"

    Ultimately my goal is to create something that can playback NES audio, as well as allow the user to eventually create their own. So accuracy to the real sound quality is important.

  • So I've been taking a little time to look at Regex in combination with BBCode, and that's proving successful.. mostly... I can get it to work properly about 50% of the time. So there's clearly something I'm missing.

    Example 1:

    hlColor = "red"

    string = "$hexValue"

    regexReplace( Self.Text, "\$\S+", "gi", "[color=" & hlColor & "]$&[/color]" )

    // \$ = find "$", \S+ = include all non-white spaces until reaching a white space

    // "gi" = "g"lobal: fins all matches, "i"nsensitive: ignore upper/lowercase

    Expected Result: "$hexValue" // appears coloured "red"

    Received Result: "$hexValue" // appears coloured "red"

    Example 2:

    hlColor = "red"

    string = "123"

    regexReplace( Self.Text, "\d", "g", "[color=" & hlColor & "]$&[/color]" )

    // \d = find any decimal digit

    Expected Result: "123" // appears coloured "red"

    Received Result: "123" // appears coloured "red"

    So these work as expected, however...

    Example 3:

    hlColor = "red"

    string = "Label:"

    regexReplace( Self.text, "\w+\b:", "gi", "[color=" & hlColor & "]$&[/color]" )

    // \w+ = find entire word, \: = that ends with ":"

    Expected Result: "Label:" // appears coloured "red"

    Received Result: "[color=red]Label:" // BBCode is escaped and printed, uncoloured

    Example 4:

    hlColor = "red"

    string = "%10011001"

    regexReplace( Self.text, "\%\S+", "g", "[color=" & hlColor & "]$&[/color]" )

    // \% = find "%", \S+ = include all non-white spaces until reaching a whitespace

    Expected Result: "%10011001" // appears coloured "red"

    Received Result: "[color=red]%10011001" // BBCode is escaped and printed, uncoloured

    So obviously these do not work, but I can't figure out why. All I can think is that there's a sneaky "\" being added somewhere that is causing the first half of the BBCode to escape and be treated as plain text. Unless I'm missing something...

    In terms of match selection, everything seems to be working properly. I've also double checked the selections here https://www.regexpal.com/

  • This works perfectly!! Now I just need to find the best way to parse the text for each type of token I want to highlight.

    So far I'm looking at:

    - Directives (preceded by ".")

    - Labels (followed by ":" when set, but not when referenced)

    - Numbers: (preceded by "#" for a literal value, else its an address)

    - Binary (preceded by "%")

    - Decimal (no prefix or suffix)

    - Hex (preceded by "$")

    - Opcodes (56 unqiue 3 letter tokens)

    - Illegal Opcodes (20 unique 3 letter tokens + one 4 letter token)

    - Comments (preceded by ";" and continues for rest of the line)

  • Also, this seems like it'd be a useful Keyboard Object Property. Just to have a little checkbox somewhere to toggle "TAB Default Behaviour" or something.

  • Ok... this is sick. Can we be friends? lol

  • I'm not sure I understand what how a "TAB" character in the SpriteFont with a custom width would work... It's also the pressing of the Tab key that's the issue... I can already send the ascii byte code for Tab to the binaryData, and when it gets retrieved as Text, it works properly, the issue is that I can't seem to use the Tab key to send that byte data... it works fine if I wire it to a different key

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm definitely using SpriteFonts as opposed to regular text objects. So I do know the dedicated character widths (monospaced fonts are king!)

    I suppose that given that I know the structure of the different types of "lines" that can exist in 6502 code, perhaps attacking at on a line-by-line basic might be best.

    Lines can contain: directives, opcodes, constant labels, address labels, variables, addresses in their various modes, etc, and comments of course. But proper formatting is required for the assembler to work properly, so I can always enforce that directly and have a much more predictable set of possibilities in terms of what each line might look like.

    I'll be implementing an actual blinking cursor at some point as well, plus text highlighting, copy/pasting, etc... So trying to solve the visualizationof these sooner than later I think is key.

    What would be nice, is if there was a way to return an XY position of a token within the spritefont's display box, and then send it over to a tilemap, as masking with a tilemap is something I've done in the past and can work quite well, assuming you know where the character location to mask is.

  • Part of the goal if this editor is to be able to save and load external files that will work and behave correctly inside of other editors as well. Primarily Notepad++.

  • I'm currently using SpriteFonts inside of my own "focused" panel to manually accept the keybaord input, as the keypresses are being directly translated into their ascii byte data sent to a binaryData object, which is then being parsed and displayed by the SpriteFont... I can't say I see anywhere to give an id to SpriteFont, perhaps under the "tags" section?

  • I'm working on a text/code editor for my 6502 Emulator and am looking for a way to be able to colour code elements of text for syntax highlighting and whatnot, but do not want to use BBCode, as it cancels out the use of [], which is something I don't want to do...

    I was thinking of using multiple text object overlaid on top of each other, with each using the "colour" property set to different colours, and then duplicating all the text from the main object, into the coloured ones, and possible replacing all the text that isn't what I want coloured with spaces?

    I'm feeling kinda lost on this one, so any suggestions are welcome...

    Once I have a basic code editor in place, and a simple display output, I'll gladly upload a version of this project for people to play with is they want. It's getting close to being something useable! (Even if only very basic and simple atm)

  • So I'm making a code editor for my 6502 Emulator, and obviously indenting is a big part of keeping code clean and readable... I would like to use TAB for this, as obviously that's the key used in every other text/coding app ever... There must be a way to do that in a C3 app, no?

brent_hamel's avatar

brent_hamel

Member since 31 Dec, 2009

None one is following brent_hamel yet!

Trophy Case

  • 15-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

19/44
How to earn trophies