Browsing 'Programming': Posts from Game Design and Programming

Weekly programming – sending images with a C++ web server (v48)

I’ve completed our second assignment of the course, the C++ web server.
After having completed the required tasks for the assignment I challenged myself by trying to send images with the server as well. It seems easy, you need to load the image into memory and send it as usual with a HTTP-header. Well, it wasn’t as easy as that for me, I needed to make some major changes to my previous code.
The first step, loading the image into memory. I had […]

/ Comments Off on Weekly programming – sending images with a C++ web server (v48)
Program: Programming

Weekly programming – sending images with a C++ web server (v48)

I’ve completed our second assignment of the course, the C++ web server.
After having completed the required tasks for the assignment I challenged myself by trying to send images with the server as well. It seems easy, you need to load the image into memory and send it as usual with a HTTP-header. Well, it wasn’t as easy as that for me, I needed to make some major changes to my previous code.
The first step, loading the image into memory. I had […]

/ Comments Off on Weekly programming – sending images with a C++ web server (v48)
Program: Programming

Weekly programming – sending images with a C++ web server (v48)

I’ve completed our second assignment of the course, the C++ web server.
After having completed the required tasks for the assignment I challenged myself by trying to send images with the server as well. It seems easy, you need to load the image into memory and send it as usual with a HTTP-header. Well, it wasn’t as easy as that for me, I needed to make some major changes to my previous code.
The first step, loading the image into memory. I had […]

/ Comments Off on Weekly programming – sending images with a C++ web server (v48)
Program: Programming

Weekly programming – sending images with a C++ web server (v48)

I’ve completed our second assignment of the course, the C++ web server.
After having completed the required tasks for the assignment I challenged myself by trying to send images with the server as well. It seems easy, you need to load the image into memory and send it as usual with a HTTP-header. Well, it wasn’t as easy as that for me, I needed to make some major changes to my previous code.
The first step, loading the image into memory. I had […]

/ Comments Off on Weekly programming – sending images with a C++ web server (v48)
Program: Programming

GAME PROGRAMMING I: WEEK THREE

This week we started using classes and inheritance. Again subjects that I know from earlier courses, but again nice with a refresher. We did touch on structs last week which are similar but are less usefull than classes.
Classes are a collection of data, that could either be methods(function that belongs to a class) or variables. If a class inherits from a base class, it receives the methods and variables from the base class.
When using classes we create objects, a defining feature of […]

/ Comments Off on GAME PROGRAMMING I: WEEK THREE
Program: Programming

GAME PROGRAMMING I: WEEK THREE

This week we started using classes and inheritance. Again subjects that I know from earlier courses, but again nice with a refresher. We did touch on structs last week which are similar but are less usefull than classes.
Classes are a collection of data, that could either be methods(function that belongs to a class) or variables. If a class inherits from a base class, it receives the methods and variables from the base class.
When using classes we create objects, a defining feature of […]

/ Comments Off on GAME PROGRAMMING I: WEEK THREE
Program: Programming

Week 3

