Daily Archives: December 6, 2014
Programming: Week 3 (cont.)
Ex. 3
Write a TemperatureConverter
class that handles conversions between Celsius, Fahrenheit and Kelvin. Each conversion mode should have its dedicated method; the user should be able to choose which conversion mode to use.
Here is the program:
#include
#include
#include
class TemperatureConverter
{
public:
void SetTemp(std::string input)//set methods – provide data entered by the user to the Class
{
int n = input.length();
char sist = input.at(n – 1);
float temp_part = std::stof(input.erase(n – 1, 1));
temperature = temp_part;
};
void SetSource(std::string input)
{
int n = input.length();
char sist = input.at(n – 1);
source = […]
Programming: Week 3 (cont.)
Ex. 3
Write a TemperatureConverter
class that handles conversions between Celsius, Fahrenheit and Kelvin. Each conversion mode should have its dedicated method; the user should be able to choose which conversion mode to use.
Here is the program:
#include
#include
#include
class TemperatureConverter
{
public:
void SetTemp(std::string input)//set methods – provide data entered by the user to the Class
{
int n = input.length();
char sist = input.at(n – 1);
float temp_part = std::stof(input.erase(n – 1, 1));
temperature = temp_part;
};
void SetSource(std::string input)
{
int n = input.length();
char sist = input.at(n – 1);
source = […]
6.12.14
Den här veckan har vi börjat ordentligt med spelprogrammering. Vi har kört mycket live kodning, att handledaren har skrivit och vi har skrivit av så vi har kunnat gå igenom rad för rad och se hur man bygger upp ett spel. Vi håller på med att återskapa arkanoid men vi är ännu inte riktigt klara, hittills har vi bara som en fungerande mall för att göra ett spel. Något som vi kommer ha användning av i framtiden! Och det är […]
6.12.14
Den här veckan har vi börjat ordentligt med spelprogrammering. Vi har kört mycket live kodning, att handledaren har skrivit och vi har skrivit av så vi har kunnat gå igenom rad för rad och se hur man bygger upp ett spel. Vi håller på med att återskapa arkanoid men vi är ännu inte riktigt klara, hittills har vi bara som en fungerande mall för att göra ett spel. Något som vi kommer ha användning av i framtiden! Och det är […]
Clean line
This week we continue to work with our character and our assignment was to clean up the character and give it clean lines.
I rushed it a bit since I did not plan my work too good.
This is how it turned out.
Clean line
This week we continue to work with our character and our assignment was to clean up the character and give it clean lines.
I rushed it a bit since I did not plan my work too good.
This is how it turned out.
Clean line
This week we continue to work with our character and our assignment was to clean up the character and give it clean lines.
I rushed it a bit since I did not plan my work too good.
This is how it turned out.
Clean line
This week we continue to work with our character and our assignment was to clean up the character and give it clean lines.
I rushed it a bit since I did not plan my work too good.
This is how it turned out.
Programming 3 Lighting
Hello, this week we have been going through how to properly render something in dirextX, there are several things to be considered. In my recent post I talked about creating a box and how we calculate it. But in order to make our box act as if it were in the real world there are a few things we must code, a light source is one major aspect in order to get an object to feel more real.
In directX there […]
Programming 3 Lighting
Hello, this week we have been going through how to properly render something in dirextX, there are several things to be considered. In my recent post I talked about creating a box and how we calculate it. But in order to make our box act as if it were in the real world there are a few things we must code, a light source is one major aspect in order to get an object to feel more real.
In directX there […]
Programming 3 Lighting
Hello, this week we have been going through how to properly render something in dirextX, there are several things to be considered. In my recent post I talked about creating a box and how we calculate it. But in order to make our box act as if it were in the real world there are a few things we must code, a light source is one major aspect in order to get an object to feel more real.
In directX there […]
Programming 3 Lighting
Hello, this week we have been going through how to properly render something in dirextX, there are several things to be considered. In my recent post I talked about creating a box and how we calculate it. But in order to make our box act as if it were in the real world there are a few things we must code, a light source is one major aspect in order to get an object to feel more real.
In directX there […]
Halvfungerande 5 kort pokersimulator
Skiljer mellan poänghänder, men inte mellan olika valörer av samma typ av poänghand (förutom olika ”High cards”)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//main
#include
#include
#include ”validate.h”
#include ”card.h”
#include ”deck.h”
#include ”hand.h”
int main(int argc, char* argv[])
{
Deck deck;
Card card;
Validate validate;
Hand playerOne;
Hand playerTwo;
int PlayerOneScore = 0;
int PlayerTwoScore = 0;
for (int i = 0; i != 4;)
{
std::cout << ”1. Shuffle (recommended) n2. Play two player match! n3. Display score nExit” << std::endl; // menu
std::cin >> i;
switch (i)
{
case 1:
{
deck.Shuffle(); // shuffle
std::cout << ”Shuffled..” << std::endl;
break;
}
case 2:
{
std::cout << ”Dealing.. ” << std::endl; //deal cards
for […]
Halvfungerande 5 kort pokersimulator
Skiljer mellan poänghänder, men inte mellan olika valörer av samma typ av poänghand (förutom olika ”High cards”)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//main
#include
#include
#include ”validate.h”
#include ”card.h”
#include ”deck.h”
#include ”hand.h”
int main(int argc, char* argv[])
{
Deck deck;
Card card;
Validate validate;
Hand playerOne;
Hand playerTwo;
int PlayerOneScore = 0;
int PlayerTwoScore = 0;
for (int i = 0; i != 4;)
{
std::cout << ”1. Shuffle (recommended) n2. Play two player match! n3. Display score nExit” << std::endl; // menu
std::cin >> i;
switch (i)
{
case 1:
{
deck.Shuffle(); // shuffle
std::cout << ”Shuffled..” << std::endl;
break;
}
case 2:
{
std::cout << ”Dealing.. ” << std::endl; //deal cards
for […]
Weak four (on my part)
This week has been purely about how to use the SDL library and about dividing things into appropriate classes as a foundation of games. That means we have one class for starting everything, one class for drawing everything on the screen, one class for handling states, etc… We learned to handle input from mouse and keyboard, we learned how to make a core loop of clearing screen drawing screen and presenting screen and lastly we larned about states, which was […]
Weak four (on my part)
This week has been purely about how to use the SDL library and about dividing things into appropriate classes as a foundation of games. That means we have one class for starting everything, one class for drawing everything on the screen, one class for handling states, etc… We learned to handle input from mouse and keyboard, we learned how to make a core loop of clearing screen drawing screen and presenting screen and lastly we larned about states, which was […]
switch (5 in a Row) – WIP
This week has been filled with new terms like Polymorphism, friend classes, virtual methods, forward declare, finite state machines… My brain feels melted. As a novice programmer these things may need some time to fully understand.
To help find my confidence again I decided to create a simple code for the game ”5 in a row”. Originally it’s a board game where two players by turns drop bricks on the top of the board where you can see the pieces […]
switch (5 in a Row) – WIP
This week has been filled with new terms like Polymorphism, friend classes, virtual methods, forward declare, finite state machines… My brain feels melted. As a novice programmer these things may need some time to fully understand.
To help find my confidence again I decided to create a simple code for the game ”5 in a row”. Originally it’s a board game where two players by turns drop bricks on the top of the board where you can see the pieces […]
switch (5 in a Row) – WIP
This week has been filled with new terms like Polymorphism, friend classes, virtual methods, forward declare, finite state machines… My brain feels melted. As a novice programmer these things may need some time to fully understand.
To help find my confidence again I decided to create a simple code for the game ”5 in a row”. Originally it’s a board game where two players by turns drop bricks on the top of the board where you can see the pieces […]
switch (5 in a Row) – WIP
This week has been filled with new terms like Polymorphism, friend classes, virtual methods, forward declare, finite state machines… My brain feels melted. As a novice programmer these things may need some time to fully understand.
To help find my confidence again I decided to create a simple code for the game ”5 in a row”. Originally it’s a board game where two players by turns drop bricks on the top of the board where you can see the pieces […]