Changeset 130


Ignore:
Timestamp:
12/22/2007 06:34:13 AM (4 years ago)
Author:
guyru
Message:

dice themes class

Location:
trunk/OpenYahtzee/src
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/OpenYahtzee/src/About.cpp

    r109 r130  
    11// $Header: $ 
    22/*************************************************************************** 
    3  *   Copyright (C) 2006 by Guy Rutenberg   * 
     3 *   Copyright (C) 2006-2007 by Guy Rutenberg   * 
    44 *   guyrutenberg@gmail.com   * 
    55 *                                                                         * 
     
    4848        notebook_main_pane_about = new wxPanel(notebook_main, -1); 
    4949         
    50         bitmap_1 = new wxDynamicBitmap((wxWindow*)this, (wxWindowID)wxID_ANY,*logo); 
     50        bitmap_1 = new wxDynamicBitmap((wxWindow*)this, (wxWindowID)wxID_ANY,logo); 
    5151#ifdef PORTABLE 
    5252        app_label = new wxStaticText(this, -1, wxT("Open Yahtzee Portable Edition 1.8.0")); 
  • trunk/OpenYahtzee/src/MainFrame.cpp

    r128 r130  
    4141#include <wx/version.h> 
    4242 
    43 //include the images for the dice 
    44 #include "one.xpm" 
    45 #include "two.xpm" 
    46 #include "three.xpm" 
    47 #include "four.xpm" 
    48 #include "five.xpm" 
    49 #include "six.xpm" 
    50  
    5143//include the icon file 
    5244#include "Icon.h" 
     
    8577        InitializeDatabase();//this must come _after_ m_settingsdb and m_highscoredb are created 
    8678 
    87         bitmap_dices[0] = new wxBitmap(one_xpm); 
    88         bitmap_dices[1] = new wxBitmap(two_xpm); 
    89         bitmap_dices[2] = new wxBitmap(three_xpm); 
    90         bitmap_dices[3] = new wxBitmap(four_xpm); 
    91         bitmap_dices[4] = new wxBitmap(five_xpm); 
    92         bitmap_dices[5] = new wxBitmap(six_xpm); 
     79        //bitmap_dices[0] = new wxBitmap(one_xpm); 
     80        //bitmap_dices[1] = new wxBitmap(two_xpm); 
     81        //bitmap_dices[2] = new wxBitmap(three_xpm); 
     82        //bitmap_dices[3] = new wxBitmap(four_xpm); 
     83        //bitmap_dices[4] = new wxBitmap(five_xpm); 
     84        //bitmap_dices[5] = new wxBitmap(six_xpm); 
    9385         
    9486        //randomize the random-number generator based on the time 
     
    264256        //BEGIN layout for the dice section of the score board 
    265257        if (m_settings.horizontal_layout) { 
     258                diceSizer->Add(new wxDynamicBitmap(panel, ID_DICE1, 
     259                        m_dice_graphics.GetDice(1)), 0, wxALL, DICE_SPACE); 
    266260                diceSizer->Add(new wxDynamicBitmap(panel, 
    267                         ID_DICE1, *bitmap_dices[0]), 0, wxALL, DICE_SPACE); 
     261                        ID_DICE2, m_dice_graphics.GetDice(2)), 0, wxALL, DICE_SPACE); 
    268262                diceSizer->Add(new wxDynamicBitmap(panel, 
    269                         ID_DICE2, *bitmap_dices[1]), 0, wxALL, DICE_SPACE); 
     263                        ID_DICE3, m_dice_graphics.GetDice(3)), 0, wxALL,DICE_SPACE); 
    270264                diceSizer->Add(new wxDynamicBitmap(panel, 
    271                         ID_DICE3, *bitmap_dices[2]), 0, wxALL,DICE_SPACE); 
     265                        ID_DICE4, m_dice_graphics.GetDice(4)), 0, wxALL,DICE_SPACE); 
    272266                diceSizer->Add(new wxDynamicBitmap(panel, 
    273                         ID_DICE4, *bitmap_dices[3]), 0, wxALL,DICE_SPACE); 
    274                 diceSizer->Add(new wxDynamicBitmap(panel, 
    275                         ID_DICE5, *bitmap_dices[4]), 0, wxALL,DICE_SPACE); 
     267                        ID_DICE5, m_dice_graphics.GetDice(5)), 0, wxALL,DICE_SPACE); 
    276268                diceSizer->Add(new wxButton(panel, ID_ROLL, wxT("Roll!"), 
    277269                        wxDefaultPosition, wxSize(64,64)), 0, wxALL,DICE_SPACE); 
     
    288280        } else { 
    289281                diceSizer->Add(new wxDynamicBitmap(panel, ID_DICE1, 
    290                         *bitmap_dices[0]), 0, wxALL, DICE_SPACE); 
     282                        m_dice_graphics.GetDice(1)), 0, wxALL, DICE_SPACE); 
    291283                diceSizer->Add(new wxCheckBox(panel, ID_DICE1KEEP, 
    292284                        wxT("Keep")), 0, wxLEFT, KEEP_SPACE); 
    293285                diceSizer->AddSpacer(VER_DICE_SPACER); 
    294286                diceSizer->Add(new wxDynamicBitmap(panel,ID_DICE2, 
    295                         *bitmap_dices[1]), 0, wxALL, DICE_SPACE); 
     287                        m_dice_graphics.GetDice(2)), 0, wxALL, DICE_SPACE); 
    296288                diceSizer->Add(new wxCheckBox(panel, ID_DICE2KEEP, 
    297289                        wxT("Keep")), 0, wxLEFT, KEEP_SPACE); 
    298290                diceSizer->AddSpacer(VER_DICE_SPACER); 
    299291                diceSizer->Add(new wxDynamicBitmap(panel, ID_DICE3, 
    300                         *bitmap_dices[2]), 0, wxALL, DICE_SPACE); 
     292                        m_dice_graphics.GetDice(3)), 0, wxALL, DICE_SPACE); 
    301293                diceSizer->Add(new wxCheckBox(panel, ID_DICE3KEEP, 
    302294                        wxT("Keep")), 0, wxLEFT, KEEP_SPACE); 
    303295                diceSizer->AddSpacer(VER_DICE_SPACER); 
    304296                diceSizer->Add(new wxDynamicBitmap(panel, ID_DICE4, 
    305                         *bitmap_dices[3]), 0, wxALL, DICE_SPACE); 
     297                        m_dice_graphics.GetDice(4)), 0, wxALL, DICE_SPACE); 
    306298                diceSizer->Add(new wxCheckBox(panel, ID_DICE4KEEP, 
    307299                        wxT("Keep")), 0, wxLEFT, KEEP_SPACE); 
    308300                diceSizer->AddSpacer(VER_DICE_SPACER); 
    309301                diceSizer->Add(new wxDynamicBitmap(panel, ID_DICE5,  
    310                         *bitmap_dices[4]), 0, wxALL, DICE_SPACE); 
     302                        m_dice_graphics.GetDice(5)), 0, wxALL, DICE_SPACE); 
    311303                diceSizer->Add(new wxCheckBox(panel, ID_DICE5KEEP, 
    312304                        wxT("Keep")), 0, wxLEFT, KEEP_SPACE); 
     
    628620                                        ((wxDynamicBitmap*) FindWindow(i +  
    629621                                                ID_DICE1)) -> SetBitmap( 
    630                                                 *bitmap_dices[dice[i]-1]); 
     622                                                m_dice_graphics.GetDice(dice[i])); 
    631623                                } 
    632624                        } 
     
    638630                                dice[i] = (int)(6.0*rand()/RAND_MAX)+1; 
    639631                                ((wxDynamicBitmap*) FindWindow(i + ID_DICE1))-> 
    640                                         SetBitmap(*bitmap_dices[dice[i]-1]); 
     632                                        SetBitmap(m_dice_graphics.GetDice(dice[i])); 
    641633                        } 
    642634                } 
  • trunk/OpenYahtzee/src/MainFrame.h

    r127 r130  
    2828#include "HighScoreTableDB.h" 
    2929#include "ScoreDice.h" 
     30#include "dice_graphics.h" 
    3031#ifndef MAINFRAME_INC 
    3132#define MAINFRAME_INC 
     
    101102        //pointers to hold bitmap data for the dices 
    102103        wxBitmap *bitmap_dices[6]; 
     104        DiceGraphics m_dice_graphics; 
    103105 
    104106        short int m_rolls;      //holds how many rolls left 
  • trunk/OpenYahtzee/src/Makefile.am

    r116 r130  
    44        HighScoreTableDB.cpp HighScoreDialog.cpp SettingsDialog.cpp icon.xpm \ 
    55        icon32.xpm openyahtzee.rc wxDynamicBitmap.cpp About.cpp \ 
    6         UtilityFunctions.cpp ScoreDice.cpp 
     6        UtilityFunctions.cpp ScoreDice.cpp dice_graphics.cpp 
    77 
    88# set the include path found by configure 
     
    1313noinst_HEADERS = MainFrame.h ObjectsID.h SettingsDB.h HighScoreTableDB.h \ 
    1414        HighScoreDialog.h SettingsDialog.h Icon.h icon32.ico wxDynamicBitmap.h \ 
    15         UtilityFunctions.h ScoreDice.h 
     15        UtilityFunctions.h ScoreDice.h dice_graphics.cpp 
    1616 
    1717AM_CXXFLAGS = `wx-config --cxxflags` 
  • trunk/OpenYahtzee/src/wxDynamicBitmap.cpp

    r72 r130  
    11// $Header$ 
    22/*************************************************************************** 
    3  *   Copyright (C) 2006 by Guy Rutenberg   * 
     3 *   Copyright (C) 2006-2007 by Guy Rutenberg   * 
    44 *   guyrutenberg@gmail.com   * 
    55 *                                                                         * 
     
    2626#include <iostream> 
    2727 
    28 wxDynamicBitmap::wxDynamicBitmap(wxWindow* parent, wxWindowID id, wxBitmapbitmap, 
     28wxDynamicBitmap::wxDynamicBitmap(wxWindow* parent, wxWindowID id, wxBitmap *bitmap, 
    2929                                const wxPoint& pos, const wxSize& size, 
    3030                                long style, const wxString& name) 
     
    4949} 
    5050 
    51 void wxDynamicBitmap::SetBitmap( wxBitmap& bitmap) 
     51void wxDynamicBitmap::SetBitmap( wxBitmap *bitmap) 
    5252{ 
    53         m_bitmap = bitmap; 
     53        m_bitmap = *bitmap; 
    5454        SetGrayScale(m_grayscale); 
    5555        wxWindow::Refresh(); 
  • trunk/OpenYahtzee/src/wxDynamicBitmap.h

    r71 r130  
    11// $Header$ 
    22/*************************************************************************** 
    3  *   Copyright (C) 2006 by Guy Rutenberg   * 
     3 *   Copyright (C) 2006-2007 by Guy Rutenberg   * 
    44 *   guyrutenberg@gmail.com   * 
    55 *                                                                         * 
     
    3939class wxDynamicBitmap : public wxControl { 
    4040public: 
    41         wxDynamicBitmap (wxWindow* parent, wxWindowID id, wxBitmapbitmap, 
     41        wxDynamicBitmap (wxWindow* parent, wxWindowID id, wxBitmap  *bitmap, 
    4242                 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, 
    4343                 long style = wxNO_BORDER, const wxString& name = wxPanelNameStr); 
    44         virtual void SetBitmap(wxBitmapbitmap); 
     44        virtual void SetBitmap(wxBitmap  *bitmap); 
    4545        wxBitmap GetBitmap(); 
    4646        void OnPaint(wxPaintEvent& event); 
Note: See TracChangeset for help on using the changeset viewer.