This week’s lectures have mostly been focused on classes and using header files in visual studio. I find that I can keep up somewhat during the lectures, but have a bit of a challenge when I try to use what I have learned. The weekly exercise assignments greatly help me to really understand how to implement the things we hear about during the lectures. This week’s exercises are much harder to solve then earlier weeks (would be strange if they […]

/ Comments Off on Week 3
Program: Programming

Week 3

This week’s lectures have mostly been focused on classes and using header files in visual studio. I find that I can keep up somewhat during the lectures, but have a bit of a challenge when I try to use what I have learned. The weekly exercise assignments greatly help me to really understand how to implement the things we hear about during the lectures. This week’s exercises are much harder to solve then earlier weeks (would be strange if they […]

/ Comments Off on Week 3
Program: Programming

Week 3

This week’s lectures have mostly been focused on classes and using header files in visual studio. I find that I can keep up somewhat during the lectures, but have a bit of a challenge when I try to use what I have learned. The weekly exercise assignments greatly help me to really understand how to implement the things we hear about during the lectures. This week’s exercises are much harder to solve then earlier weeks (would be strange if they […]

/ Comments Off on Week 3
Program: Programming

Week 3

This week’s lectures have mostly been focused on classes and using header files in visual studio. I find that I can keep up somewhat during the lectures, but have a bit of a challenge when I try to use what I have learned. The weekly exercise assignments greatly help me to really understand how to implement the things we hear about during the lectures. This week’s exercises are much harder to solve then earlier weeks (would be strange if they […]

/ Comments Off on Week 3
Program: Programming

// TemperatureConverter.h
#pragma once
class TemperatureConverter
{
public:
TemperatureConverter();
float CelsiusConvert(float& value, int& returnType);
float KelvinConvert(float& value, int& returnType);
float FahrenheitConvert(float& value, int& returnType);
};
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// TemperatureConverter.cpp
#include
#include
#include ”TemperatureConverter.h”
TemperatureConverter::TemperatureConverter()
{
}
float TemperatureConverter::CelsiusConvert(float& value, int& returnType)
{
switch (returnType)
{
case 1: //return fahrenheit
{
return (value + 273.15f);
break;
}
case 2: // return Kelvin
{
return (value * 9 / 5 + 32);
break;
}
default:
{
return 0;
break;
}
}
}
float TemperatureConverter::KelvinConvert(float& value, int& returnType)
{
switch (returnType)
{
case 1: //return celsius
{
return (value – 273.15f);
break;
}
case 2: // return fahrenheit
{
return ((value – 273.15f) * 9 / 5 + 32);
break;
}
default:
{
return 0;
break;
}
}
}
float TemperatureConverter::FahrenheitConvert(float& value, int& returnType)
{
switch (returnType)
{
case 1: // return celsius
{
return ((value – 32) […]

/ Comments Off on
Program: Programming

// TemperatureConverter.h
#pragma once
class TemperatureConverter
{
public:
TemperatureConverter();
float CelsiusConvert(float& value, int& returnType);
float KelvinConvert(float& value, int& returnType);
float FahrenheitConvert(float& value, int& returnType);
};
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// TemperatureConverter.cpp
#include
#include
#include ”TemperatureConverter.h”
TemperatureConverter::TemperatureConverter()
{
}
float TemperatureConverter::CelsiusConvert(float& value, int& returnType)
{
switch (returnType)
{
case 1: //return fahrenheit
{
return (value + 273.15f);
break;
}
case 2: // return Kelvin
{
return (value * 9 / 5 + 32);
break;
}
default:
{
return 0;
break;
}
}
}
float TemperatureConverter::KelvinConvert(float& value, int& returnType)
{
switch (returnType)
{
case 1: //return celsius
{
return (value – 273.15f);
break;
}
case 2: // return fahrenheit
{
return ((value – 273.15f) * 9 / 5 + 32);
break;
}
default:
{
return 0;
break;
}
}
}
float TemperatureConverter::FahrenheitConvert(float& value, int& returnType)
{
switch (returnType)
{
case 1: // return celsius
{
return ((value – 32) […]

/ Comments Off on
Program: Programming

Programming week 3 – Classes

This week we have been going through Classes and Class Inheritance. which felt like an easier concept to grasp than the previous, since we had already been working with this a bit when creating ”Pong” earlier in the course.
Classes are just like variables different data structures that can be called within the main function, they can have different functions inside of them. That way we can use classes to reduce the amount of code we have to write, making it […]

/ Comments Off on Programming week 3 – Classes
Program: Programming

Programming week 3 – Classes

This week we have been going through Classes and Class Inheritance. which felt like an easier concept to grasp than the previous, since we had already been working with this a bit when creating ”Pong” earlier in the course.
Classes are just like variables different data structures that can be called within the main function, they can have different functions inside of them. That way we can use classes to reduce the amount of code we have to write, making it […]

/ Comments Off on Programming week 3 – Classes
Program: Programming

Programming week 3 – Classes

This week we have been going through Classes and Class Inheritance. which felt like an easier concept to grasp than the previous, since we had already been working with this a bit when creating ”Pong” earlier in the course.
Classes are just like variables different data structures that can be called within the main function, they can have different functions inside of them. That way we can use classes to reduce the amount of code we have to write, making it […]

/ Comments Off on Programming week 3 – Classes
Program: Programming

Programming week 3 – Classes

This week we have been going through Classes and Class Inheritance. which felt like an easier concept to grasp than the previous, since we had already been working with this a bit when creating ”Pong” earlier in the course.
Classes are just like variables different data structures that can be called within the main function, they can have different functions inside of them. That way we can use classes to reduce the amount of code we have to write, making it […]

/ Comments Off on Programming week 3 – Classes
Program: Programming

BlogPosts[2] = new blogPost(3);

Hopefully this works now. Apparently my blog posts wasn’t showing up for some reason. I guess I just missed the right instructions or something. Anyways, this has been the result of week three:
It has been way too much and way too little at the same time. As I have programmed before the exercises seemed like a repetition of what I have already learned, but with some small changes in syntax, which was really annoying to find out about because there […]

/ Comments Off on BlogPosts[2] = new blogPost(3);
Program: Programming

BlogPosts[2] = new blogPost(3);

Hopefully this works now. Apparently my blog posts wasn’t showing up for some reason. I guess I just missed the right instructions or something. Anyways, this has been the result of week three:
It has been way too much and way too little at the same time. As I have programmed before the exercises seemed like a repetition of what I have already learned, but with some small changes in syntax, which was really annoying to find out about because there […]

/ Comments Off on BlogPosts[2] = new blogPost(3);
Program: Programming

Tredje veckan

Under denna vecka gick vi igenom klasser, klasser och lite mer klasser samt arv.
Nu under fredagen presenterade vissa för klassen hur deras variant av en uppgift var gjord. Så man kunde få en bild av hur koden för uppgifterna kunde skrivas.
Nedanför är koden för ett program som räknar antalet bokstäver i en sträng. Jag använde här algorithm för att underlätta och hålla koden kort. Detta var inte medvetet och det skulle ha gått lika bra att använda loopar och if […]

/ Comments Off on Tredje veckan
Program: Programming

Tredje veckan

Under denna vecka gick vi igenom klasser, klasser och lite mer klasser samt arv.
Nu under fredagen presenterade vissa för klassen hur deras variant av en uppgift var gjord. Så man kunde få en bild av hur koden för uppgifterna kunde skrivas.
Nedanför är koden för ett program som räknar antalet bokstäver i en sträng. Jag använde här algorithm för att underlätta och hålla koden kort. Detta var inte medvetet och det skulle ha gått lika bra att använda loopar och if […]

/ Comments Off on Tredje veckan
Program: Programming

Week 3

Hello!
Now three weeks have gone since I started with programming and I feel like it really picking up now.
This week we went through classes and inheritance which was a completley new concept to me besides the little dipping in structs last week. While I immediately grasped and liked the use of structs as a way to structure your code and clump variables, classes were more confusing. They were similar to structs in that they were used in a way to structure […]

/ Comments Off on Week 3
Program: Programming

Week 3

Hello!
Now three weeks have gone since I started with programming and I feel like it really picking up now.
This week we went through classes and inheritance which was a completley new concept to me besides the little dipping in structs last week. While I immediately grasped and liked the use of structs as a way to structure your code and clump variables, classes were more confusing. They were similar to structs in that they were used in a way to structure […]

/ Comments Off on Week 3
Program: Programming

Game programming week 3 – Classes, classes, classes

This week in game programming, we’ve been going through classes a lot. A class is a data structure that apart from variables, also can contain functions. Therefore, a class is often used to store a lot of functions in, so they can be used again within the program without having to rewrite them. A class is created in a header-file, and then called to when it’s used in the ”int main” function call. We also went through class inheritance, which […]

/ Comments Off on Game programming week 3 – Classes, classes, classes
Program: Programming

Game programming week 3 – Classes, classes, classes

This week in game programming, we’ve been going through classes a lot. A class is a data structure that apart from variables, also can contain functions. Therefore, a class is often used to store a lot of functions in, so they can be used again within the program without having to rewrite them. A class is created in a header-file, and then called to when it’s used in the ”int main” function call. We also went through class inheritance, which […]

/ Comments Off on Game programming week 3 – Classes, classes, classes
Program: Programming