Commits

Mateo Imbrišak committed 087e8fb

Picture and other files. We mentioned it before, but we didn't add it. Now they're here

  • Participants
  • Parent commits 183319a

Comments (0)

Files changed (7)

File Pucaljka.cbp.orig

+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<CodeBlocks_project_file>
+	<FileVersion major="1" minor="6" />
+	<Project>
+		<Option title="Pucaljka" />
+		<Option pch_mode="2" />
+		<Option compiler="gcc" />
+		<Build>
+			<Target title="Debug">
+				<Option output="bin\Debug\Pucaljka" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj\Debug\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-g" />
+				</Compiler>
+			</Target>
+			<Target title="Release">
+				<Option output="bin\Release\Pucaljka" prefix_auto="1" extension_auto="1" />
+				<Option object_output="obj\Release\" />
+				<Option type="1" />
+				<Option compiler="gcc" />
+				<Compiler>
+					<Add option="-O2" />
+				</Compiler>
+				<Linker>
+					<Add option="-s" />
+				</Linker>
+			</Target>
+		</Build>
+		<Compiler>
+			<Add option="-Wall" />
+		</Compiler>
+		<Linker>
+			<Add library="mingw32" />
+			<Add library="SDLmain" />
+			<Add library="SDL" />
+			<Add library="OpenGL32" />
+			<Add library="glu32" />
+			<Add library="SDL_image" />
+		</Linker>
+		<Unit filename="bullet.cpp" />
+		<Unit filename="bullet.h" />
+		<Unit filename="button.cpp" />
+		<Unit filename="button.h" />
+		<Unit filename="enemyship.cpp" />
+		<Unit filename="enemyship.h" />
+		<Unit filename="gamemode.cpp" />
+		<Unit filename="gamemode.h" />
+		<Unit filename="gameobject.cpp" />
+		<Unit filename="gameobject.h" />
+		<Unit filename="gm_level.cpp" />
+		<Unit filename="gm_level.h" />
+		<Unit filename="gm_mainmenu.cpp" />
+		<Unit filename="gm_mainmenu.h" />
+		<Unit filename="layer.cpp" />
+		<Unit filename="layer.h" />
+		<Unit filename="playership.cpp" />
+		<Unit filename="playership.h" />
+		<Unit filename="pucaljka.cpp" />
+		<Unit filename="texture.cpp" />
+		<Unit filename="texture.h" />
+		<Extensions>
+			<code_completion />
+			<debugger />
+			<envvars />
+		</Extensions>
+	</Project>
+</CodeBlocks_project_file>

File Pucaljka.depend

