ヘッダー(.h)ファイルとソース(.cpp)ファイルを使用するクラスを作成しようとしています。私は解決できないように見えるこのエラーに遭遇しました:
エラー:「Menu :: Menu(int w、int h)」は、次の初期化子を提供しません:
これが私のコードです:
ヘッダー:
//Menu.h:
#ifndef MENU_H
#define MENU_H
#include <StdAfx.h>
#include <objidl.h>
#include <gdiplus.h>
#include <windows.h>
using namespace Gdiplus;
#pragma comment (lib,"Gdiplus.lib")
class Menu
{
public:
Menu(int w, int h);
void render();
void checkInput(int x, int y, int message);
void setWidth(int w);
void setHeight(int h);
void setOpenWidth(int w);
void setOpenHeight(int h);
void setPosX(int x);
void setPosY(int y);
void setDraggablePaneColor(Color c);
void setContentPaneColor(Color c);
void setCornerButtonColorInactive(Color c);
void setCornerButtonColorActive(Color c);
void setTextColor(Color c);
void setBorderColor(Color c);
private:
//Position variables:
//window position variables
int posX;
int posY;
//drag offset variables
int dragX;
int dragY;
//Width and height variables:
//width and height of draggable pane
int width;
int height;
//width and height of content pane
int widthOpen;
int heightOpen;
//States
//menu open states
bool menuOpen;
//corner button hover states
bool cornerButtonHover;
bool cornerButtonWasHovering;
//dragging state
bool dragging;
//left mouse button down state
bool lmbDown;
//Colors
//draggable pane color
Color draggablePaneColor;
//content pane color
Color contentPaneColor;
//inactive button color (not hovering)
Color cornerButtonColorInactive;
//active button color (hovering)
Color cornerButtonColorActive;
//text color
Color textColor;
//border color
Color borderColor;
//Constants
//corner button text
const wchar_t cornerButtonText[][3];
//corner button length
const int cornerButtonLength;
//Content
//element content[];
};
#endif
ソース:
//Menu.cpp
#include "Menu.h"
Menu::Menu(int w, int h)
{
}
int posX = 0;
int posY = 0;
//drag offset variables
int dragX = 0;
int dragY = 0;
//Width and height variables:
//width and height of draggable pane
int width = 150;
int height = 20;
//width and height of content pane
int widthOpen = 150;
int heightOpen = 200;
//States
//menu open states
bool menuOpen = true;
//corner button hover states
bool cornerButtonHover = false;
bool cornerButtonWasHovering = false;
//dragging state
bool dragging = false;
//left mouse button down state
bool lmbDown = false;
//Colors
//draggable pane color
Color draggablePaneColor = Color(60, 60, 60);
//content pane color
Color contentPaneColor = Color(80, 80, 80);
//inactive button color (not hovering)
Color cornerButtonColorInactive = Color(60, 60, 60);
//active button color (hovering)
Color cornerButtonColorActive = Color(70, 70, 70);
//text color
Color textColor = Color::White;
//border color
Color borderColor = Color::Black;
//Constants
//corner button text
const wchar_t cornerButtonText[][3] = {L"+", L"-", L"X"};
//corner button length
const int cornerButtonLength = height - 4;
//Content
//element content[];
void Menu()
{
}