Typing in cosmos

Jan 13, 2012 at 12:20 AM
Edited Jan 13, 2012 at 12:45 AM

I am making a notepad type program for my os and it is really slow. Anyone have a code that runs faster than this (below)?

Here is the code that detects the key being pressed(what i need help with):

  ConsoleKey Akey = ConsoleKey.A; 
Keyboard.GetKey(out Akey);
  if (Akey == ConsoleKey.A) 
{

//it is too slow.

//This is the rest:

Program.Cursor(curx, cury-6, 5);

Program.A(curx+1, cury, 5);
cursorx = curx;
cursory = cury;
curx = cursorx + 6;
if (curx == 194)
{

cursory = cury + 6;
curx = 2;
cursorx = 2;
cury = cursory;
Program.Cursor(188, cury - 12, 4);
}
Program.Cursor(curx - 6, cury - 6, 4);
Program.Cursor(curx, cury- 6, 5);
}

Developer
Jan 13, 2012 at 12:21 AM

Mine just uses console.readline

On Jan 12, 2012 5:20 PM, "L448" <notifications@codeplex.com> wrote:

From: L448

I am making a notepad type program for my os and it is really slow. Anyone have a code that runs faster than this (below)?

Here is the code that detects the key being pressed:

ConsoleKey Akey = ConsoleKey.A;
Keyboard.GetKey(out Akey);
if (Akey == ConsoleKey.A)
{

//it is too slow.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jan 13, 2012 at 12:35 AM
Edited Jan 13, 2012 at 12:43 AM
joshbeitler wrote:

Mine just uses console.readline

On Jan 12, 2012 5:20 PM, "L448" <notifications@codeplex.com> wrote:

From: L448

I am making a notepad type program for my os and it is really slow. Anyone have a code that runs faster than this (below)?

Here is the code that detects the key being pressed:

ConsoleKey Akey = ConsoleKey.A;
Keyboard.GetKey(out Akey);
if (Akey == ConsoleKey.A)
{

//it is too slow.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

have a look at the Pear www.pearos.codeplex.com code. I have a keyboard implentation that is fast an does not stall the system. - Yours truly - Matt

Jan 13, 2012 at 1:07 AM
So do you have an if statement for each letter of the alphabet?


On Thu, Jan 12, 2012 at 7:20 PM, L448 <notifications@codeplex.com> wrote:

From: L448

I am making a notepad type program for my os and it is really slow. Anyone have a code that runs faster than this (below)?

Here is the code that detects the key being pressed:

ConsoleKey Akey = ConsoleKey.A;
Keyboard.GetKey(out Akey);
if (Akey == ConsoleKey.A)
{

//it is too slow.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Jan 13, 2012 at 1:19 AM
d1ag0n wrote:
So do you have an if statement for each letter of the alphabet?


On Thu, Jan 12, 2012 at 7:20 PM, L448 <notifications@codeplex.com> wrote:

From: L448

I am making a notepad type program for my os and it is really slow. Anyone have a code that runs faster than this (below)?

Here is the code that detects the key being pressed:

ConsoleKey Akey = ConsoleKey.A;
Keyboard.GetKey(out Akey);
if (Akey == ConsoleKey.A)
{

//it is too slow.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Nope. Take a look at the source and see for yourself. Under Core > Keyboard and the hardware folder. Thanks - Matt

Jan 13, 2012 at 1:47 AM

yes

Jan 13, 2012 at 1:56 AM
Edited Jan 13, 2012 at 1:57 AM
L448 wrote:

yes

Oh he was talking to you, lol. L448, if you want a faster way of doing it, that is better look at this: http://pearos.codeplex.com/SourceControl/changeset/view/10597#219771   

It is fast, simple and works very well. Yours Truly - Matt

Edit: I must be tired I so did not read that correctly, um maybe I'm not any help then. Sorry

Jan 13, 2012 at 2:11 AM
I'm willing to bet it's the string concatenation slowing you down. Do you use a StringBuilder? Is that even usable in cosmos yet? Maybe string.format("{0}{1}",currentString,newCharacter);?? I think object to string is not implemented or at least that's what I saw so I don't think string.format will work.


On Thu, Jan 12, 2012 at 8:56 PM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

L448 wrote:

yes

Oh he was talking to you, lol. L448, if you want a faster way of doing it, that is better look at this: http://pearos.codeplex.com/SourceControl/changeset/view/10597#219771

It is fast, simple and works very well. Yours Truly - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Jan 13, 2012 at 2:13 AM
civilwarrock why arent your methods commented?

On Thu, Jan 12, 2012 at 9:11 PM, Nathan Stiles <stiles.nathan@gmail.com> wrote:
I'm willing to bet it's the string concatenation slowing you down. Do you use a StringBuilder? Is that even usable in cosmos yet? Maybe string.format("{0}{1}",currentString,newCharacter);?? I think object to string is not implemented or at least that's what I saw so I don't think string.format will work.



On Thu, Jan 12, 2012 at 8:56 PM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

L448 wrote:

yes

Oh he was talking to you, lol. L448, if you want a faster way of doing it, that is better look at this: http://pearos.codeplex.com/SourceControl/changeset/view/10597#219771

It is fast, simple and works very well. Yours Truly - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com



Jan 13, 2012 at 2:22 AM
d1ag0n wrote:
civilwarrock why arent your methods commented?

On Thu, Jan 12, 2012 at 9:11 PM, Nathan Stiles <stiles.nathan@gmail.com> wrote:
I'm willing to bet it's the string concatenation slowing you down. Do you use a StringBuilder? Is that even usable in cosmos yet? Maybe string.format("{0}{1}",currentString,newCharacter);?? I think object to string is not implemented or at least that's what I saw so I don't think string.format will work.



On Thu, Jan 12, 2012 at 8:56 PM, civilwarrock <notifications@codeplex.com> wrote:

From: civilwarrock

L448 wrote:

yes

Oh he was talking to you, lol. L448, if you want a faster way of doing it, that is better look at this: http://pearos.codeplex.com/SourceControl/changeset/view/10597#219771

It is fast, simple and works very well. Yours Truly - Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Most of them are, but some I just code and comment it later. So you will often find a few things not commented. Yours Truly - Matt

Jan 31, 2012 at 7:19 AM
L448 wrote:

I am making a notepad type program for my os and it is really slow. Anyone have a code that runs faster than this (below)?

Here is the code that detects the key being pressed(what i need help with):

  ConsoleKey Akey = ConsoleKey.A; 
Keyboard.GetKey(out Akey);
  if (Akey == ConsoleKey.A) 
{

//it is too slow.

//This is the rest:

Program.Cursor(curx, cury-6, 5);

Program.A(curx+1, cury, 5);
cursorx = curx;
cursory = cury;
curx = cursorx + 6;
if (curx == 194)
{

cursory = cury + 6;
curx = 2;
cursorx = 2;
cury = cursory;
Program.Cursor(188, cury - 12, 4);
}
Program.Cursor(curx - 6, cury - 6, 4);
Program.Cursor(curx, cury- 6, 5);
}

If you are still having lag issues, look at my Source code under:pearos.codeplex.com I have a working textbox API control that does not lag when I type on it. So you can use that if you would like. Thanks - Matt