+# depslib dependency file v1.0
+1365866086 source:e:\pucaljka\button.cpp
+	"button.h"
+	"texture.h"
+	"gm_level.h"
+
+1365866086 e:\pucaljka\button.h
+	<SDL/SDL_events.h>
+	<string>
+	"texture.h"
+
+1365866086 e:\pucaljka\texture.h
+	<string>
+	<GL/gl.h>
+	<OpenGL/gl.h>
+
+1367074842 e:\pucaljka\gm_level.h
+	<SDL/SDL.h>
+	<vector>
+	"gamemode.h"
+	"gameobject.h"
+	"enemyship.h"
+	"bullet.h"
+
+1365866086 e:\pucaljka\gamemode.h
+	<SDL/SDL.h>
+
+1365866086 e:\pucaljka\gameobject.h
+	<SDL/SDL.h>
+
+1366473868 e:\pucaljka\enemyship.h
+	<SDL/SDL_events.h>
+	<string>
+	"texture.h"
+
+1366473868 source:e:\pucaljka\enemyship.cpp
+	"EnemyShip.h"
+	"texture.h"
+	<math.h>
+
+1365866086 source:e:\pucaljka\gamemode.cpp
+	"gamemode.h"
+
+1365866086 source:e:\pucaljka\gameobject.cpp
+	"gameobject.h"
+
+1367075396 source:e:\pucaljka\gm_level.cpp
+	"gm_level.h"
+	<GL/gl.h>
+	<GL/glu.h>
+	<OpenGL/gl.h>
+	<OpenGL/glu.h>
+	"gameobject.h"
+	"layer.h"
+	"enemyship.h"
+	"playership.h"
+	"yellowenemyship.h"
+	"bullet.h"
+
+1365866086 e:\pucaljka\layer.h
+	<string>
+	"texture.h"
+
+1366473868 e:\pucaljka\playership.h
+	<SDL/SDL_events.h>
+	<string>
+	"texture.h"
+
+1366473868 source:e:\pucaljka\gm_mainmenu.cpp
+	"gm_mainmenu.h"
+	<GL/gl.h>
+	<GL/glu.h>
+	<OpenGL/gl.h>
+	<OpenGL/glu.h>
+	"button.h"
+	"layer.h"
+
+1365866086 e:\pucaljka\gm_mainmenu.h
+	<SDL/SDL.h>
+	<vector>
+	"gamemode.h"
+
+1365866086 source:e:\pucaljka\layer.cpp
+	"layer.h"
+	"texture.h"
+
+1366473962 source:e:\pucaljka\playership.cpp
+	"playership.h"
+	"texture.h"
+	<SDL/SDL_events.h>
+	"bullet.h"
+	"gm_level.h"
+
+1366473868 source:e:\pucaljka\pucaljka.cpp
+	<stdio.h>
+	<SDL/SDL.h>
+	"gamemode.h"
+	"gameobject.h"
+	"gm_mainmenu.h"
+	"gm_level.h"
+
+1365866086 source:e:\pucaljka\texture.cpp
+	<SDL/SDL.h>
+	<SDL/SDL_image.h>
+	<GL/glu.h>
+	<SDL/SDL.h>
+	<SDL_image/SDL_image.h>
+	<OpenGL/glu.h>
+	"texture.h"
+
+1367075396 source:e:\pucaljka\bullet.cpp
+	"bullet.h"
+	"texture.h"
+	"playership.h"
+
+1367074490 e:\pucaljka\bullet.h
+	<SDL/SDL_events.h>
+	<string>
+	"gameobject.h"
+
+1366445752 source:f:\pucaljka\bullet.cpp
+	"bullet.h"
+	"texture.h"
+
+1365866272 f:\pucaljka\bullet.h
+	<SDL/SDL_events.h>
+	<string>
+	"texture.h"
+
+1365866086 f:\pucaljka\texture.h
+	<string>
+	<GL/gl.h>
+	<OpenGL/gl.h>
+
+1365866086 source:f:\pucaljka\button.cpp
+	"button.h"
+	"texture.h"
+	"gm_level.h"
+
+1365866086 f:\pucaljka\button.h
+	<SDL/SDL_events.h>
+	<string>
+	"texture.h"
+
+1365866086 f:\pucaljka\gm_level.h
+	<SDL/SDL.h>
+	<vector>
+	"gamemode.h"
+	"gameobject.h"
+	"enemyship.h"
+
+1365866086 f:\pucaljka\gamemode.h
+	<SDL/SDL.h>
+
+1365866086 f:\pucaljka\gameobject.h
+	<SDL/SDL.h>
+
+1365866086 f:\pucaljka\enemyship.h
+	<SDL/SDL_events.h>
+	<string>
+	"texture.h"
+
+1365866086 source:f:\pucaljka\enemyship.cpp
+	"EnemyShip.h"
+	"texture.h"
+
+1365866086 source:f:\pucaljka\gamemode.cpp
+	"gamemode.h"
+
+1365866086 source:f:\pucaljka\gameobject.cpp
+	"gameobject.h"
+
+1365866086 source:f:\pucaljka\gm_level.cpp
+	"gm_level.h"
+	<GL/gl.h>
+	<GL/glu.h>
+	<OpenGL/gl.h>
+	<OpenGL/glu.h>
+	"gameobject.h"
+	"layer.h"
+	"enemyship.h"
+	"playership.h"
+
+1365866086 f:\pucaljka\layer.h
+	<string>
+	"texture.h"
+
+1365866086 f:\pucaljka\playership.h
+	<SDL/SDL_events.h>
+	<string>
+	"texture.h"
+
+1365866086 source:f:\pucaljka\gm_mainmenu.cpp
+	"gm_mainmenu.h"
+	<GL/gl.h>
+	<GL/glu.h>
+	<OpenGL/gl.h>
+	<OpenGL/glu.h>
+	"button.h"
+	"layer.h"
+
+1365866086 f:\pucaljka\gm_mainmenu.h
+	<SDL/SDL.h>
+	<vector>
+	"gamemode.h"
+
+1365866086 source:f:\pucaljka\layer.cpp
+	"layer.h"
+	"texture.h"
+
+1365866086 source:f:\pucaljka\playership.cpp
+	"playership.h"
+	"texture.h"
+	<SDL/SDL_events.h>
+
+1365866086 source:f:\pucaljka\pucaljka.cpp
+	<stdio.h>
+	<SDL/SDL.h>
+	"gamemode.h"
+	"gameobject.h"
+	"gm_mainmenu.h"
+	"gm_level.h"
+
+1365866086 source:f:\pucaljka\texture.cpp
+	<SDL/SDL.h>
+	<SDL/SDL_image.h>
+	<GL/glu.h>
+	<SDL/SDL.h>
+	<SDL_image/SDL_image.h>
+	<OpenGL/glu.h>
+	"texture.h"
+
+1366473868 e:\pucaljka\yellowenemyship.h
+	"enemyship.h"
+
+1366473868 source:e:\pucaljka\yellowenemyship.cpp
+	<math.h>
+	"yellowenemyship.h"
+
+#include "bullet.h"
+#include "texture.h"
+#include "playership.h"
+
+
+Bullet::Bullet( int argX, int argY) : x(argX), y(argY), texture(new Texture("bullet.png"))
+{
+}
+
+void
+Bullet::updateSelf(const float timeDelta)
+{
+	this->x+=100 * timeDelta;
+
+}
+
+
+void
+Bullet::paintSelf()
+{
+
+this->texture->bind();
+    glEnable(GL_TEXTURE_2D);
+
+    glMatrixMode(GL_MODELVIEW);
+    glPushMatrix();
+    glTranslatef(this->x, this->y, 0);
+	glBegin(GL_TRIANGLES);
+
+
+    glTexCoord2f(0, 0);
+    glVertex2f(-0.5, -0.5);
+    glTexCoord2f(0, 1);
+    glVertex2f(-0.5, 0.5);
+    glTexCoord2f(1, 1);
+    glVertex2f(0.5, 0.5);
+
+    glTexCoord2f(1, 1);
+    glVertex2f(0.5, 0.5);
+    glTexCoord2f(1, 0);
+    glVertex2f(0.5, -0.5);
+    glTexCoord2f(0, 0);
+    glVertex2f(-0.5, -0.5);
+
+    glEnd();
+    glPopMatrix();
+
+}
+#ifndef PUCALJKA_BULLET_H
+#define PUCALJKA_BULLET_H
+#include <SDL/SDL_events.h>
+#include <string>
+#include "gameobject.h"
+
+
+class Texture;
+
+class Bullet : public GameObject
+{
+    public:
+    Bullet( const int x,
+            const int y);
+
+
+    virtual void paintSelf(void);
+
+
+    virtual void updateSelf(const float timeDelta);
+
+    private:
+    Texture*texture;
+    float x,y;
+};
+
+#endif
+
+

