Skip to content

Instantly share code, notes, and snippets.

View Devhobby's full-sized avatar

Bartosz Gala Devhobby

View GitHub Profile
@Devhobby
Devhobby / ox.cpp
Created December 7, 2018 17:32
ox
// Okienka pierwsze starcie.cpp : definiuje punkt wejścia dla aplikacji
//
#include "stdafx.h"
#include "Okienka pierwsze starcie.h"
#include <windowsx.h>
#define MAX_LOADSTRING 100
// Zmienne globalne:
@Devhobby
Devhobby / sco1.cpp
Created December 6, 2018 17:06
scoreboard
ScoreBoard::ScoreBoard() : filestatus(true) {
std::ifstream scoreFile("score.dat");
if (!scoreFile.is_open()) {
filestatus = false;
for (auto &i : score)
i = 0;
} else {
for (auto &i : score)
@Devhobby
Devhobby / wsad.cpp
Created December 6, 2018 16:55
wsad
do
{
tst = 0;
char keyboardChar = _getch();
actualMove = (keyboardChar == 'w' || keyboardChar == 'W') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(0) ? 0
: (keyboardChar == 'd' || keyboardChar == 'D') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(1) ? 1
: (keyboardChar == 's' || keyboardChar == 'S') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(2) ? 2
: (keyboardChar == 'a' || keyboardChar == 'A') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(3) ? 3
: (keyboardChar == 'q' || keyboardChar == 'Q') && (p_player->get_actX() == p_player->get_endX() && p_player->get_actY() == p_player->get_endY()) ? 4
namespace particle {
Screen::Screen()
: m_window(NULL), m_renderer(NULL), m_texture(NULL), m_buffer1(NULL) {}
bool Screen::init() {
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
return false;
}
m_window = SDL_CreateWindow("Particle Explosion", SDL_WINDOWPOS_UNDEFINED,
@Devhobby
Devhobby / random.cpp
Created May 22, 2018 19:10
std::default_random_engine generator
#include <iostream>
#include <random>
int main(){
std::default_random_engine generator;
//wyświetla 20 liczb losowych z zakresu 0 do 9
std::uniform_int_distribution<int> distribution(0, 9);
for (int i = 0; i<20; ++i) {
#include <iostream>
#include <random>
int main()
{
std::default_random_engine generator;
for (int i = 0; i<20; ++i) {
std::cout << generator <<std::endl;
}
@Devhobby
Devhobby / Player.cpp
Created April 16, 2018 23:07
End Game
int Player::gameOver()
{
system("cls");
std::cout << " HP " << get_playerHp() << " zakonczone rundy " << get_playerRounds() << " Pozostalo czasu "
<< get_playerTime() << std::endl << std::endl;
if (get_endGame() == 1) std::cout << "\nNiestety twoje zdrowie spadlo do zera... umarles :) " << std::endl;
if (get_endGame() == 2) std::cout << "\nUciekasz wyjsciem bezpieczenstwa przed zakonczeniem zadania." << std::endl;
if (get_endGame() == 4) std::cout << "\nNiestety koniec czasu - przegrales." << std::endl;
if (get_endGame() == 3)
{
@Devhobby
Devhobby / Sore.board.cpp
Created April 16, 2018 22:46
Tabela wyników
// ScoreBoard.h ************************************************************
#pragma once
/*
* Tworzenie tabeli wygranych i zapis do pliku
*/
class ScoreBoard
{
int score[10]{}; //Tabela najwyzszych 10 wynikow
@Devhobby
Devhobby / Player.cpp
Created April 8, 2018 19:24
Realizacja przemieszczenia
int Player::move()
{
auto x = get_actX();
auto y = get_actY();
if (get_playerLastMove() == 0) { --x; set_actX(x); }
else if (get_playerLastMove() == 1) { ++y; set_actY(y); }
else if (get_playerLastMove() == 2) { ++x; set_actX(x); }
else if (get_playerLastMove() == 3) { --y; set_actY(y); }
else if (get_playerLastMove() == 4) return 3;
@Devhobby
Devhobby / Main.cpp
Last active April 8, 2018 21:31
?:
int actualMove;
do
{
tst = 0;
char keyboardChar = _getch(); //Pobieranie znaku z klawiatury
actualMove = (keyboardChar == 'w' || keyboardChar == 'W') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(0) ? 0
: (keyboardChar == 'd' || keyboardChar == 'D') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(1) ? 1
: (keyboardChar == 's' || keyboardChar == 'S') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(2) ? 2
: (keyboardChar == 'a' || keyboardChar == 'A') && p_p_worldArr[p_player->get_actX()][p_player->get_actY()].get_exitCell(3) ? 3