Renderproblem behoben, Input verarbeitung, Positionsupdate
This commit is contained in:
60
Capter1/ax_funktions.hpp
Normal file
60
Capter1/ax_funktions.hpp
Normal file
@@ -0,0 +1,60 @@
|
||||
//Funktionsdeklaration ax_funktions.hpp
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
|
||||
namespace ax{
|
||||
void print_number(int x)
|
||||
{
|
||||
std::cout << "Die Zahl ist: " << x << std::endl;
|
||||
std::cout << "Das doppelte der Zahl ist: " << x*2 << std::endl;
|
||||
}
|
||||
|
||||
void print_char(char x)
|
||||
{
|
||||
std::cout << x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int sqrt(int x){
|
||||
return x*x;
|
||||
}
|
||||
|
||||
char shift(char x){
|
||||
return x-1;
|
||||
}
|
||||
|
||||
//allgmeine Funktion Deklaration ohne Argumente oder returns für einen unbekannten Datentyp
|
||||
template<typename T> std::string type_name();
|
||||
|
||||
//Spezialisierte Implementation von type_name() für einen entsprechenden Datentyp vgl. mit überladung
|
||||
template<> std::string type_name<int>() {return "Integer";}
|
||||
template<> std::string type_name<char>(){return "Char";}
|
||||
template<> std::string type_name<float>(){return "Float";}
|
||||
template<> std::string type_name<double>(){return "Double";}
|
||||
template<> std::string type_name<bool>(){return "Bool";}
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
void ausgebene(T a){
|
||||
std::cout << a << " ist vom Type " << type_name<T>()<< std::endl ;
|
||||
}
|
||||
|
||||
//CallByRefference
|
||||
|
||||
int fn_CtUp (int &a){
|
||||
a = ++a;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int clamp_int(int v, int lo, int hi) {
|
||||
if (v < lo) return lo;
|
||||
if (v > hi) return hi;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user