File bullet.png

Added
New image

File gm_level.cpp.orig

+#include "gm_level.h"
+#ifndef __APPLE__
+#include <GL/gl.h>
+#include <GL/glu.h>
+#else
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#endif
+#include "gameobject.h"
+#include "layer.h"
+#include "enemyship.h"
+#include "playership.h"
+
+extern bool gRunning;
+extern SDL_Surface * gScreen;
+
+void
+GM_Level::addGameObject(const GameObject *gameObject)
+{
+	this->gameObjects.push_back((GameObject*)gameObject);
+}
+
+GM_Level::~GM_Level()
+{
+    delete playership;
+}
+
+GM_Level::GM_Level() : playership(new PlayerShip("playership.png", 150, 200))
+{
+    EnemyShip *enemyShip(new EnemyShip("enemyship01.png", 600, 400));
+    this->enemyShips.push_back(enemyShip);
+}
+
+void
+GM_Level::keyDown(const SDL_Event& event)
+{
+    switch(event.key.keysym.sym)
+    {
+        case SDLK_ESCAPE:
+        gRunning = false;
+        break;
+
+        case SDLK_LEFT:
+        playership->keyDown(event);
+        break;
+
+        case SDLK_RIGHT:
+        playership->keyDown(event);
+        break;
+
+        case SDLK_UP:
+        playership->keyDown(event);
+        break;
+
+        case SDLK_DOWN:
+        playership->keyDown(event);
+        break;
+
+        default:
+        GameMode::keyDown(event);
+        break;
+    }
+
+
+}
+void
+GM_Level::keyUp(const SDL_Event &event)
+{
+    this->playership->keyUp(event);
+}
+
+void
+GM_Level::paintSelf()
+{
+    glViewport(0, 0, gScreen->w, gScreen->h);
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
+    gluOrtho2D(0, gScreen->w, gScreen->h, 0);
+
+    glMatrixMode(GL_MODELVIEW);
+    glLoadIdentity();
+
+    playership->paintSelf();
+    for(std::vector<EnemyShip*>::iterator it = enemyShips.begin(); it != enemyShips.end(); it++)
+    {
+        (*it)->paintSelf();
+    }
+
+    SDL_GL_SwapBuffers();
+}
+
+void
+GM_Level::mouseDown(const SDL_Event& event)
+{
+    this->playership->mouseDown(event);
+}
+
+void
+GM_Level::mouseUp(const SDL_Event& event)
+{
+    this->playership->mouseUp(event);
+}
+
+
+void
+GM_Level::mouseMove(const SDL_Event& event)
+{
+    this->playership->mouseMove(event);
+}
+void GM_Level::updateSelf(double timeDelta)
+{
+    this->playership->updateSelf(timeDelta);
+    for(std::vector<EnemyShip*>::iterator it = enemyShips.begin(); it != enemyShips.end(); it++)
+    {
+        (*it)->updateSelf(timeDelta);
+    }
+}

