Skip to content

Instantly share code, notes, and snippets.

Bartosz Gala Devhobby

Block or report user

Report or block Devhobby

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ox.cpp
// 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:
View sco1.cpp
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)
View wsad.cpp
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
View particle.cpp
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
std::default_random_engine generator
View random.cpp
#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) {
View generator.cpp
#include <iostream>
#include <random>
int main()
{
std::default_random_engine generator;
for (int i = 0; i<20; ++i) {
std::cout << generator <<std::endl;
}
View Player.cpp
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)
{
View Sore.board.cpp
// 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 Apr 8, 2018
Realizacja przemieszczenia
View Player.cpp
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;
View Main.cpp
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
You can’t perform that action at this time.