Trouver un fichier de code source :
   

Version Française - English Version
Accueil > 

C++

 > 

[C++] [WIN32] JEUX DE SHOOT ( SPACE SHOOT )

 > 

Shoot\bitmap.cpp


[C++] [WIN32] JEUX DE SHOOT ( SPACE SHOOT )

Shoot\bitmap.cpp


Informations sur ce code source

Cliquez pour voir la capture en taille normale
Code Source [C++] [WIN32] JEUX DE SHOOT ( SPACE SHOOT )
Auteur nikau
Fichier Shoot\bitmap.cpp en C / C++ / C++.NET
Publié le 11/07/2012

Voila un petit jeux vidéo. C'est très simple, il faut shooter le max d'aliens. J'ai crée ce jeux pour tester mon moteur 2D. Donc, les sources, en plus du jeux, sont un moteur de jeux 2D entièrement écrit avec l'API Win32 et en C++. J'utilise aussi la
 

Fichier : Shoot\bitmap.cpp

Nombre de lignes : 110 lignes


Afficher ce fichier en plein écran
  • //------------------------------
  • // bitmap.cpp
  • //------------------------------
  • #include "bitmap.h"
  • #include <windows.h>
  • namespace G2D
  • {
  • cBitmap::cBitmap(HDC hdc)
  • {
  • mHdc = hdc;
  • mMemHdc = CreateCompatibleDC(mHdc);
  • mHbitmap = NULL;
  • }
  • cBitmap::~cBitmap()
  • {
  • DeleteDC(mMemHdc);
  • DeleteObject(mHbitmap);
  • DeleteDC(mHdc);
  • }
  • bool cBitmap::LoadBitmap(std::string filename)
  • {
  • mX = 0;
  • mY = 0;
  • mHbitmap = (HBITMAP)LoadImage(NULL, filename.c_str(), IMAGE_BITMAP,
  • mX, mY, LR_LOADFROMFILE);
  • if(!mHbitmap)
  • {
  • ShowCursor(true);
  • MessageBox(NULL, filename.c_str(), "Failed to load bitmap!", MB_OK | MB_ICONEXCLAMATION);
  • ShowCursor(false);
  • return false;
  • }
  • SelectObject(mMemHdc, mHbitmap);
  • GetObject(mHbitmap, sizeof(BITMAP), &mBitmap);
  • mBitmapWidth = mBitmap.bmWidth;
  • mBitmapHeight = mBitmap.bmHeight;
  • return true;
  • }
  • //-----------------------------------------------
  • // Display a simple bitmap
  • //-----------------------------------------------
  • bool cBitmap::DisplayBitmap(int destX, int destY)
  • {
  • if(BitBlt(mHdc, destX, destY, mBitmap.bmWidth, mBitmap.bmHeight,
  • mMemHdc, mX, mY, SRCCOPY))
  • return true;
  • else
  • return false;
  • }
  • //----------------------------------------------
  • //Display a transparent bitmap
  • //----------------------------------------------
  • bool cBitmap::DisplayBitmap(int destX, int destY, int R, int G, int B)
  • {
  • if(TransparentBlt(mHdc, destX, destY, mBitmap.bmWidth, mBitmap.bmHeight,
  • mMemHdc, mX, mY, mBitmap.bmWidth, mBitmap.bmHeight, RGB(R, G, B)))
  • return true;
  • else
  • return false;
  • }
  • //-----------------------------------------------------------------
  • // Display a transparent bitmap with a BYTE[] as argument
  • //-----------------------------------------------------------------
  • bool cBitmap::DisplayBitmap(int destX, int destY, BYTE byte[])
  • {
  • if(TransparentBlt(mHdc, destX, destY, mBitmap.bmWidth, mBitmap.bmHeight,
  • mMemHdc, mX, mY, mBitmap.bmWidth, mBitmap.bmHeight, RGB(byte[0], byte[1], byte[2])))
  • return true;
  • else
  • return false;
  • }
  • //------------------------------------------------------------------
  • // Display a part of a bitmap with a BYTE[] as argument for color
  • //------------------------------------------------------------------
  • bool cBitmap::DisplayPartBitmap(int destX, int destY, int partX, int partY, int partW, int partH, BYTE color[])
  • {
  • if(TransparentBlt(mHdc, destX, destY, partW, partH,
  • mMemHdc, partX, partY, partW, partH, RGB(color[0], color[1], color[2])))
  • return true;
  • else
  • return false;
  • }
  • INIT CreateBitmapObject(HDC hdc, cBitmap** bitmap)
  • {
  • *bitmap = new cBitmap(hdc);
  • if(*bitmap!=NULL)
  • return G2D_OK;
  • else
  • return G2D_FAILED;
  • }
  • } //namespace G2D


Liste des fichiers du ZIP

FichierTaille
Shoot \ bitmap.cpp2,82 Ko
Shoot \ bitmap.h1,04 Ko
Shoot \ dinput8.dll177,5 Ko
Shoot \ fmod.dll159 Ko
Shoot \ Fmod \ fmod.dll159 Ko
Shoot \ Fmod \ fmodvc.lib57,52 Ko
Shoot \ Fmod \ libfmod.a183,09 Ko
Shoot \ GameEngine2D.rc206 o
Shoot \ header.h1,42 Ko
Shoot \ Icons \ Games.ico5,91 Ko
Shoot \ inputs.h1,16 Ko
Shoot \ keyboard.cpp2,04 Ko
Shoot \ keyboard.h740 o
Shoot \ main.cpp539 o
Shoot \ MyApplication.cpp7,42 Ko
Shoot \ MyApplication.h585 o
Shoot \ Pictures \ bigExplosion.bmp22,13 Ko
Shoot \ Pictures \ bullet.bmp6,8 Ko
Shoot \ Pictures \ Enemy1.bmp4,69 Ko
Shoot \ Pictures \ explosion.bmp7,3 Ko
Shoot \ Pictures \ fond.bmp3,75 Mo
Shoot \ Pictures \ gameOver.bmp3,55 Ko
Shoot \ Pictures \ SpaceShip.bmp9,69 Ko
Shoot \ release.cpp257 o
Shoot \ release.h255 o
Shoot \ renderer.cpp7,41 Ko
Shoot \ renderer.h2,2 Ko
Shoot \ Ressources.h382 o
Shoot \ sound.cpp2,52 Ko
Shoot \ sound.h1,65 Ko
Shoot \ Sounds \ explosion1.wav32,83 Ko
Shoot \ Sounds \ explosion2.wav104,72 Ko
Shoot \ Sounds \ rocket.wav26,2 Ko
Shoot \ sprites.cpp7,16 Ko
Shoot \ sprites.h2,79 Ko
Shoot \ sprites.inl2,66 Ko
Shoot \ sprites_reactions.h612 o
Shoot \ time.cpp1,3 Ko
Shoot \ time.h1,04 Ko
Shoot \ time_convertion.h263 o

Pour télécharger le zip au complet, veuillez vous rendre sur cette page :
Télécharger [C++] [WIN32] JEUX DE SHOOT ( SPACE SHOOT )


Sources du même auteur ayant un ZIP


  • C / C++ / C++.NET Infos image pour opengl
    Ce programme donne toutes les informations nécessaires concernant une image afin de pouvoir la charger avec OpenGL au travers de fonctions c...
    Langage : C / C++ / C++.NET, publié le 11/07/2012 par nikau

Voir la suite...


Sources du même langage comportant un zip


Voir la suite...





Last codes sources (FR)...

Guide achat

Softwares to download (FR)...

  • Devis-Factures PHMSD (2.1.0.1)
    Devis-Factures PHMSD (2.1.0.1)
    Configuration minimale Nécessite Windows™ 2000, XP, Windows 7, 8, Vista (Service Pack à jour) - Processeur 500 Mhz (700 Mhz conseillé) - 256 Mo de Ram - 100 Mo d'espace disque disponible po...
  • Ludoprêt (3.2) [Gratuit / Freeware]
    Ludoprêt (3.2) [Gratuit / Freeware]
    Logiciel gratuit de gestion de ludothèque. Gestion des jeux et des adhérents. Gestion des forfaits et des cotisations. Gestion des prêts et retours. Gestion des retards et édition des relances. ...
  • Revealer Keylogger Free (2.05) [Gratuit / Freeware]
    Revealer Keylogger Free (2.05) [Gratuit / Freeware]
    Keylogger invisible et gratuit pour Windows 8, 7, Vista ou XP. Revealer Keylogger Free vous permet de surveiller l'activité des utilisateurs de votre ordinateur et d'enregistrer toutes les touches du ...

Sondage...

 

Développement réalisé par Nicolas SOREL (Nix) et Emmanuel (EBArtSoft) avec l'aide de Cyril DURAND, Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,39 sec