Jump to content
xisto Community

bob3695

Members
  • Content Count

    33
  • Joined

  • Last visited

Posts posted by bob3695


  1. I am trying to learn C++. Do you guys know of any good C++ tutorials or resource sites? I have a book but is only the basics. I am about half way through it. I am trying to put together resources for me to learn the more advanced stuff. Also how about some free compilers? Thanks


  2. Web Timer Control C#

    Difficulty: Easy
    Time: 10 Minutes

    The aim of this tutorial is to create a Timer that works on web pages.

    Timers are a very useful control in Windows Applications but how can you use them in web pages. With the default controls you get in the .Net Framework there is not a Web Timer.

    This web timer can be used as a normal web control you will be able to drag and drop it onto Web Forms, and modify it using the properties window.

    This Timer Works using the JavaScript setTimeout() function which once the required time has elapsed unlike a Windows Forms Timer it post backs the page and then the Page_Load Event will handle the event.

    Here is the code:

    using System; using System.ComponentModel; using System.Text; using System.Web.UI; using System.Web.UI.WebControls; namespace WebControls{ 	[DefaultProperty("TimerInterval")] 	[ToolboxData("<{0}:TimerControl runat=server></{0}:TimerControl>")] 	public class TimerControl : System.Web.UI.Control, INamingContainer 	{   [Browsable(true)]   [Category("Behavior")]   [DefaultValue("TimerPostBack")]   [Description("The PostBack value.")]   public string PostBackValue   {  	 get  	 {     object viewState = this.ViewState["PostBackValue"];     return (viewState == null) ? "TimerPostBack" : (string)viewState;  	 }  	 set { this.ViewState["PostBackValue"] = value; }   }   [Browsable(true)]   [Category("Behavior")]   [DefaultValue(1000)]   [Description("The timer interval, in milli-seconds (1000 = 1 second).")]   public double TimerInterval   {  	 get  	 {     object viewState = this.ViewState["TimerInterval"];     return (viewState == null) ? 1000 : (double)viewState;  	 }  	 set { this.ViewState["TimerInterval"] = value; }   }   protected override void OnPreRender(EventArgs e)   {  	 StringBuilder sbScript = new StringBuilder();  	 sbScript.Append("\n<script language=\"JavaScript\" type=\"text/javascript\">\n");  	 sbScript.Append("<!--\n");  	 sbScript.Append("\n");  	 sbScript.Append("function autoPostBackTimer()\n");  	 sbScript.Append("{\n");  	 sbScript.Append("   " + this.Page.GetPostBackEventReference(this, this.PostBackValue) + ";");  	 sbScript.Append("}\n");  	 sbScript.Append("// -->\n");  	 sbScript.Append("</script>\n");         	 this.Page.RegisterClientScriptBlock(     "TimerControlScript", sbScript.ToString());  	 StringBuilder sbScript2 = new StringBuilder();  	 sbScript2.Append("\n<script language=\"JavaScript\" type=\"text/javascript\">\n");  	 sbScript2.Append("<!--\n");  	 sbScript2.Append("window.setTimeout('autoPostBackTimer()', " + this.TimerInterval.ToString() + ")\n");  	 sbScript2.Append("// -->\n");  	 sbScript2.Append("</script>\n");  	 this.Page.RegisterStartupScript(     "TimerControlStartupScript", sbScript2.ToString());   } 	} }

    Just Copy and Paste it into C# Web Application or C# Web Control Project and build it.

    Then if you have made a web control project you may want to compile it and then add it to the Visual Studio tool box.

    To actually use the Web Timer Drag and Drop it onto a Web Form set the Time (1 sec = 1000), and the Post Back value, and then in the Page_Load event add this

    C#

    private void Page_Load(object sender, System.EventArgs e)  { 	 if ( this.IsPostBack ) 	 {     object eventArgument = this.Request["__EVENTARGUMENT"];     if ( (eventArgument != null) && (eventArgument.ToString().Trim() == this.TimerControl1.PostBackValue) )     {   	 //Function or code to handle the elapse of the timer.     }     else     {    	 // Do Nothing     } 	 }

    VB

      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        If Page.IsPostBack Then            Dim eventarguement As Object = Me.Request("__EVENTARGUMENT")            If Not eventarguement = Nothing And CStr(eventarguement).Trim() = Me.TimerControl1.PostBackValue Then                'Code to Handle event            Else                ' Do Nothing            End If        End If    End Sub

    Adding your own code to handle the event in the appropriate place.

    Rich

  3. The pictures are in the templates image directory. I also checked the path and it seems to be fine. It works for me in offline testing with EasyPHP but as soon as I upload it it doesn't work. When I type the link directly to the image in the address bar all it does is bring up my home page. Xisto does support gifs right?


  4. In this tutorial you will learn most of the operations you can use on a

    text file. They include finding if a file exists, opening/creating a

    file, reading/writing file, closing file, copying file, deleting file.

    You will need a form with two buttons on it. Use the names Step1 and

    Step2.

    First thing we are going to do is import system.IO. To do this go into

    the forms code view. At the very top add this line.

    Imports system.IO

    This lets us use the file operations that we need for this tutorial.

    Next we need to check to see if a file exists. To do this double click

    on the step1 button and type this code.

    If File.Exists("TextFile.txt") then

    This line just checks if the file already exists. Next type this line

    of code.

    Dim ioFile as new StreamReader("TextFile.txt")

    This line of code opens "TextFile.txt" for reading. Now we are going to

    read the file and store it into a variable.

    Dim ioLine as string ' Going to hold one line at a timeDim ioLines as string ' Going to hold whole fileioLine = ioFile.ReadLineioLines = ioLineWhile not ioLine = ""ioLine = ioFile.ReadLineioLines = ioLines & vbcrlf & ioLineEnd While

    We now have the whole text file read into ioLines. Lets display the

    text in a message box.

    MsgBox(ioLines)

    Now we are going to close the file.

    ioFile.close

    Now that we are done reading a file. Lets do the else statement of the

    if File.Exists statement. The way this code is going to be set-up is if

    the file exists the program reads it. If it doesn't exist it writes a

    file.

    ElseDim ioFile as new StreamWriter("TextFile.txt")

    We now have a file open for writting. Lets write two lines to it.

    ioFile.WriteLine("Hi There")ioFile.WriteLine("User")

    So we have some text in the file now. Lets close the file.

    ioFile.Close

    We are done with reading/writting files so lets end the if statement

    End If

    That is it for that button. Now lets move onto deleteing files. Go back

    to form view and double click on the second button. In the code add

    these lines.

    If File.Exists("TextFile.txt")File.Delete("TextFile.txt")elsemsgbox("File doesn't exist")end if

    All this code does is check for the file then if it exists deletes it.

    If it doesn't exist then it tells the user that it doesn't exist.

    Thats it for this tutorial.

    Thanks,
    Rich

  5. Some software is free because the devloper doesn't want to sell it. They just want to give it away for people that don't have the money to go out and buy a retail version of some software.Other software is free because the devloper doesn't have the money for advertising, web hosting, making cds, worring about shipping. Or just don't want to deal with e-commerence.The last group of free software devlopers are people that just program for fun. These devlopers give there software away to help the online community.There is one last group of free software devlopers. The kind that do put spyware, adware, and viruses in there software. They devlop a program that everyone will like then add in all the spyware, adware, and viruses just to torment people.


  6. I just installed the mambo CMS and I try to edit the configuration file but it say "Unwriteable". How do make it writeable? It also says when I go in template install media/ Unwriteable administrator/templates/ Unwriteable templates/ Unwriteable images/stories/ UnwriteableWhat do I have to do?


  7. The Source code for this tutorial is here http://www.alcedosoftware.com/users/sign_in

    Introduction

    This tutorial will explain how to create a Tick based Render Loop in C#.

    All Source Code and Multimedia.dll is included in the .zip package at the top of the tutorial.

    Everything about timers
    One issue with this type of loop is that fact that the speed in which the computer can accomplish the tasks in the render loop varies from computer to computer. It even varies on the same computer according to how much memory and CPU time is available for the game at any given moment. We need to have some way of accounting for these differences to make sure that we animate consistently. So instead of treating each frame the same, we are going to calculate the time elapsed between frames and apply that value to our calculations.
    There are a couple of different ways of keeping track of time in Windows:
    1. System.Windows.Forms.Timer: This is the most common timer used in Windows programming. While it is easy to use, it only has a resolution of 1/18th of a second. Since we could have up to a thousand frames per second this resolution is not good enough for a game program.
    2. timeGetTime: This Windows DLL provides a resolution of 1 microsecond on some versions of Windows and 5 microseconds on Windows NT. This is too variable, and we really donât want to check the operating system our game is running on to see if we need to adjust the timer values.
    3. System.TickCount: This managed call returns the number of ticks that indicate the number of milliseconds. This is close to what we want, but we can do better.
    4. QueryPerformanceCounter: This is the preferred timer to use; it has a resolution of less than 1 microsecond. This is the timer most often used in game development.

    Multimedia.dll is a High Resolution Timer Based on The QueryPerformanceCounter that comes with Windows. We will be using it as it is more accurate and reliable than the System.Windows.Forms Timer.

    The Code

    To use the Multimedia Timer to do is:

    1: Create a Timer Object

    private Multimedia.Timer PaceTimer;

    2: Create a Callback Method for it

    private void Timer_Tick(object state){	//put any physics, AI and game play code here            //Clean Up      GC.Collect(); 	//render loop rerender every 10ms	this.Invalidate();}

    3: In The Class Constructor Initialize the PaceTimer

    PaceTimer = new Multimedia.Timer(new Multimedia.TimerCallback(Timer_Tick),null,Peroid,1);

    4: Start the timer in any method you want but if you are drawing graphics putting the Start code in the Constructor does not work well so my advice is to put it in the Load Event of the Form

    PaceTimer.Start();

    That is the Loop Started but now we want to actually render something

    Double Buffering and Drawing

    All Drawing should be done in the OnPaint method, and to stop flickering we will use 2 methods

    1: Add this line of code to the constructor of the class

    this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);

    This line says that all Painting will happen in the OnPaint() function, and that the screen is Opaque, the true bit just says that we want to enable these settings now.

    The Second one is Double Buffering.

    protected override void OnPaint(PaintEventArgs e){	e.Graphics.DrawLine(new Pen(Color.Red),50,50,100,100);}

    Drawing like this just using the Graphics object from e object draws straight to the screen which causes flickering

    If we implement Double Buffering it should stop the screen from flickering.

    Double Buffering is drawing what we want to draw to an in memory Bitmap, and then drawing the Bitmap to the screen.

    To implement Double Buffering we must create a Bitmap, Create a graphics object from the Bitmap, Draw everything to the Bitmap using the Graphics object we just created then drawing the Bitmap to the screen using the graphics object in e. below is an example.


    protected override void OnPaint(PaintEventArgs e){	// It will be double buffered to stop flickering	//Create Temporary Canvas	System.Drawing.Bitmap timage = new Bitmap(800,600);	//Create our Graphics Objects	System.Drawing.Graphics g = Graphics.FromImage(timage);	//Draw anything to the bitmap eg.	g.FillRectangle(new SolidBrush(Color.LightBlue),0,0,800,600);	e.Graphics.DrawImageUnscaled(timage,0,0,800,600);	g.Dispose();            GC.Collect(); }  

    We have used DrawImageUnscaled() because it is more efficient and give use better performance than DrawImage() does.

    The Sample Application show a Frame Counter which counts the number of times the screen has been rendered, also 2 Boxes that move towards each other, and pass just to show some simple animation.


    Written By Lloyd Sparkes. Part of the CyberWarfare Dev Team.

  8. When I started coding in VB.NET I was unsure of how to switch forms at a click of a button or any other event. So for anyone with the same problem this is for them.

    First you must have at least two forms in the project. If you do not know how to add forms to a project heres how:

    1) Under the "Project" Menu select "Add Windows Form..."

    2) In the dialog box that pops up near the bottom you will see "Name:" with a textbox beside it. In the text box type the name of the new form. For this example we will just use the default name, "Form2.vb"

    3) Click "Open"

    You now have two forms in your project. Now to switching forms.

    1) Double Click on Form1 in the "Solution Explorer".

    2) Add a button to the form.

    3) Double-Click on the button. The Code window should show up.

    4) In the code window type:

    Dim Form as new Form2	Form.Show
    5) That show the form. This step is not required. Use only if you want to hide the first form.
    Me.Hide
    Thats it! I know it is very basic but there are some people out there that need to learn the basics.

    Thanks,
    Email me at bob3695@gmail.com

  9. I have not heard of any new Rockstar games but I think a tokyo GTA would be sweet. I think they should spend the cash to be able to use real car names and company names instead of making them up and putting them on cars that are pretty much copys of the real thing.


  10. Correct me if i'm wrong but don't AMD's burn up pretty easy? Awhile back I heard they are fast but they burn up easy. I never used one so I can't really say but if it true about them burning up I would pick Intel. I have used intel all my life and it has never let me down. I am a programmer and a gammer. Works all around.


  11. Well we were planing on realesing it closed-source. We are hoping to get a site on here to host it. I know VB has its limitiaions but it works very good if you know how to use it. graphics wise we are not sure yet. I think we will need some cool backgrounds and icons but that might be it. If anyone would like to help in anyway email me at bob3695@gmail.com and I will see what we can do.

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.