1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

add the base for the twitch window

This commit is contained in:
Miso Zmiric (Mike Squinter)
2015-05-30 04:33:29 +01:00
parent 9144080ef7
commit 2d57f82b25
7 changed files with 164 additions and 2 deletions

View File

@@ -3593,4 +3593,7 @@ STR_5256 :Create a new theme to make changes to
STR_5257 :{SMALLFONT}{BLACK}Create a new theme based on the current one
STR_5258 :{SMALLFONT}{BLACK}Delete the current theme
STR_5259 :{SMALLFONT}{BLACK}Rename the current theme
STR_5260 :Giant Screenshot
STR_5260 :Giant Screenshot
STR_5261 :Twitch Integration Options
STR_5262 :Log in with Twtich
STR_5263 :{SMALLFONT}{BLACK}Authenticate the game with your Twitch account to enable Twitch features

View File

@@ -143,6 +143,7 @@
<ClCompile Include="..\src\windows\track_list.c" />
<ClCompile Include="..\src\windows\track_manage.c" />
<ClCompile Include="..\src\windows\track_place.c" />
<ClCompile Include="..\src\windows\twitch.c" />
<ClCompile Include="..\src\windows\viewport.c" />
<ClCompile Include="..\src\windows\water.c" />
<ClCompile Include="..\src\windows\themes.c">

View File

@@ -456,6 +456,9 @@
<ClCompile Include="..\src\windows\themes.c">
<Filter>Source\Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\windows\twitch.c">
<Filter>Source\Windows</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\management\award.h">

View File

@@ -406,6 +406,7 @@ enum {
WC_TITLE_OPTIONS = 117,
WC_LAND_RIGHTS = 118,
WC_THEMES = 119,
WC_TWITCH = 120,
// Only used for colour schemes
WC_STAFF = 220,
@@ -513,6 +514,7 @@ void window_resize_gui_scenario_editor(int width, int height);
void window_top_toolbar_open();
void window_game_bottom_toolbar_open();
void window_about_open();
void window_twitch_open();
void window_footpath_open();
void window_save_prompt_open();
void window_title_menu_open();

View File

@@ -1426,6 +1426,10 @@ enum {
STR_GIANT_SCREENSHOT = 5260,
STR_TWITCH_WINDOW_TITLE = 5261,
STR_TWITCH_AUTH = 5262,
STR_TWITCH_AUTH_TIP = 5263,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};

View File

@@ -350,7 +350,8 @@ static void window_options_mouseup()
window_shortcut_keys_open();
break;
case WIDX_CHANNEL_BUTTON:
window_text_input_raw_open(w, widgetIndex, STR_TWITCH_NAME, STR_TWITCH_NAME_DESC, gConfigTwitch.channel, 32);
//window_text_input_raw_open(w, widgetIndex, STR_TWITCH_NAME, STR_TWITCH_NAME_DESC, gConfigTwitch.channel, 32);
window_twitch_open();
break;
case WIDX_SCREEN_EDGE_SCROLLING:
gConfigGeneral.edge_scrolling ^= 1;

148
src/windows/twitch.c Normal file
View File

@@ -0,0 +1,148 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "../addresses.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../interface/widget.h"
#include "../interface/window.h"
enum window_twitch_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_TWITCH_AUTH
};
rct_widget window_twitch_widgets[] = {
{ WWT_FRAME, 0, 0, 399, 0, 329, 0x0FFFFFFFF, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, 398, 1, 14, STR_TWITCH_WINDOW_TITLE, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, 387, 397, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
{ WWT_DROPDOWN_BUTTON, 1, 100, 299, 53, 64, STR_TWITCH_AUTH, STR_TWITCH_AUTH_TIP }, // twitch auth
{ WIDGETS_END },
};
static void window_twitch_emptysub() { }
static void window_twitch_mouseup();
static void window_twitch_paint();
static void* window_twitch_events[] = {
window_twitch_emptysub,
window_twitch_mouseup,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_emptysub,
window_twitch_paint,
window_twitch_emptysub
};
/**
*
* rct2: 0x0066D2AC
*/
void window_twitch_open()
{
rct_window* window;
// Check if window is already open
window = window_bring_to_front_by_class(WC_TWITCH);
if (window != NULL)
return;
window = window_create_centred(
400,
330,
(uint32*)window_twitch_events,
WC_TWITCH,
0
);
window->widgets = window_twitch_widgets;
window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_TWITCH_AUTH);
window_init_scroll_widgets(window);
window->colours[0] = 7;
window->colours[1] = 7;
window->colours[2] = 7;
}
/**
*
* rct2: 0x0066D4D5
*/
static void window_twitch_mouseup()
{
short widgetIndex;
rct_window *w;
window_widget_get_registers(w, widgetIndex);
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
}
}
/**
*
* rct2: 0x0066D321
*/
static void window_twitch_paint()
{
int x, y;
rct_window *w;
rct_drawpixelinfo *dpi;
window_paint_get_registers(w, dpi);
window_draw_widgets(w, dpi);
x = w->x + 180;
y = w->y + 17;
gfx_draw_sprite(dpi, SPR_G2_TAB_TWITCH, x, y, 0);
x = w->x + 280;
y = w->y + 315;
gfx_draw_string_left(dpi, STR_TWITCH_POWERDBY, NULL, 12, x, y);
}