Friday, February 7, 2020

Digest for comp.lang.c++@googlegroups.com - 15 updates in 3 topics

fir <profesor.fir@gmail.com>: Feb 06 04:01PM -0800

W dniu czwartek, 6 lutego 2020 23:22:42 UTC+1 użytkownik fir napisał:
 
> > Here you are! Compiles fine
 
> oj sorry i didnt noticed that.. if
> so i will try it toomorrow
 
ok, after abother (thoug smaller dose of frustration and crashes i managed to obtain something that compiles and not crashes)
 
i may post it, i think
 
the source of this code is somewhat 'winding'
 
some girl coder i know took some code aof snake probably from some youtube tutorial, cutted it downe transfered in into something weird (redundant etc), then i take it to simplify it, then i take it to turn it to 3 'classes' instead of 2, but i not repaired all names so some names gere would need to be changed
(like yts Mover it should be snake, attached_window should be renamed etc)
 
 
//main.cpp
 
#include "mover.h"
#include "food.h"
#include "window.h"
 
 
GameWindow window;
 
int main()
{
window.start();
return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
#ifndef FOOD_H
#define FOOD_H
#include <SFML/Graphics.hpp>
 
using namespace sf;
 
class GameWindow;
class Mover;
 
class Food
{
public:
Food( GameWindow& window);
 
void init();
void move2RandomPosition();
void draw();
 
Vector2f getPosition();
private:
Vector2u size = Vector2u(20, 20);
Vector2u position = Vector2u(0, 0);
 
GameWindow& attached_window;
 
};
 

No comments: