Jump to content

  • Log In with Google      Sign In   
  • Create Account


lines


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 noobnerd   Members   -  Reputation: 128

Like
0Likes
Like

Posted 05 November 2012 - 09:58 AM

Hi there

I have been reading a book on C# for a while now and i think im beginning to have a somewhat rudimentary understanding of how it works, but so far the only things i have learned are console applications and different ways of making fancy methods and stuff. Before C# i learned Dark Basic mainly by trial and error by doing small graphics programs that looked cool.
So to the point. How do i do small graphics programs in C#? In Basic there are commands like line(x1,y1,x2,y2,color) and i assume that such stuff doesnt exist in C# so how do i do this? I checked the book and it only tells me how to use C#, not how to actually do things with it that anybody would like to use.

Thank you

Sponsor:

#2 Telastyn   Crossbones+   -  Reputation: 3722

Like
0Likes
Like

Posted 05 November 2012 - 10:55 AM

not how to actually do things with it that anybody would like to use.


Even in games, graphical output is a very small percentage of the entire program. Knowing how to solve problems and make the code do what you want is what people want to use.

That said, the System.Drawing namespace has some things to do that. Not great things, and not things that can be used too much for games; but enough to get your feet wet. After that, you'll need to pick and use some API dedicated to graphical rendering. But learn the language first. It'll give you a good foundation once you start trying to use the APIs.

#3 Nypyren   Crossbones+   -  Reputation: 3720

Like
1Likes
Like

Posted 05 November 2012 - 12:29 PM

1. Make a "Windows Forms Application"
2. In the file "Form1.cs", add the following method:

protected override void OnPaint(PaintEventArgs e)
{
    base.OnPaint(e);

    e.Graphics.DrawLine(Pens.Black, 0, 0, 100, 100);
}

(This assumes you're using some version of Visual Studio)

If you've never written a WinForms app in Visual Studio before, you will have to right click on the Form1.cs item in the solution explorer and select "View Code" in order to view the C# (by default it will display the visual form designer).

ProTip: You can use the code viewer by default by right clicking Form1.cs, clicking "open with...", selecting "CSharp Editor", and clicking "Set as Default".

Edited by Nypyren, 05 November 2012 - 12:34 PM.


#4 lride   Members   -  Reputation: 633

Like
0Likes
Like

Posted 05 November 2012 - 01:20 PM

Dark basic is a language dedicated to game programming, so it has some graphics command built in.
But c# is more like a general purpose language so it doesn't have a nice graphics tool designed for game.

You should start looking at XNA after getting comfortable with C#

Edited by lride, 05 November 2012 - 01:32 PM.

An invisible text.

#5 noobnerd   Members   -  Reputation: 128

Like
0Likes
Like

Posted 05 November 2012 - 03:07 PM

Thanks for the quick replies.

@ Telastyn : I know, but i just think that doing programs that you are interseted in is a good way to learn the language, instead of just doing endless examples of different method attributes etc. that just show you what it does. Of course this would only help me get comfy with C# basics as it is not like i would ever come up with something like abstracts or such except by reading it in the book. System.Drawing, okay thanks, but how do i use them, i cant just draw a line in the console. Are they used on windows forms?

@Nypyren : Thanks! will try it out

@Iride : Yeah, thats why i moved to C# from Basic.

#6 muratsal   Members   -  Reputation: 141

Like
0Likes
Like

Posted 06 November 2012 - 02:19 AM

you should search gdi and gdi+ for windows form applications .
my map aplications http://haritaaraci.com

#7 3Ddreamer   Crossbones+   -  Reputation: 2960

Like
0Likes
Like

Posted 06 November 2012 - 01:19 PM

Hi,

It sounds as though you are a few months from getting good simple results from the graphics engine of your choice, probably by an existing game development system like XNA.

After you are good at basic programs, worked with XNA for a while, then look at SharpDX or MonoDevelop/Mono. Knowing that the communities which support these development environments have the knowledge and experience is your key, so once you get there put the key in the proverbial hole and open it.Posted Image

Clinton

Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#8 Telastyn   Crossbones+   -  Reputation: 3722

Like
0Likes
Like

Posted 06 November 2012 - 02:07 PM

i just think that doing programs that you are interseted in is a good way to learn the language


And I think that having seen beginners bite off more than they can chew for more than a decade now, you should err towards getting a good foundation.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS