Programming From Scratch [2]

Old 3 Comments on Programming From Scratch [2] 54

If you haven’t already. check out the first part of the series.

Picked Question and Answer:
“Why [do I] prefer visual studio?” – It is the professional way of programming in the business world sadly. No professional businesses use free IDE’s.
(Feel free to ask questions, as I will answer 1 per post)

In the last lesson, we learned how to print text in a console window, but this isn’t enough. What about numbers? Well luckily, the scientist of computers made it easier to work with numbers as they all have special data types. There are several data types, and I will never explain them as it would overwhelm your little pathetic human brain, *I’m not saying I’m non-human.

Anyways, off-topic will only occur in the beginning. So in this lesson, I will blow your brains because I am not using Visual Studio for this lesson. I will be using MonoDevelop with a custom compiler. This compiler is confidential, however Sony Computer Entertainment America granted me the privilege to post code on GeekBrainDump exclusively.

In this lesson, we will create a small video player with OpenGL and C#. The videos I will be using are owned by me, so I will not supply access to them. Sign up here to get the compiler and SDK.

First, lets get a video created, I will be using Sony Vegas Pro 12, and other programs may vary in output. Create a video, then Render As.
Choose the following setting to render, and save in a folder with no other files, make this in your project’s assets folder if you would like.
{You may change the frames per second as needed per device and run-time, the default is 24.}
file

This will result in various frames in the selected folder.

files

 

After this, now we have a little code to make, if you want sound however, that is a new topic that will be discussed later.

I have decided to upload the files, and Eli may remove them as I don’t really have permission from him to do so, but you can download them here.

Lets look at the main method, that makes this all possible.
code-vid

This method decides which frame is next, and loads it to the user. We are brute-forcing with this else if chaos, but an alternative may also work. Such as getting string length and adding 0’s to the front till the length is no longer smaller than 6.
As you see I have a try and catch at the beginning of the update method.  We can try to delete the screen and unload it from ram, then write so in the console for debug purposes. If say the frame is 0, and isn’t created; it will catch it and continue running without issues. This is at the top so it can render fully before updating again.

 

Thanks for tuning into Tutorial 2, in Tutorial 3 we will max our knowledge and work on a cool piece of software that would be good to put on your resume.

Author

Katy Pillman

Katy Pillman is the Lead Programmer for Tactician Studios LLC. She is young, but experienced in the technical field, and writes in her free-time. △ ◎ × □

Related Articles

3 Comments

  1. ebey November 26, 2014 at 7:28 am

    QUESTION: May I know any specif reason why C# is used in game development?

  2. Lonwabo November 27, 2014 at 3:48 pm

    Katy, on your profile description it says your young, however, on the header it seems to mention that you’re a CEO. Not to be nosy (very nosy) but how are you a CEO?

Leave a comment

Back to Top