File playership.cpp.orig

+#include "playership.h"
+#include "texture.h"
+#include <SDL/SDL_events.h>
+#include "bullet.h"
+#include "gm_level.h"
+
+static const double playerShipAngleV = 180;
+extern GameMode* gGame;
+
+PlayerShip::PlayerShip(const std::string& textureFile,
+                       const int argX,
+                       const int argY) : texture(new Texture(textureFile)), x(argX), y(argY), angle(0), angleV(0)
+{
+
+}
+PlayerShip::~PlayerShip()
+{
+    delete this->texture;
+}
+void
+PlayerShip::paintSelf()
+{
+    this->texture->bind();
+    glEnable(GL_TEXTURE_2D);
+
+    glMatrixMode(GL_MODELVIEW);
+    glPushMatrix();
+    glTranslatef(this->x, this->y, 0);
+    glScalef(64, 64, 0);
+    glRotatef(90, 0, 0, 1);
+    glRotatef(angle, 0, 0, 1);
+    glBegin(GL_TRIANGLES);
+
+
+    glTexCoord2f(0, 0);
+    glVertex2f(-0.5, -0.5);
+    glTexCoord2f(0, 1);
+    glVertex2f(-0.5, 0.5);
+    glTexCoord2f(1, 1);
+    glVertex2f(0.5, 0.5);
+
+    glTexCoord2f(1, 1);
+    glVertex2f(0.5, 0.5);
+    glTexCoord2f(1, 0);
+    glVertex2f(0.5, -0.5);
+    glTexCoord2f(0, 0);
+    glVertex2f(-0.5, -0.5);
+
+    glEnd();
+    glPopMatrix();
+
+}
+
+void
+PlayerShip::updateSelf(double timeDelta)
+{
+    angle += angleV * timeDelta;
+}
+
+void
+PlayerShip::keyDown(const SDL_Event &event)
+{
+    int lasty = y;
+    if(y < 145)
+        y = lasty +5;
+    if(y > 300)
+        y = lasty -5;
+    switch(event.key.keysym.sym)
+    {
+        case SDLK_RIGHT:
+        angleV = playerShipAngleV;
+        break;
+
+        case SDLK_LEFT:
+        angleV = -playerShipAngleV;
+        break;
+
+        case SDLK_UP:
+        y = y - 5;
+        break;
+
+        case SDLK_DOWN:
+        y = y + 5;
+        break;
+
+        case SDLK_SPACE:
+        {
+			Bullet * b = new Bullet(this->x, this->y);
+			GM_Level * currentLevel = (GM_Level*)gGame;
+
+			currentLevel->addGameObject(b);
+		}
+        break;
+
+        default:
+        break;
+    }
+}
+
+
+void
+PlayerShip::keyUp(const SDL_Event &event)
+{
+    switch(event.key.keysym.sym)
+    {
+        case SDLK_RIGHT:
+            angleV = 0;
+            break;
+
+        case SDLK_LEFT:
+            angleV = 0;
+            break;
+
+        default:
+            break;
+    }
+
+
+}
+
+void
+PlayerShip::mouseDown(const SDL_Event &event)
+{
+
+}
+
+void
+PlayerShip::mouseUp(const SDL_Event &event)
+{
+
+}
+
+void
+PlayerShip::mouseMove(const SDL_Event &event)
+{
+
+}
+
+