Hello. I'm writing roguelike using VB.NET. It has very slow
console output. Is there any methods to make it work faster?
For example,
Sub PlaceAt(ByVal s As String, ByVal x As Integer, ByVal y As
Integer)
Console.SetCurs orPosition(x, y)
Console.Write(s )
End Sub
Sub Setcolor(ByVal fg, ByVal bg)
Console.Foregro undColor = fg
Console.Backgro undColor = bg
End Sub
For I = 0 To mapwidth
For J = 0 To mapheight
Setcolor(Consol eColor.DarkBlue , ConsoleColor.Bl ue)
PlaceAt(things( map(I, J)).image, I, J)
Next
Next
When mapwidth=80 and mapheight=25 (standard console) screen fills with
coloured symbols in 2 seconds or more (Vista/XP). Is there workaround? 5 1455
Amzin wrote:
Hello. I'm writing roguelike using VB.NET. It has very slow
console output. Is there any methods to make it work faster?
For example,
Sub PlaceAt(ByVal s As String, ByVal x As Integer, ByVal y As
Integer)
Console.SetCurs orPosition(x, y)
Console.Write(s )
End Sub
Sub Setcolor(ByVal fg, ByVal bg)
Console.Foregro undColor = fg
Console.Backgro undColor = bg
End Sub
For I = 0 To mapwidth
For J = 0 To mapheight
Setcolor(Consol eColor.DarkBlue , ConsoleColor.Bl ue)
PlaceAt(things( map(I, J)).image, I, J)
Next
Next
When mapwidth=80 and mapheight=25 (standard console) screen fills with
coloured symbols in 2 seconds or more (Vista/XP). Is there workaround?
Doesn't the console remember the color for more than one write? Move the
setting of the color outside the loop:
Setcolor(Consol eColor.DarkBlue , ConsoleColor.Bl ue)
For I = 0 To mapwidth
For J = 0 To mapheight
PlaceAt(things( map(I, J)).image, I, J)
Next
Next
Then perhaps putting together a string for a complete line instead of
writing each character by themselves:
Setcolor(Consol eColor.DarkBlue , ConsoleColor.Bl ue)
For J = 0 To mapheight
Dim line As New Char(mapwidth - 1)
For I = 0 To mapwidth
line(I) = things(map(I, J)).image.Chars (0)
Next
PlaceAt(New String(line), 0, J)
Next
--
Göran Andersson
_____ http://www.guffa.com
On 9 июн, 02:53, Göran Andersson <gu...@guffa.co mwrote:
Doesn't the console remember the color for more than one write? Move the
setting of the color outside the loop:
Hello, Goran!
It not the case, unfortunately. My real application needs different
colors in each cell or like that - thats why I did insert colouring
into the inner cycle.
Amzin,
As the solution from Goran or things like that are not possible, then I
assume that you have to accept that you are doing something that needs an
extreme fast (expensive) video board to get a little bit more speed.
You ask for a solution for the speed and then you start to give all kind of
other obstructions which have nothing to do with your first question.
-Cor
"Amzin" <no*****@gmail. comschreef in bericht
news:ee******** *************** ***********@79g 2000hsk.googleg roups.com...
On 9 июн, 02:53, Göran Andersson <gu...@guffa.co mwrote:
Doesn't the console remember the color for more than one write? Move the
setting of the color outside the loop:
Hello, Goran!
It not the case, unfortunately. My real application needs different
colors in each cell or like that - thats why I did insert colouring
into the inner cycle.
On 9 ÉÀÎ, 08:12, "Cor Ligthert[MVP]" <notmyfirstn... @planet.nlwrote :
Amzin,
As the solution from Goran or things like that are not possible, then I
assume that you have to accept that you are doing something that needs an
extreme fast (expensive) video board to get a little bit more speed.
Nevermind and thank you for your post. When I was using Qbasic any
text output was smooth and fast. My video card was very slow in those
times. As I can see Console class itself IS extremely slow. I'm trying
to use WinApi now instead.
Thank you.
Amzin wrote:
When I was using Qbasic any
text output was smooth and fast. My video card was very slow in those
times. As I can see Console class itself IS extremely slow. I'm trying
to use WinApi now instead.
Console output is always slow, and has always been. I am pretty sure
that what QBasic did to get fast output was to circumvent the console
(the standard output stream), and write directly to video memory. I know
that Turbo Pascal used that method.
--
Go"ran Andersson
_____ http://www.guffa.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jim W |
last post by:
This is a cross-post from the .NET group since it looks like it may not be
..NET.
New information since the original post is that is the wireless network is
enabled and connected the socket connect time is 4x longer! Disable wireless
and it is back down to just very slow.
Any ideas are appreciated.
-----
|
by: F. Hall |
last post by:
If I read a bitmap image from one file and save it to another the save
operation is slow unless I draw on the image. In other words,
Image inputImage = Image.FromFile( @"c:\temp\source.bmp" );
using ( Graphics g = Graphics.FromImage( inputImage ) )
{
g.DrawLine( new Pen(Brushes.White), 0, 0, 1, 1 );
}
inputImage.Save( @"c:\temp\sink.bmp", ImageFormat.Bmp );
|
by: Kurt Bauer |
last post by:
I have an ASP group calendar application which pulls calendar data from
Exchange via webdav into an XML string. I then loop the XML nodes to
populate a collection of appointments. Finally I use the appointment
collection to populate the calendar control. The performance getting the
XML data is fine, but loading the data into the collection is slow. My
question/problem is should I be using the collection, a dataset, or
something else to...
|
by: Brett |
last post by:
Hi. I wrote a program in C that spends most of its time doing integer
arithmetic (on a data set loaded at run time), with a negligible
amount of I/O. I compiled it with lcc-win32 as a console application.
The program took 10 hrs to crunch a particular batch of data. I also
compiled with Open Watcom 1.1 with similar results. However, I
compiled the program on Linux (I have a dual boot system) with gcc,
and it took 12 MINUTES to crunch the...
|
by: nico |
last post by:
Hello
I have write this program that retrieve all directory and subdirectory
recursively of a given directory given in parameter.
For each directory, the script find all user permission for the current
directory and add the username, permission and directory name into MySQL.
The code works fine, but too slow.
| |
by: Roy Gourgi |
last post by:
Hi,
I am new to C#. I have the same time scheduling program written in C++ and
it is 5 times faster than my version in C#.
Why is it so slow as I thought that C# was only a little slower than C++?
What am I doing wrong?
Here is my code:
using System;
|
by: Jim W |
last post by:
I have an ASP.NET app that has very slow connect times using TCPClient, or
the Socket class, or even calling a COM object that uses C socket calls on
certain similar XP SP2 boxes.
On those boxes, if another connection is made within a couple seconds, it is
fast. Running the same C# code in a console app connects instantly.
Unplugging the network cable allows localhost connections to be instant (?!).
Running the same ASP.NET app on...
|
by: selvialagar |
last post by:
i did a program in vc++.net for ICMP communication using sockets.But when i execute it i received a very slow response...is there any configuration to be made on the server..or any other thing?.. i don't know the reason for slow response...i included the code for this...plz solve my problem...
// pingnew.h
#pragma once
using namespace System;
using namespace System::IO;
using namespace System::Text;
using namespace System::Net;
|
by: Eps |
last post by:
Hi there,
I am doing the following, this is a List of audio files.
this.Where(p =p.Album == AnAudioFileObject.Album).Select(s =>
s.Artist).Distinct().Count() 1;
The aim is to determine whether AnAudioFileObject is from an album that
has various artists on it or just one artist.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |