School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,149 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,715 people online right now. Registration is fast and FREE... Join Now!




MOUSE SPRITES

 

MOUSE SPRITES

SumkindaPsycho

5 Nov, 2009 - 06:54 AM
Post #1

New D.I.C Head
*

Joined: 6 Oct, 2009
Posts: 3

I NEED HELP! Im VERY new to this programming and this is as far as i got so far. my background shows up. Its not finished but for some reason i cannot get my mouse sprite to show up! what am i doing wrong? please take a look and let me know. obviously you wont have the picture files i do but i think maybe you might be able to just check out the code and see what i don't have in here to make my mouse sprite show up. I cant even get the regular mouse to show up on screen. id greatly appreciate any help. Below i will attach the mouse sprite picture that im using ( if you dont know you have to save it in the folder of the cpp file and the other junk) Thank you for atleast taking a look!

CODE
// Explosions!.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include "allegro.h"
#include <stdlib.h>

int _tmain(int argc, _TCHAR* argv[])
{
    
    int mx, my, mb, n;

    //bitmap images
    BITMAP * grenadelauncher;
    BITMAP * terrorists;
    BITMAP * black;
    BITMAP * explosion;

    allegro_init();
    set_color_depth(32);
    set_gfx_mode (GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
    install_keyboard();
    install_mouse(); // pg 196 - 197

    terrorists = load_bitmap("terrorists.bmp" , NULL);
    //for ( n = 0; n <; n++)
        stretch_blit(terrorists, screen, 0, 0,terrorists->w,terrorists->h, 0,
        0, screen->w, screen->h);
  
    unscare_mouse();

    grenadelauncher = load_bitmap("grenadelauncher.bmp", NULL);
    set_mouse_sprite(grenadelauncher);
    set_mouse_sprite_focus(22, 22);
    show_mouse;
    
    mx = mouse_x;
                my = mouse_y;
    mb =(mouse_b & 1);

    
    
    



    system ("pause");
    return 0;
}


This post has been edited by SumkindaPsycho: 5 Nov, 2009 - 07:00 AM


Attached File(s)
Attached File  grenadelauncher.bmp ( 143.97k ) Number of downloads: 8

User is offlineProfile CardPM
+Quote Post


TheGDeveloper

RE: MOUSE SPRITES

5 Nov, 2009 - 09:26 AM
Post #2

New D.I.C Head
*

Joined: 22 Sep, 2009
Posts: 40



Thanked: 2 times
My Contributions
you have to show some source code about set_mouse_sprite etc
anyway read a little bit this http://msdn.microsoft.com/en-us/library/ms997544.aspx
User is offlineProfile CardPM
+Quote Post

stayscrisp

RE: MOUSE SPRITES

6 Nov, 2009 - 09:01 AM
Post #3

Mouth->Insert(Foot);
Group Icon

Joined: 14 Feb, 2008
Posts: 1,404



Thanked: 54 times
Dream Kudos: 300
My Contributions
In Allegro you need to call Acquire and Release screen calls, like this

CODE

acquire_screen();

// Drawing code here

release_screen();


I'm pretty sure you also need to call END_OF_MAIN(); after your main function, like this

CODE

int main()
{
}
END_OF_MAIN();


Hope that helps smile.gif





User is offlineProfile CardPM
+Quote Post

SumkindaPsycho

RE: MOUSE SPRITES

8 Nov, 2009 - 10:54 PM
Post #4

New D.I.C Head
*

Joined: 6 Oct, 2009
Posts: 3

I thank both of you much Im definitely going to check out that link and i did not know about that release screen thing. My professor said nothing about that so thanks a bunch guys!!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 04:21PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month